/* =========================================================================
   IV Regiedashboard — hoofdstylesheet
   Light + dark (voorbereid via [data-theme]); desktop-first, responsive.
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

:root{
  --navy:#1e3a8a; --navy-700:#1d4ed8; --sky:#0ea5e9;
  --bg:#f1f5f9; --panel:#ffffff; --ink:#0f172a; --muted:#64748b; --line:#e2e8f0;
  --green:#22c55e; --amber:#f59e0b; --red:#ef4444; --violet:#6366f1;
  --radius:14px; --shadow:0 1px 2px rgba(15,23,42,.06),0 8px 24px rgba(15,23,42,.06);
  --sidebar:#16255c;
}
:root[data-theme="dark"]{
  --bg:#0b1220; --panel:#111a2e; --ink:#e6edf8; --muted:#93a4c3; --line:#1e2a44;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35); --sidebar:#0d1730;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0b1220; --panel:#111a2e; --ink:#e6edf8; --muted:#93a4c3; --line:#1e2a44;
    --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35); --sidebar:#0d1730;
  }
}

html,body{ background:var(--bg); color:var(--ink);
  font-family:"Segoe UI",Roboto,Helvetica,Arial,system-ui,sans-serif; font-size:14px; line-height:1.5; }
a{ color:var(--navy-700); text-decoration:none; } a:hover{ text-decoration:underline; }

/* ---------- App shell ---------- */
.app{ display:grid; grid-template-columns:248px 1fr; min-height:100vh; }
.side{ background:linear-gradient(180deg,var(--sidebar),var(--navy)); color:#cdd7f0; padding:20px 14px; position:sticky; top:0; height:100vh; overflow:auto; }
.brand{ display:flex; align-items:center; gap:11px; padding:6px 8px 20px; }
.brand .logo{ width:38px; height:38px; border-radius:10px; background:linear-gradient(135deg,#38bdf8,#6366f1);
  display:flex; align-items:center; justify-content:center; font-weight:800; color:#fff; font-size:18px; }
.brand b{ color:#fff; font-size:15px; display:block; } .brand span{ font-size:11px; color:#9fb2e6; }
.nav-group{ font-size:10.5px; text-transform:uppercase; letter-spacing:.10em; color:#7f93cf; margin:16px 10px 6px; }
.nav a{ display:flex; align-items:center; gap:11px; padding:9px 11px; border-radius:9px; color:#cdd7f0; font-size:13.5px; margin:2px 0; }
.nav a:hover{ background:rgba(255,255,255,.07); text-decoration:none; }
.nav a.active{ background:rgba(255,255,255,.14); color:#fff; font-weight:600; }
.nav a .ic{ width:18px; text-align:center; opacity:.9; }

.main{ display:flex; flex-direction:column; min-width:0; }
.top{ background:var(--panel); border-bottom:1px solid var(--line); padding:12px 26px; display:flex; align-items:center; gap:16px; position:sticky; top:0; z-index:10; }
.crumbs{ color:var(--muted); font-size:12.5px; } .crumbs b{ color:var(--ink); }
.search{ margin-left:auto; } .search input{ background:var(--bg); border:1px solid var(--line); border-radius:9px; padding:8px 13px; width:280px; color:var(--ink); font-size:13px; }
.rolechip{ background:#eef2ff; color:var(--navy); border:1px solid #dbe3ff; border-radius:999px; padding:6px 13px; font-size:12.5px; font-weight:600; white-space:nowrap; }
:root[data-theme="dark"] .rolechip{ background:#1b2544; color:#c7d2fe; border-color:#2a3a63; }
.usermenu{ position:relative; }
.avatar{ width:34px; height:34px; border-radius:50%; background:linear-gradient(135deg,#0ea5e9,#6366f1); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; }
.avatar:hover{ text-decoration:none; }
.usermenu-pop{ position:absolute; right:0; top:calc(100% + 10px); background:var(--panel); border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow); padding:6px; min-width:170px; display:none; z-index:20; }
.usermenu-pop::before{ content:""; position:absolute; left:0; right:0; top:-10px; height:10px; }
.usermenu:hover .usermenu-pop, .usermenu:focus-within .usermenu-pop{ display:block; }
.usermenu-pop a, .usermenu-pop button{ display:block; width:100%; text-align:left; padding:9px 12px; border:none; background:none; color:var(--ink); font-size:13px; border-radius:7px; cursor:pointer; }
.usermenu-pop a:hover, .usermenu-pop button:hover{ background:var(--bg); text-decoration:none; }

.content{ padding:24px 26px; }
.page-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.h1{ font-size:20px; font-weight:700; } .sub{ color:var(--muted); font-size:13px; margin-top:3px; }

/* ---------- KPI + panels ---------- */
.kpis{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin:20px 0; }
.kpi{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px; box-shadow:var(--shadow); }
.kpi .lab{ color:var(--muted); font-size:12.5px; display:flex; align-items:center; gap:8px; }
.kpi .val{ font-size:30px; font-weight:800; margin-top:8px; letter-spacing:-.5px; }
.kpi .dot{ width:9px; height:9px; border-radius:50%; } .kpi .trend{ font-size:11.5px; margin-top:6px; color:var(--muted); }
.grid{ display:grid; grid-template-columns:2fr 1fr; gap:16px; }
.grid3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.panel{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:18px; }
.panel h3{ font-size:14px; } .panel .ph{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.muted{ color:var(--muted); font-size:12px; }

.pill{ font-size:11px; font-weight:700; padding:2px 9px; border-radius:999px; display:inline-block; }
.pill.g{ background:#dcfce7; color:#15803d; } .pill.a{ background:#fef3c7; color:#b45309; }
.pill.r{ background:#fee2e2; color:#b91c1c; } .pill.b{ background:#e0f2fe; color:#0369a1; }
.tag{ display:inline-block; font-size:11px; font-weight:700; padding:3px 9px; border-radius:999px; }
.tag-green{ background:#dcfce7; color:#15803d; } .tag-amber{ background:#fef3c7; color:#b45309; } .tag-blue{ background:#e0f2fe; color:#0369a1; }

/* ---------- Tabellen ---------- */
table{ width:100%; border-collapse:collapse; font-size:13px; }
th{ text-align:left; color:var(--muted); font-weight:600; font-size:11.5px; text-transform:uppercase; letter-spacing:.03em; padding:8px 10px; border-bottom:1px solid var(--line); }
td{ padding:11px 10px; border-bottom:1px solid var(--line); }
tr:last-child td{ border-bottom:none; }
.table-card{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.table-card table{ }
.table-card th, .table-card td{ padding:12px 16px; }
.rag{ display:inline-flex; align-items:center; gap:7px; font-weight:600; }
.bar{ height:7px; background:var(--line); border-radius:99px; overflow:hidden; width:120px; display:inline-block; vertical-align:middle; }
.bar > i{ display:block; height:100%; border-radius:99px; }
.code{ font-family:ui-monospace,Menlo,Consolas,monospace; font-size:12px; color:var(--muted); }
.rag-split{ display:flex; height:16px; border-radius:99px; overflow:hidden; background:var(--line); }
.rag-split > i{ display:block; }

.hbars{ list-style:none; } .hbars li{ margin:12px 0; }
.hbars .row{ display:flex; justify-content:space-between; font-size:12.5px; margin-bottom:5px; }
.hbars .track{ height:9px; background:var(--line); border-radius:99px; overflow:hidden; } .hbars .track > i{ display:block; height:100%; }
.ms{ list-style:none; } .ms li{ display:flex; gap:12px; padding:11px 0; border-bottom:1px solid var(--line); }
.ms li:last-child{ border:none; } .ms .d{ text-align:center; min-width:44px; }
.ms .d b{ display:block; font-size:16px; } .ms .d span{ font-size:10.5px; color:var(--muted); text-transform:uppercase; }
.ms .t{ font-size:13px; font-weight:600; } .ms .t span{ display:block; font-weight:400; color:var(--muted); font-size:11.5px; }

/* ---------- Forms ---------- */
.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.field{ margin-bottom:4px; } .field.full{ grid-column:1 / -1; }
label{ font-size:12.5px; font-weight:600; color:var(--ink); display:block; margin:0 0 7px; }
.inp, select, textarea{ width:100%; padding:10px 13px; border:1px solid var(--line); border-radius:10px; font-size:14px; background:var(--panel); color:var(--ink); font-family:inherit; }
textarea{ min-height:90px; resize:vertical; }
.inp:focus, select:focus, textarea:focus{ outline:none; border-color:var(--navy-700); box-shadow:0 0 0 3px rgba(29,78,216,.12); }
.btn{ display:inline-flex; align-items:center; gap:7px; padding:10px 16px; border-radius:10px; font-size:13.5px; font-weight:600; border:1px solid var(--line); background:var(--panel); color:var(--ink); cursor:pointer; }
.btn:hover{ text-decoration:none; background:var(--bg); }
.btn-primary{ background:var(--navy); border-color:var(--navy); color:#fff; } .btn-primary:hover{ background:var(--navy-700); }
.btn-danger{ background:var(--red); border-color:var(--red); color:#fff; } .btn-danger:hover{ opacity:.9; background:var(--red); }
.btn-block{ width:100%; justify-content:center; margin-top:22px; }
.btn-sm{ padding:6px 11px; font-size:12px; }
.link-btn{ background:none; border:none; color:var(--navy-700); cursor:pointer; font-size:13px; }
.toolbar{ display:flex; gap:10px; align-items:center; margin:18px 0; flex-wrap:wrap; }
.toolbar .spacer{ margin-left:auto; }

/* ---------- Alerts / toasts ---------- */
.alert{ padding:12px 15px; border-radius:10px; font-size:13px; margin-bottom:16px; border:1px solid; }
.alert-success{ background:#dcfce7; border-color:#bbf7d0; color:#166534; }
.alert-error{ background:#fee2e2; border-color:#fecaca; color:#991b1b; }
.alert-info{ background:#e0f2fe; border-color:#bae6fd; color:#075985; }
.toast{ position:fixed; top:18px; right:18px; padding:12px 16px; border-radius:10px; color:#fff; font-size:13px; box-shadow:var(--shadow); z-index:100; }
.toast-success{ background:var(--green); } .toast-error{ background:var(--red); } .toast-info{ background:var(--sky); }
.notice{ background:#fff7ed; border:1px solid #fed7aa; color:#9a3412; border-radius:12px; padding:12px 15px; font-size:12.5px; margin-bottom:16px; display:flex; gap:10px; }

.pagination{ display:flex; gap:16px; align-items:center; justify-content:center; margin:20px 0; }

/* ---------- Tabs ---------- */
.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--line); margin:18px 0 20px; flex-wrap:wrap; }
.tab{ padding:10px 14px; font-size:13px; color:var(--muted); border-bottom:2px solid transparent; font-weight:600; cursor:pointer; background:none; border-top:none; border-left:none; border-right:none; }
.tab:hover{ color:var(--ink); text-decoration:none; }
.tab.active{ color:var(--navy); border-color:var(--navy); }
.tab.locked{ color:#cbd5e1; cursor:not-allowed; } .tab.locked::after{ content:" 🔒"; font-size:11px; }

/* ---------- Auth ---------- */
.auth-body{ min-height:100vh; }
.split{ display:grid; grid-template-columns:1.1fr .9fr; min-height:100vh; }
.promo{ background:linear-gradient(150deg,#16255c,#1e3a8a 55%,#0ea5e9); color:#fff; padding:56px 60px; display:flex; flex-direction:column; }
.promo-logo{ width:52px;height:52px;border-radius:13px;background:rgba(255,255,255,.15);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:22px;color:#fff; }
.promo-logo.center{ margin:0 auto 18px; }
.promo h1{ font-size:34px; margin-top:auto; line-height:1.2; }
.promo p{ color:#c7d5f5; margin-top:16px; font-size:15px; max-width:420px; }
.promo ul{ margin-top:26px; list-style:none; display:flex; flex-direction:column; gap:11px; }
.promo li{ color:#dbe6ff; font-size:13.5px; } .promo li b{ color:#fff; }
.form-wrap{ display:flex; align-items:center; justify-content:center; padding:40px; }
.auth-card{ width:380px; } .auth-card h2{ font-size:23px; } .auth-card .lead{ color:var(--muted); margin:7px 0 20px; font-size:13.5px; }
.auth-card label{ margin-top:16px; }
.sso{ margin-top:18px; padding:11px; border:1px solid var(--line); border-radius:10px; text-align:center; color:var(--muted); font-size:13px; font-weight:600; }
.auth-foot{ margin-top:24px; font-size:11.5px; color:var(--muted); text-align:center; }

.role-wrap{ max-width:720px; margin:6vh auto; padding:20px; }
.center{ text-align:center; } .lead{ color:var(--muted); font-size:14px; }
.role-wrap h1{ font-size:26px; margin-top:4px; } .role-wrap .lead{ margin:9px 0 30px; }
.roles{ display:grid; grid-template-columns:1fr 1fr; gap:16px; text-align:left; }
.role-card{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); display:flex; gap:15px; align-items:flex-start; cursor:pointer; text-align:left; font-family:inherit; }
.role-card:hover{ border-color:var(--navy-700); box-shadow:0 0 0 3px rgba(29,78,216,.12),var(--shadow); }
.role-ic{ width:44px;height:44px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:20px;color:#fff;flex:none; }
.role-body{ display:block; } .role-name{ font-size:15px; font-weight:700; display:block; } .role-desc{ color:var(--muted); font-size:12.5px; margin:5px 0 8px; display:block; }
.hint{ margin-top:16px; color:var(--muted); font-size:12px; }

.error-page{ max-width:440px; margin:14vh auto; text-align:center; padding:20px; }
.error-code{ font-size:72px; font-weight:800; color:var(--navy); } .error-page h1{ font-size:22px; margin:6px 0; } .error-page p{ color:var(--muted); margin-bottom:22px; }

/* ---------- Meta blokken ---------- */
.meta{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-top:14px; }
.meta .b{ background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:13px 15px; box-shadow:var(--shadow); }
.meta .l{ color:var(--muted); font-size:11.5px; } .meta .v{ font-weight:700; margin-top:5px; font-size:14px; }
.badge{ font-size:11px; font-weight:700; padding:3px 10px; border-radius:999px; }

/* ---------- Modal (details/summary based) ---------- */
.modal{ border:none; border-radius:var(--radius); padding:0; max-width:560px; width:92%; box-shadow:0 20px 60px rgba(0,0,0,.3); background:var(--panel); color:var(--ink); }
.modal::backdrop{ background:rgba(15,23,42,.5); }
.modal .mhead{ padding:18px 20px; border-bottom:1px solid var(--line); font-weight:700; }
.modal .mbody{ padding:20px; } .modal .mfoot{ padding:16px 20px; border-top:1px solid var(--line); display:flex; gap:10px; justify-content:flex-end; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px){
  .kpis{ grid-template-columns:repeat(2,1fr); } .grid,.grid3,.grid2{ grid-template-columns:1fr; }
  .form-grid{ grid-template-columns:1fr; } .meta{ grid-template-columns:1fr 1fr; }
}
@media (max-width: 820px){
  .app{ grid-template-columns:1fr; } .side{ position:static; height:auto; }
  .split{ grid-template-columns:1fr; } .promo{ display:none; } .roles{ grid-template-columns:1fr; }
  .search input{ width:160px; }
}
