:root {
  --bg: #f5f6fa; --panel: #ffffff; --ink: #1d2433; --muted: #6b7385; --line: #e4e7ef;
  --brand: #5b3df5; --brand-soft: #eeeaff; --ok: #12925b; --ok-soft: #e3f6ec; --warn: #b7791f; --warn-soft: #fdf3e1;
  --bad: #c53b3b; --bad-soft: #fbe9e9; --info: #2b6cb0; --info-soft: #e6f0fb;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .05);
}
.btn.cc-danger { color: var(--bad); border-color: var(--bad); }
.cc-layout { grid-template-columns: 2fr 1fr; }
.cc-sections { margin-top: 18px; }
.cc-results { display: flex; gap: 8px; flex-wrap: wrap; }
.cc-turn { white-space: pre-wrap; overflow-wrap: anywhere; }
details.panel > summary { font-weight: 700; cursor: pointer; }
details.panel[open] > summary { margin-bottom: 16px; }
@media (max-width: 800px) {
  .cc-layout { grid-template-columns: 1fr; }
  #cc-stop { position: fixed; bottom: 16px; left: 16px; z-index: 40; background: var(--panel); box-shadow: var(--shadow); }
  #toast { bottom: 70px; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11131a; --panel: #1a1d27; --ink: #e8eaf2; --muted: #9aa2b5; --line: #2a2f3d;
    --brand: #8b74ff; --brand-soft: #2a2450; --ok: #3ccf8e; --ok-soft: #173427; --warn: #f0b458; --warn-soft: #3a2f18;
    --bad: #ff7a7a; --bad-soft: #3d1f22; --info: #7ab4ff; --info-soft: #1b2b40; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
a { color: var(--brand); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* layout */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex;
  flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand-logo { width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain; }
nav { display: grid; gap: 2px; }
nav a { text-decoration: none; color: var(--ink); padding: 9px 12px; border-radius: 10px; font-weight: 500; }
nav a:hover { background: var(--bg); }
nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
#logout { margin-top: auto; }
.main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; min-width: 0; }
td.nowrap { white-space: nowrap; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px; }

/* componenten */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 10px; padding: 9px 16px; cursor: pointer; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: default; }
.switch { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.switch-btn { width: 64px; height: 34px; border-radius: 34px; border: none; background: var(--line); position: relative;
  cursor: pointer; transition: background .2s; }
.switch-btn::after { content: ""; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch-btn.on { background: var(--ok); }
.switch-btn.on::after { left: 34px; }
.switch-label { font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .8rem;
  font-weight: 650; background: var(--bg); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.alerts { display: grid; gap: 8px; margin-bottom: 18px; }
.alert { border-radius: 12px; padding: 11px 14px; font-weight: 500; border: 1px solid transparent; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--info); }
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: 2fr 1fr; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); min-width: 0; }
.card .label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.card .value { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; }
.card .sub { color: var(--muted); font-size: .85rem; }
.bar { height: 8px; background: var(--bg); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 8px; }
.bar.ok > span { background: var(--ok); } .bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
.chart-box { position: relative; height: 280px; }
.funnel { display: grid; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 70px; align-items: center; gap: 10px; font-size: .9rem; }
.funnel-row .bar { margin: 0; height: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .82rem; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
.table-wrap { overflow-x: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs .btn.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.mail-body { white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 16px; font-size: .95rem; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { max-width: 320px; } .toolbar select { max-width: 220px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: auto; margin-top: 4px; }
.service { border-bottom: 1px solid var(--line); padding: 14px 0; display: grid; gap: 8px; }
.service:last-child { border-bottom: none; }
.findings { margin: 0; padding-left: 18px; } .findings li { margin: 3px 0; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 18, 30, .5); display: grid; place-items: center;
  padding: 16px; z-index: 50; }
.modal { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; max-width: 440px; width: 100%; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal p { margin: 0 0 6px; font-weight: 500; }
.modal-actions { justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: var(--panel); padding: 12px 16px;
  border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); max-width: 360px; }
.back { margin-bottom: 14px; }
.analysis-text { width: 100%; min-height: 460px; white-space: pre-wrap; font-size: .92rem; line-height: 1.45;
  margin-top: 12px; }
.stats-table td.num, .stats-table th.num { text-align: right; white-space: nowrap; }
.stats-table td.pct { min-width: 150px; }
.stats-table td.pct .bar { margin-top: 4px; }
.stats-scroll { max-height: 520px; overflow-y: auto; }
.stats-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px; }
.stats-head h2 { margin: 0; }
.stats-head select { width: auto; }
.lvl-fout td:first-child { border-left: 3px solid var(--bad); }
.lvl-waarschuwing td:first-child { border-left: 3px solid var(--warn); }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  nav { display: flex; flex-wrap: wrap; } #logout { margin-top: 0; margin-left: auto; }
  .main { padding: 18px 16px 40px; } .two { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 110px 1fr 56px; }
}

.rewrite-status { margin-bottom: 14px; }
.rewrite-status h2 { margin: 0; font-size: 1rem; }
.rewrite-progress { display: block; width: 100%; height: 14px; margin: 10px 0 6px; accent-color: var(--brand); }
