:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --line: #e3e6ec;
  --accent: #2f6f4f;
  --accent-ink: #ffffff;
  --danger: #b23b3b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

.topbar {
  background: var(--accent);
  padding: 14px 20px;
}
.brand {
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
  letter-spacing: 0.2px;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

h1 { font-size: 1.6rem; margin: 0.2em 0 0.6em; }
h2 { font-size: 1.2rem; }

a { color: var(--accent); }

.back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.back:hover { color: var(--ink); }

.empty { color: var(--muted); }

/* Kistenlijst */
ul.kisten { list-style: none; padding: 0; margin: 0 0 26px; }
ul.kisten li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
}
.kist-link { font-weight: 600; text-decoration: none; font-size: 1.05rem; }
.kist-actions { display: flex; gap: 14px; font-size: 0.9rem; white-space: nowrap; }
.kist-actions a { color: var(--muted); text-decoration: none; }
.kist-actions a:hover { color: var(--accent); }

.new-kist { margin: 6px 0 0; }
.new-kist a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.new-kist a:hover { color: var(--accent); }

/* Kaarten & formulieren */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.95rem; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }

input[type=text], textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92rem; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 600; font-size: 0.95rem; }
.editor-mount { width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

button, .btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  text-align: center;
}
.btn.ghost, button.ghost {
  background: #fff;
  color: var(--accent);
}
.btn.danger, button.danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
.pagebar { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; align-items: center; }
.pagebar.subtle { justify-content: flex-end; margin-top: 10px; }
form.danger { margin-top: 26px; }

/* Onopvallende, transparante bewerk-knop (potlood) */
.edit-pencil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  color: var(--muted);
  background: transparent;
  border: none;
  opacity: 0.45;
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.edit-pencil:hover, .edit-pencil:focus-visible {
  opacity: 1;
  color: var(--accent);
  outline: none;
}

/* Content (gerenderde markdown) */
.content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.content h1:first-child { margin-top: 0; }
.content ul { padding-left: 1.3em; }
.content input[type=checkbox] { margin-right: 6px; transform: scale(1.15); }
.content img { max-width: 100%; height: auto; border-radius: 8px; }
.content table { border-collapse: collapse; width: 100%; }
.content th, .content td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.content code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.content pre { background: #eef0f3; padding: 12px; border-radius: 8px; overflow-x: auto; }

/* QR-pagina */
.qrpage { text-align: center; }
.qr {
  width: 320px; height: 320px; max-width: 90vw;
  background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
}
.qr-url { color: var(--muted); word-break: break-all; }
.qrpage .pagebar { justify-content: center; }

@media print {
  .topbar, .back, .no-print { display: none !important; }
  body { background: #fff; }
  .qr { border: none; }
}
