:root {
  --green: #6a8241;
  --green-dark: #55693a;
  --green-tint: #eef2e6;
  --ink: #1f2420;
  --muted: #6b716a;
  --line: #dfe3da;
  --bg: #f6f7f3;
  --card: #ffffff;
  --red: #b3261e;
  --red-tint: #fbeceb;
  --amber: #8a5a00;
  --amber-tint: #fdf3dc;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--green-dark); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .25rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }
.mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; }

/* top bar */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { color: var(--ink); text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.brand-mark { background: var(--green); color: #fff; font-weight: 700; padding: 2px 8px; border-radius: 3px; font-size: .95rem; }
.nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--ink); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { border-bottom-color: var(--green); }

/* buttons */
.btn {
  display: inline-block; background: var(--green); color: #fff; border: 1px solid var(--green);
  padding: 8px 16px; border-radius: 6px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--green-dark); }
.btn-ghost:hover { background: var(--green-tint); color: var(--green-dark); }
.btn-small { padding: 4px 10px; font-size: .9rem; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn[disabled] { opacity: .6; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--green-dark); text-decoration: underline; cursor: pointer; }
.danger { color: var(--red); }

/* layout */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 4px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 20px; }
.narrow { max-width: 560px; }
.login { max-width: 380px; margin: 48px auto; }
.login input { margin-bottom: 12px; }
.empty { text-align: center; color: var(--muted); padding: 32px; }

/* flash */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; background: var(--green-tint); border: 1px solid #cfdab9; }
.flash-error { background: var(--red-tint); border-color: #f0c4c1; color: var(--red); }
.flash-warning { background: var(--amber-tint); border-color: #f1dca8; color: var(--amber); }

/* table */
.search { display: flex; gap: 8px; flex: 1; max-width: 460px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table td a { color: var(--ink); text-decoration: none; }
.rowlink { cursor: pointer; }
.rowlink:hover { background: #fafbf8; }
.badge { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: #eceee9; color: var(--muted); }
.badge-ok { background: var(--green-tint); color: var(--green-dark); }
.badge-fout { background: var(--red-tint); color: var(--red); }
.badge-verouderd { background: var(--amber-tint); color: var(--amber); }

/* details */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.files li:last-child { border-bottom: 0; }
.files .mono { overflow-wrap: anywhere; }
.file-actions { display: flex; gap: 12px; white-space: nowrap; }

/* page plan, shown as the booklet opens */
.pageplan { display: flex; flex-wrap: wrap; gap: 18px 14px; }
.spread { display: flex; gap: 1px; background: var(--line); padding: 1px; border-radius: 3px; }
.spread-right { margin-left: 92px; }
.pageplan figure { margin: 0; width: 90px; background: #fff; }
.pageplan img { display: block; width: 100%; height: auto; aspect-ratio: 210 / 297; }
.pageplan figcaption { font-size: .72rem; color: var(--muted); padding: 3px 4px; line-height: 1.25; background: var(--bg); }

/* forms */
.form fieldset { border: 1px solid var(--line); }
.form legend { font-weight: 700; padding: 0 6px; font-size: 1.05rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; margin-bottom: 4px; }
.field-check > label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.req { color: var(--green); }
input[type=text], input[type=search], input[type=password], input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #c9cec3; border-radius: 6px; background: #fff; color: var(--ink);
}
input[type=file] { font: inherit; max-width: 100%; }
.help { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.error { display: block; color: var(--red); font-size: .9rem; }
.has-error input, .has-error select { border-color: var(--red); }
#id_kaft_type { display: flex; gap: 24px; flex-wrap: wrap; }
#wrap_kaft_type label { font-weight: 400; }
#wrap_kaft_type > label { font-weight: 600; }
.preview { margin: 0; color: var(--muted); }
.preview .mono { color: var(--ink); overflow-wrap: anywhere; }
.part-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 0 16px; align-items: start; border-bottom: 1px dashed var(--line); margin-bottom: 12px; }
.part-row .del, .part-row [data-remove-part] { margin-top: 32px; }
.formbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }

/* covers */
.kaft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kaft { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); margin: 0; padding: 12px; }
.kaft img { width: 100%; height: auto; border-radius: 3px; margin-bottom: 6px; }
.kaft:hover { border-color: var(--green); }
.kaft.inactief { opacity: .55; }
.kaft-large { width: 100%; height: auto; border-radius: 4px; margin-bottom: 16px; }

@media (max-width: 800px) {
  .grid-2, .row, .row-3, .part-row { grid-template-columns: 1fr; }
  .part-row .del, .part-row [data-remove-part] { margin: 0 0 12px; }
  .spread-right { margin-left: 0; }
  .table th:nth-child(3), .table td:nth-child(3), .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
