/* Channeltrix - design 1 "Helder & Vertrouwd". Alle kleuren via variabelen. */
:root {
  --bg: #F6F7FB; --panel: #FFFFFF; --ink: #111827; --muted: #5B6474; --line: #E3E6EE;
  --brand: #2F5BEA; --brand-ink: #FFFFFF; --brand-soft: #EAF0FF; --shadow: 0 1px 2px rgba(17,24,39,.06);
  --ok: #128a4a; --ok-soft: #e3f6ea; --warn: #b45309; --warn-soft: #fdf0dc; --bad: #c0262d; --bad-soft: #fde7e7;
  --side: #10142A; --side-ink: #C9CEE6; --side-active: #FFFFFF;
  --radius: 12px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h3 { margin: 0 0 12px; font-size: 16px; } h4 { margin: 0 0 8px; }
code { background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11px; } .nowrap { white-space: nowrap; }
.bad-text { color: var(--bad); }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.sidebar nav a { color: var(--side-ink); padding: 8px 12px; border-radius: 8px; }
.sidebar nav a.active { background: rgba(255,255,255,.08); color: var(--side-active); font-weight: 600; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: var(--side-active); text-decoration: none; }
.nav-section { margin: 16px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .6; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; display: grid; gap: 6px; }
.sidebar-foot .link { color: var(--side-ink); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: #fff; margin-bottom: 18px; }
.brand.big { color: var(--ink); font-size: 22px; justify-content: center; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.main { padding: 26px 32px 60px; max-width: 1400px; width: 100%; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.narrow { max-width: 560px; }
.impersonate { background: var(--warn-soft); color: var(--warn); padding: 8px 32px; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-weight: 600; }
.card.empty { text-align: center; padding: 34px; }
.grid { display: grid; gap: 16px; } .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.project-card { color: inherit; transition: border-color .15s, transform .15s; }
.project-card:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.stack { display: grid; gap: 12px; }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.scroll-x { overflow-x: auto; }

label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label.check { display: flex; align-items: center; gap: 6px; color: var(--ink); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
input.copy { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; background: var(--bg); cursor: copy; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 0 16px; min-height: 40px; border-radius: var(--radius); justify-content: center; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); } .btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.btn.small { padding: 0 10px; min-height: 30px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--ok-soft); color: var(--ok); border: 1px solid transparent; }
.flash.error { background: var(--bad-soft); color: var(--bad); } .flash.info { background: var(--brand-soft); color: var(--brand); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table.small td { padding: 6px 8px; font-size: 12.5px; }
.table tr.excluded td { background: var(--bad-soft); }
.table td.actions { display: flex; gap: 6px; }
pre.json { background: var(--bg); padding: 12px; border-radius: 8px; max-height: 360px; overflow: auto; font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: 12.5px; }
.stat span { display: block; font-size: 24px; font-weight: 700; color: var(--ink); }
.stat.bad span { color: var(--bad); }
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.flow-step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--ink); display: grid; gap: 4px; position: relative; }
.flow-step span { color: var(--muted); font-size: 12.5px; }
.flow-step:hover { border-color: var(--brand); text-decoration: none; }
.row-line { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input[name=q] { flex: 1; min-width: 220px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 5px 12px; border-radius: 99px; color: var(--muted); border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; }
.tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager { display: flex; gap: 4px; flex-wrap: wrap; } .pager a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.pager a.active { background: var(--brand); color: #fff; }
details.import { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
details.import summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.import[open] summary { margin-bottom: 12px; }
.plan .price { font-size: 26px; font-weight: 700; margin: 6px 0 10px; } .plan .price small { font-size: 12px; color: var(--muted); font-weight: 400; }
.plan.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.plan ul { padding-left: 18px; margin: 0 0 14px; }
.plan-row { padding: 8px 0; border-bottom: 1px dashed var(--line); width: 100%; }
.plan-row label { display: inline-flex; align-items: center; gap: 4px; }

/* Regelbouwer */
.rule-list { display: grid; gap: 8px; margin-bottom: 14px; }
.rule-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.rule-row.disabled { opacity: .55; } .rule-row.drop { border-color: var(--brand); box-shadow: 0 -3px 0 var(--brand); }
.rule-row .pos { width: 24px; height: 24px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.rule-main { flex: 1; min-width: 0; }
.handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 2px; letter-spacing: -2px; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); } .switch input:checked + span::before { transform: translateX(14px); }
.editor { display: grid; grid-template-columns: 1fr 220px; gap: 16px; align-items: start; }
.editor-main { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; }
.editor-head { display: flex; gap: 12px; align-items: center; }
.rule-name { flex: 1; font-size: 16px; font-weight: 600; }
.kw { margin: 0; color: var(--brand); letter-spacing: .08em; }
.cgroup { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; background: #fbfcff; }
.cgroup.or { border-left-color: var(--warn); background: #fffcf6; }
.cgroup.negate { border-style: dashed; }
.cgroup-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cgroup-body { padding: 4px 10px 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 4px 12px; font-weight: 700; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; }
.cgroup.or > .cgroup-head .seg button.on { background: var(--warn); }
.cond { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; flex-wrap: wrap; }
.cond .field-input { width: 170px; } .cond input:not([type]), .cond textarea { flex: 1; min-width: 140px; }
.joiner { font-size: 10.5px; font-weight: 800; color: var(--muted); padding-left: 26px; letter-spacing: .08em; }
.dropzone { height: 6px; border-radius: 4px; margin: 2px 0; transition: height .1s; }
.dropzone.over { height: 26px; background: var(--brand-soft); outline: 2px dashed var(--brand); }
.pad { padding: 10px; }
.actions-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.action-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.action-row .field-input { width: 140px; } .action-row > input:not(.field-input) { flex: 1; min-width: 120px; }
.action-row textarea { min-width: 200px; }
.editor-foot { display: flex; gap: 8px; }
.preview-box ins { color: var(--ok); text-decoration: none; background: var(--ok-soft); } .preview-box del { color: var(--bad); }
.palette { position: sticky; top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-wrap: wrap; gap: 5px; max-height: 80vh; overflow: auto; align-content: start; }
.palette > .muted, .palette-search { width: 100%; }
.chip { background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 2px 9px; font-size: 12px; cursor: grab; user-select: none; }
.mapping-wrap { display: grid; grid-template-columns: 1fr 200px; gap: 14px; align-items: start; }
.mapping input { width: 100%; }

.auth-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(circle at 20% 10%, var(--brand-soft), var(--bg) 60%); }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px; width: min(440px, 92vw); box-shadow: 0 20px 50px rgba(20,23,31,.08); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; }
  .grid.two, .grid.three, .stats, .flow, .editor, .mapping-wrap { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}
