/* Montserrat (variabel lettertype, SIL Open Font License 1.1) — lokaal gehost via @fontsource-variable/montserrat */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/montserrat-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Montserrat';
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/montserrat-latin-wght-italic.woff2') format('woff2-variations');
}

:root {
  --navy: #1f2a44;
  --navy-deep: #161e33;
  --red: #d32f2f;
  --blue: #1c5fd4;
  --light: #eef3f7;
  --line: #dde3ec;
  --text: #2a3142;
  --muted: #5c6577;
  --ok: #0b6b4c;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Montserrat', system-ui, sans-serif; color: var(--text); background: var(--light); font-size: 15px; line-height: 1.55; }
a { color: var(--blue); }
h1, h2, h3 { color: var(--navy); margin: 0 0 .5em; line-height: 1.2; }
.icon { width: 1.2em; height: 1.2em; flex-shrink: 0; }

.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-deep); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 900; letter-spacing: .02em; margin: 0 8px 26px; line-height: 1.1; }
.sidebar .brand small { display: block; font-size: .65rem; letter-spacing: .2em; opacity: .7; font-weight: 700; }
.sidebar nav a, .sidebar form button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: rgba(255, 255, 255, .85);
  text-decoration: none; font-weight: 600; font: inherit; background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.sidebar nav a:hover, .sidebar form button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar nav a.active { background: var(--blue); color: #fff; }
.sidebar .bottom { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; }
.sidebar .who { font-size: .8rem; opacity: .7; padding: 0 12px 8px; word-break: break-all; }

.content { padding: 32px 40px 60px; max-width: 1200px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 1.7rem; font-weight: 800; }

.panel { background: #fff; border-radius: 14px; padding: 26px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06); margin-bottom: 24px; }
.panel > h2, aside .panel h2 { font-size: 1.05rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.panel .hint { color: var(--muted); font-size: .88rem; margin-top: -4px; }

.btn {
  display: inline-flex; align-items: center; gap: .45em; padding: .7em 1.2em; border-radius: 8px; border: 0; cursor: pointer;
  font: 700 .85rem/1 'Montserrat', sans-serif; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-light { background: var(--light); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f3c2c1; }
.btn-danger:hover { background: #fdecec; }
.btn-sm { padding: .5em .85em; font-size: .78rem; }
.btn .icon { width: 1.1em; height: 1.1em; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.flash { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; }
.flash.success { background: #e3f6ee; color: var(--ok); }
.flash.error { background: #fdecec; color: #b42318; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06); text-decoration: none; color: inherit; }
.stat strong { display: block; font-size: 2rem; color: var(--navy); font-weight: 900; }
.stat span { color: var(--muted); font-weight: 600; font-size: .9rem; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.quick a { display: flex; gap: 12px; align-items: center; padding: 18px; border-radius: 12px; background: var(--light); color: var(--navy); font-weight: 700; text-decoration: none; }
.quick a:hover { background: #e2eaf3; }
.quick .icon { color: var(--blue); width: 26px; height: 26px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
td.title a { font-weight: 700; color: var(--navy); text-decoration: none; }
td.title a:hover { color: var(--blue); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.badge.on { background: #e3f6ee; color: #0b6b4c; }
.badge.off { background: #f2f4f7; color: var(--muted); }
.badge.cat { background: #e8effc; color: var(--blue); }
.thumb-sm { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--light); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--navy); }
.table-wrap { overflow-x: auto; }

form .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
form .grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.grid .field { margin-bottom: 0; }
label { font-weight: 700; font-size: .88rem; color: var(--navy); }
.field small { color: var(--muted); font-size: .8rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=datetime-local], input[type=tel], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(28, 95, 212, .3); border-color: var(--blue); }
textarea { min-height: 110px; resize: vertical; }
input[type=file] { font: inherit; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; background: #fafbfc; width: 100%; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 18px; height: 18px; }

.form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.form-layout aside .panel { position: sticky; top: 20px; }
.title-input { font-size: 1.4rem !important; font-weight: 800; padding: 14px 16px !important; }

.image-preview { margin-bottom: 10px; border-radius: 10px; overflow: hidden; background: var(--light); }
.image-preview img { width: 100%; display: block; max-height: 240px; object-fit: cover; }
.image-preview.portrait img { aspect-ratio: 4/5; max-height: 320px; object-position: center 20%; }

.editor-wrap { background: #fff; border-radius: 8px; }
.editor-wrap .ql-toolbar { border-radius: 8px 8px 0 0; border-color: var(--line) !important; font-family: inherit; }
.editor-wrap .ql-container { border-radius: 0 0 8px 8px; border-color: var(--line) !important; min-height: 380px; font: 16px/1.7 'Montserrat', sans-serif; }
.editor-wrap .ql-editor { min-height: 380px; }
.editor-wrap .ql-editor img { max-width: 100%; }

.icon-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.icon-picker label { cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker span { display: flex; align-items: center; justify-content: center; height: 48px; border: 2px solid var(--line); border-radius: 10px; color: var(--navy); }
.icon-picker input:checked + span { border-color: var(--blue); background: #e8effc; color: var(--blue); }
.icon-picker .icon { width: 24px; height: 24px; }


/* Inloggen */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #1b2547 0%, #0f1630 100%); }
.login-box { background: #fff; border-radius: 18px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); }
.login-box h1 { font-size: 1.5rem; font-weight: 900; text-transform: uppercase; }
.login-box .btn { width: 100%; justify-content: center; padding: 1em; margin-top: 6px; }
.login-box .note { background: var(--light); padding: 14px; border-radius: 10px; font-size: .85rem; margin-bottom: 18px; }
.login-box code { background: #fff; padding: 2px 6px; border-radius: 4px; font-size: .8rem; }

@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .sidebar .brand { margin: 0 12px 0 4px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar nav a { width: auto; padding: 8px 10px; }
  .sidebar .bottom { margin: 0; border: 0; padding: 0; display: flex; align-items: center; }
  .sidebar .who { display: none; }
  .content { padding: 20px 16px 40px; }
  .form-layout, form .grid { grid-template-columns: 1fr; }
}

/* Homepage-beheer */
.section-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.section-list li { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.section-list li strong { flex: 1; color: var(--navy); }
.section-list li.fixed { background: var(--light); }
.section-list li.moved { animation: flashrow .6s; }
@keyframes flashrow { from { background: #e8effc; } to { background: #fff; } }
.section-list .grip { width: 64px; display: flex; justify-content: center; color: var(--muted); }
.order-btns { display: flex; gap: 4px; }
.order-btns .btn { padding: .45em .7em; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.switch input { width: 18px; height: 18px; }
.section-list li:has(input:not(:checked)) strong { color: var(--muted); text-decoration: line-through; }
.save-bar {
  position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: var(--navy-deep); color: #fff; padding: 14px 20px; border-radius: 12px; margin-top: 10px;
  box-shadow: 0 -6px 24px rgba(16, 24, 40, .15);
}
.save-bar span { font-size: .9rem; opacity: .8; }
.panel[id^="sec-"] { scroll-margin-top: 20px; }
.logo-preview { background: #1f2a44; border-radius: 10px; padding: 18px; display: flex; }
.logo-preview .logo-lockup { display: flex; flex-direction: column; width: 150px; gap: 3px; }
.logo-preview .logo-lockup img { width: 100%; height: auto; }
.logo-preview .logo-sub { width: 100%; height: auto; display: block; overflow: visible; }
.logo-preview .logo-sub text { font: 800 11px 'Montserrat', sans-serif; fill: #fff; }
.logo-preview > img { max-height: 60px; width: auto; }

/* Onderwerpen */
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { flex: 1; min-width: 180px; }
.inline-form select { width: auto; max-width: 180px; padding: 7px 10px; }
.order-btns form { display: inline; }
.btn[disabled] { opacity: .35; cursor: default; }
#new_category { margin-top: 8px; }

/* Voorbeeld in dezelfde verhouding als het automatisch bijgesneden resultaat */
.image-preview.landscape img { aspect-ratio: 16/10; max-height: none; object-fit: cover; }
.image-preview.photo43 img { aspect-ratio: 4/3; max-height: none; object-fit: cover; }
.image-preview.wide img { aspect-ratio: 24/11; max-height: none; object-fit: cover; }

/* Toetsenbordfocus en skiplink */
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; background: #ffbf47; color: #161e33; font-weight: 800; padding: 10px 16px; border-radius: 0 0 8px 8px; text-decoration: none; }
.skip-link:focus { top: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.login-sub { color: var(--muted); margin-top: -6px; }
.login-back { text-align: center; margin: 18px 0 0; }

/* ---------- Installatie ---------- */
.install-box { max-width: 560px; }
.install-box h2 { font-size: 1rem; margin: 26px 0 10px; text-transform: uppercase; letter-spacing: .04em; }
.install-box fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.install-box legend { font-weight: 700; margin-bottom: 6px; }
.install-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .92rem; }
.install-checks .ok strong { color: #0b6b4c; }
.install-checks .fail strong { color: #c62828; }
