:root {
  --ink: #000; --paper: #fff; --line: #e4e2de; --muted: #6d6a64; --soft: #f6f5f3;
  --danger: #9e2a1d; --live: #22663b;
  font-family: Jost, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2 { font-weight: 500; margin: 0; }
h1 { font-size: 28px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
a { color: inherit; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 500; font-size: 14px;
  padding: 8px 14px; min-height: 36px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  border-radius: 3px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #2a2a2a; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .35; cursor: default; }
.link { background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; padding: 4px 0; text-decoration: none; }
.link:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

input, textarea, select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: 3px; padding: 8px 10px; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
textarea { resize: vertical; line-height: 1.45; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: 100%; max-width: 340px; display: grid; gap: 16px; }
.login h1 { font-size: 34px; }
.err { color: var(--danger); margin: 0; min-height: 1.2em; font-size: 14px; }

/* Top */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 10; }
.brandline { font-weight: 600; letter-spacing: .01em; }
.title-in { border-color: transparent; font-size: 18px; font-weight: 500; max-width: 420px; padding: 6px 8px; }
.title-in:hover { border-color: var(--line); }
.status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.status.live { color: var(--live); }
.status.draft { color: var(--muted); }
.save { font-size: 13px; color: var(--muted); min-width: 90px; text-align: right; }
.save.error { color: var(--danger); }

.tabs { display: flex; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { text-decoration: none; padding: 12px 0; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a:hover { color: var(--ink); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 28px 80px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

/* Lijst */
.forms { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.forms a { display: grid; grid-template-columns: 1fr auto 130px 140px; gap: 16px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.forms a:hover { background: var(--soft); }
.forms .ft { font-size: 17px; font-weight: 500; }
.empty { padding: 48px 0; color: var(--muted); max-width: 46ch; }

/* Editor */
.split { display: grid; grid-template-columns: 300px 1fr; gap: 40px; align-items: start; }
.qlist { display: grid; gap: 2px; position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow-y: auto; padding-bottom: 8px; }
.qi { display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; text-align: left; font: inherit; background: none; border: 0; border-left: 2px solid transparent; padding: 8px 10px; cursor: pointer; border-radius: 0 3px 3px 0; }
.qi:hover { background: var(--soft); }
.qi.on { background: var(--soft); border-left-color: var(--ink); }
.qi-n { color: var(--muted); font-variant-numeric: tabular-nums; grid-row: span 2; }
.qi-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi .muted { font-size: 12px; }
.qi.screen-item { grid-template-columns: 1fr; }
.addmenu { margin: 10px 0; position: relative; }
.addmenu summary { list-style: none; width: 100%; justify-content: center; }
.addmenu summary::-webkit-details-marker { display: none; }
.menu { display: grid; margin-top: 6px; border: 1px solid var(--line); border-radius: 3px; padding: 4px; background: var(--paper); }
.menu button { text-align: left; font: inherit; background: none; border: 0; padding: 7px 10px; cursor: pointer; border-radius: 2px; }
.menu button:hover { background: var(--soft); }

.qedit { display: grid; gap: 18px; max-width: 640px; }
.qe-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.fld { display: grid; gap: 6px; }
.fld > span { font-weight: 500; font-size: 14px; }
.fld small { color: var(--muted); font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tog { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.tog input { appearance: none; width: 36px; height: 20px; padding: 0; border-radius: 99px; background: var(--line); border: 0; position: relative; flex: none; cursor: pointer; transition: background .15s; }
.tog input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.tog input:checked { background: var(--ink); }
.tog input:checked::after { transform: translateX(16px); }
.ib { font: inherit; width: 34px; height: 34px; border: 1px solid var(--line); background: var(--paper); border-radius: 3px; cursor: pointer; }
.ib:disabled { opacity: .3; cursor: default; }

/* Ontwerp */
.design { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 48px; align-items: start; }
.panel { display: grid; gap: 18px; }
.panel h2 { margin-top: 10px; }
.logo-box { border: 1px dashed var(--line); border-radius: 3px; min-height: 90px; display: grid; place-items: center; padding: 16px; background: repeating-conic-gradient(#f3f2ef 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.logo-box img { max-height: 80px; max-width: 100%; }
.color { display: grid; grid-template-columns: 44px 100px 1fr; gap: 10px; align-items: center; }
.color input[type=color] { padding: 2px; height: 36px; cursor: pointer; }
.color .hex { font-variant-numeric: tabular-nums; }
.warn { font-size: 13px; color: var(--danger); margin: 0; }

input[type=range] { padding: 0; border: 0; accent-color: var(--ink); }

/* Antwoorden */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 3px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; max-width: 280px; }
th { font-weight: 500; background: var(--soft); white-space: nowrap; position: sticky; top: 0; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
td.when { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0 4px; }
.x:hover { color: var(--danger); }

/* Delen */
.share { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.card { border: 1px solid var(--line); border-radius: 3px; padding: 24px; display: grid; gap: 14px; align-content: start; }
.card p { margin: 0; color: var(--muted); }
.copy { display: flex; gap: 8px; }
.qr { width: 220px; height: 220px; image-rendering: pixelated; border: 1px solid var(--line); }
.notice { border-left: 3px solid var(--ink); background: var(--soft); padding: 12px 16px; margin-bottom: 24px; }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: flex; align-items: center; padding: 0 10px; background: var(--soft); border: 1px solid var(--line); border-right: 0; border-radius: 3px 0 0 3px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.prefix input { border-radius: 0 3px 3px 0; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 12px; }

#toast { display: flex; align-items: center; gap: 14px; position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 3px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.on { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1180px) {
  .editor3 { grid-template-columns: 260px 1fr; }
  .editor3 .pvcol { display: none; }
}
@media (max-width: 860px) {
  .split, .design, .share, .editor3 { grid-template-columns: 1fr; }
  .qlist, .pvcol { position: static; max-height: none; }
  .design .pvcol { display: none; }
  .sum { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .forms a { grid-template-columns: 1fr auto; }
  .forms a .muted { display: none; }
  .top { padding: 12px 16px; flex-wrap: wrap; }
  .wrap { padding: 24px 16px 64px; }
  .tabs { padding: 0 16px; }
}

.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; flex-wrap: nowrap; }
code { font-size: 13px; background: var(--soft); padding: 1px 5px; border-radius: 3px; }
.wrap.wide { max-width: 1520px; }
.editor3 { display: grid; grid-template-columns: 270px minmax(0, 1fr) 390px; gap: 36px; align-items: start; }
.editor3 .qedit { max-width: 620px; }
.pvcol { position: sticky; top: 130px; display: grid; gap: 8px; justify-items: center; }
.phone { width: 100%; max-width: 390px; height: min(760px, calc(100vh - 190px)); min-height: 520px; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: #fff; box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(0,0,0,.35); }
.design .phone { max-width: 100%; border-radius: 6px; }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }
.pvnote { margin: 0; font-size: 12px; }
.qi.over { box-shadow: inset 0 2px 0 var(--ink); }
.qi.dragging { opacity: .4; }
.qi[draggable=true] { cursor: grab; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: -8px; font-size: 13px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--soft); border-radius: 99px; padding: 2px 10px; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.logic { border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px; display: grid; gap: 12px; }
.logic-row { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 8px; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preset { position: relative; height: 82px; border: 1px solid var(--line); cursor: pointer; text-align: left; padding: 10px; font: inherit; display: flex; flex-direction: column; justify-content: space-between; }
.preset span { font-size: 24px; line-height: 1; }
.preset i { position: absolute; right: 10px; top: 12px; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(127,127,127,.4); }
.preset small { font-size: 11px; opacity: .8; }
.preset:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 3px; margin-bottom: 24px; }
.stats div { padding: 16px 18px; display: grid; gap: 2px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { font-size: 30px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 13px; }
.sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.sum-card { border: 1px solid var(--line); border-radius: 3px; padding: 16px 18px; display: grid; gap: 8px; align-content: start; }
.sum-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 500; }
.sum-card p { margin: 4px 0 0; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 90px 28px; gap: 10px; align-items: center; font-size: 14px; }
.bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bt i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.bn { text-align: right; font-variant-numeric: tabular-nums; }
.cnt { font-size: 12px; color: var(--muted); }
#toast.act { pointer-events: auto; }
#toast button { font: inherit; color: inherit; background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0; }
@media (max-width: 860px) { .presets { grid-template-columns: 1fr 1fr; } .logic-row { grid-template-columns: 1fr; } .stats div:nth-child(3) { border-left: 0; } .stats div:nth-child(n+3) { border-top: 1px solid var(--line); } }
@media (max-width: 1180px) {
  .editor3 { grid-template-columns: 260px minmax(0, 1fr); }
  .editor3 .pvcol { display: none; }
}
@media (max-width: 860px) {
  .editor3, .design { grid-template-columns: 1fr; }
  .pvcol { position: static; }
  .design .pvcol { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .sum { grid-template-columns: 1fr; }
}
td { min-width: 110px; }
td.when { min-width: 0; }
@media (max-width: 860px) {
  .top .grow { flex-wrap: wrap; flex-basis: 100%; }
  .top .title-in { order: 3; flex-basis: 100%; max-width: none; padding-left: 0; }
  .top .save { min-width: 0; text-align: left; }
  .top > .row:last-child { flex-basis: 100%; }
}
.warn-notice { border-left-color: var(--danger); }
.conflict { font-size: 13px; color: var(--danger); display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.conflict .link { color: var(--ink); text-decoration: underline; font-size: 13px; }
.beheer { display: grid; gap: 24px; max-width: 900px; }
.users td { border-bottom: 1px solid var(--line); }
.adduser { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; }
@media (max-width: 860px) { .adduser { grid-template-columns: 1fr; } }
