/* Scouting Event Portal — basisstijl
   Rustig, functioneel, geen externe bronnen. */

:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #f9f8f5;
  --ink: #1b1f1d;
  --ink-2: #3d4440;
  --muted: #6a716d;
  --line: #dedcd4;
  --line-strong: #c8c6bc;
  --accent: #2f5d46;
  --accent-ink: #ffffff;
  --accent-soft: #e6eee8;
  --focus: #2b6cb0;
  --ok: #2f6b4a;
  --ok-soft: #e3efe7;
  --warn: #a2630f;
  --warn-soft: #f8eedb;
  --danger: #a23b32;
  --danger-soft: #f6e4e1;
  --radius: 4px;
  --radius-lg: 6px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --c-green: #2f6b4a; --c-blue: #2b5c8a; --c-red: #a23b32; --c-orange: #b8612a;
  --c-yellow: #a88419; --c-purple: #6a4c8c; --c-brown: #7a5a3c; --c-grey: #5c6360;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151816;
    --surface: #1c201e;
    --surface-2: #202522;
    --ink: #e8ebe8;
    --ink-2: #c9cfcb;
    --muted: #939b96;
    --line: #2e3431;
    --line-strong: #414844;
    --accent: #6fae8b;
    --accent-ink: #0f1a14;
    --accent-soft: #22322a;
    --focus: #7fb0e8;
    --ok: #6fbf8f;
    --ok-soft: #1f3228;
    --warn: #e0a54a;
    --warn-soft: #3a2e1a;
    --danger: #e0786d;
    --danger-soft: #3b2220;
    --c-green: #6fae8b; --c-blue: #7aa7d4; --c-red: #e0786d; --c-orange: #e09a63;
    --c-yellow: #d6b55a; --c-purple: #a98fd0; --c-brown: #c29b73; --c-grey: #9aa29d;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 0.75rem; }
small, .small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- App-shell ------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; text-decoration: none; color: var(--ink); }
.brand-name { font-weight: 700; font-size: 0.98rem; line-height: 1.25; }
.brand-sub { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 12px 8px 4px; }
.nav a {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.93rem;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; font-size: 0.88rem; }
.sidebar-foot .who { font-weight: 600; }
.sidebar-foot .role { color: var(--muted); font-size: 0.8rem; }
.sidebar-foot .links { display: flex; gap: 12px; margin-top: 8px; align-items: center; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.mobile-bar { display: none; }

.main { min-width: 0; padding: 28px 36px 64px; max-width: 1240px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-bar {
    display: block;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .mobile-bar summary {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 700;
  }
  .mobile-bar summary::-webkit-details-marker { display: none; }
  .mobile-bar summary .menu-hint { font-weight: 500; font-size: 0.85rem; color: var(--accent); }
  .mobile-bar .nav { padding: 0 8px 12px; }
  .mobile-bar .sidebar-foot { margin: 0 8px; padding-bottom: 14px; }
  .main { padding: 20px 16px 48px; }
}

/* --- Paginakop ------------------------------------------------------------ */

.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Blokken -------------------------------------------------------------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel + .panel, .panel + .grid, .grid + .panel, .figures + .panel, .figures + .grid, .section { margin-top: 20px; }
.grid > .panel, .grid > aside, .grid > div { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 18px; }
.panel-body > :last-child { margin-bottom: 0; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-side { grid-template-columns: 1fr; } }

.section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; margin: 0 0 10px; }

/* Kengetallen: getallen met label, gescheiden door lijnen */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.figure { padding: 14px 18px; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
.figure-value { font-size: 1.6rem; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; }
.figure-value .of { font-size: 0.95rem; color: var(--muted); font-weight: 500; }
.figure-label { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 600px) {
  .figure { border-left: 0; border-top: 1px solid var(--line); }
  .figure:first-child { border-top: 0; }
}

.progress { height: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }

/* Definitielijst voor detailpagina's */
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 0.9rem; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }

.sensitive { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 12px 14px; border-radius: 0 var(--radius) var(--radius) 0; }
.sensitive-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--warn); font-weight: 700; margin-bottom: 6px; }
.prewrap { white-space: pre-wrap; }

/* --- Tabellen ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line-strong); background: var(--surface-2);
  white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.table .row-link:hover { color: var(--accent); text-decoration: underline; }
.table td.check, .table th.check { width: 36px; padding-right: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* --- Labels --------------------------------------------------------------- */

.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; white-space: nowrap;
  padding: 1px 8px 1px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--c-grey)); }
.tag.plain::before { display: none; }
.dot-green { --dot: var(--c-green); } .dot-blue { --dot: var(--c-blue); } .dot-red { --dot: var(--c-red); }
.dot-orange { --dot: var(--c-orange); } .dot-yellow { --dot: var(--c-yellow); } .dot-purple { --dot: var(--c-purple); }
.dot-brown { --dot: var(--c-brown); } .dot-grey { --dot: var(--c-grey); }

.status { font-size: 0.85rem; white-space: nowrap; }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-danger { color: var(--danger); }
.status-muted { color: var(--muted); }

/* --- Knoppen -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 0.92rem; font-weight: 550; line-height: 1.2;
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-small { padding: 5px 10px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
form.inline { display: inline; }

/* --- Formulieren ---------------------------------------------------------- */

.form { max-width: 640px; }
.form-wide { max-width: none; }
.field { margin-bottom: 16px; }
.field > label, .field-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 5px; }
.field .optional { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.help { color: var(--muted); font-size: 0.84rem; margin-top: 4px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--danger); font-size: 0.86rem; }
.errorlist.nonfield { background: var(--danger-soft); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 16px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="tel"], input[type="file"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px;
}
input[type="file"] { padding: 6px; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: -3px; }

.field-check { display: flex; gap: 10px; align-items: flex-start; }
.field-check label { font-weight: 500; margin: 0; }
.field-check .help { margin-top: 0; }
.checks > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 16px; }
.checks label { font-weight: 400; display: flex; gap: 8px; align-items: center; }

.input-code { font-family: var(--mono); font-size: 1.4rem !important; letter-spacing: 0.3em; text-align: center; max-width: 220px; }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; padding: 0; margin-bottom: 12px; }
fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 8px; }

/* Filterbalk */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filters .f { display: flex; flex-direction: column; gap: 3px; }
.filters .f label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.filters input, .filters select { width: auto; min-width: 150px; padding: 6px 8px; font-size: 0.9rem; }
.filters .f-grow { flex: 1; }
.filters .f-grow input { width: 100%; }

.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 0.9rem; }
.bulkbar .spacer { flex: 1; }

/* --- Meldingen ------------------------------------------------------------ */

.messages { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); border-left-width: 3px; }
.messages .success { border-left-color: var(--ok); }
.messages .info { border-left-color: var(--focus); }
.messages .warning { border-left-color: var(--warn); }
.messages .error { border-left-color: var(--danger); }

.note { font-size: 0.88rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }

/* --- Paginering ----------------------------------------------------------- */

.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }
.pager .actions { gap: 6px; }

/* --- Losse pagina's (inloggen) -------------------------------------------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-brand { margin-bottom: 20px; }
.auth-brand .brand-name { font-size: 1.1rem; }
.auth .panel-body { padding: 24px; }
.auth h1 { font-size: 1.25rem; margin-bottom: 6px; }
.auth .lead { color: var(--muted); margin-bottom: 20px; font-size: 0.93rem; }
.auth-foot { margin-top: 16px; font-size: 0.85rem; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }
.qr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: inline-block; }
.qr img { display: block; width: 100%; height: auto; }

/* --- Evenementenlijst ----------------------------------------------------- */

.event-row { display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.event-row:last-child { border-bottom: 0; }
.event-row:hover { background: var(--surface-2); }
.event-date { text-align: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; background: var(--surface); line-height: 1.1; }
.event-date .d { font-size: 1.35rem; font-weight: 700; display: block; }
.event-date .m { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.event-title { font-weight: 650; }
.event-meta { color: var(--muted); font-size: 0.88rem; }
.event-nums { text-align: right; font-size: 0.88rem; color: var(--muted); white-space: nowrap; }
.event-nums strong { color: var(--ink); font-size: 1rem; }
@media (max-width: 600px) { .event-row { grid-template-columns: 60px 1fr; } .event-nums { grid-column: 2; text-align: left; } }

/* --- Afdrukken (noodlijst) ------------------------------------------------ */

.print-only { display: none; }
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --line: #bbb; --line-strong: #888; --ink: #000; --muted: #444; }
  body { font-size: 10.5pt; }
  .sidebar, .mobile-bar, .no-print, .messages { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .panel { border: 0; }
  .print-only { display: block; }
  .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

.steps { padding-left: 18px; margin: 0 0 12px; }
.qr-setup { max-width: 200px; margin: 4px 0 8px; }
.roles { margin: 0; }
.roles dt { font-weight: 600; font-size: 0.9rem; }
.roles dd { margin: 0 0 10px; }
.auth-box-wide { max-width: 680px; }
.auth h2 { font-size: 1rem; margin: 20px 0 6px; }
.dl-compact { grid-template-columns: 1fr auto; gap: 4px 12px; }
.dl-compact dd { text-align: right; font-variant-numeric: tabular-nums; }

/* Breedtes voor voortgangsbalken (inline styles zijn door de CSP niet toegestaan) */
.w-0{width:0%}.w-1{width:1%}.w-2{width:2%}.w-3{width:3%}.w-4{width:4%}.w-5{width:5%}.w-6{width:6%}.w-7{width:7%}.w-8{width:8%}.w-9{width:9%}.w-10{width:10%}.w-11{width:11%}.w-12{width:12%}.w-13{width:13%}.w-14{width:14%}.w-15{width:15%}.w-16{width:16%}.w-17{width:17%}.w-18{width:18%}.w-19{width:19%}.w-20{width:20%}.w-21{width:21%}.w-22{width:22%}.w-23{width:23%}.w-24{width:24%}.w-25{width:25%}.w-26{width:26%}.w-27{width:27%}.w-28{width:28%}.w-29{width:29%}.w-30{width:30%}.w-31{width:31%}.w-32{width:32%}.w-33{width:33%}.w-34{width:34%}.w-35{width:35%}.w-36{width:36%}.w-37{width:37%}.w-38{width:38%}.w-39{width:39%}.w-40{width:40%}.w-41{width:41%}.w-42{width:42%}.w-43{width:43%}.w-44{width:44%}.w-45{width:45%}.w-46{width:46%}.w-47{width:47%}.w-48{width:48%}.w-49{width:49%}.w-50{width:50%}.w-51{width:51%}.w-52{width:52%}.w-53{width:53%}.w-54{width:54%}.w-55{width:55%}.w-56{width:56%}.w-57{width:57%}.w-58{width:58%}.w-59{width:59%}.w-60{width:60%}.w-61{width:61%}.w-62{width:62%}.w-63{width:63%}.w-64{width:64%}.w-65{width:65%}.w-66{width:66%}.w-67{width:67%}.w-68{width:68%}.w-69{width:69%}.w-70{width:70%}.w-71{width:71%}.w-72{width:72%}.w-73{width:73%}.w-74{width:74%}.w-75{width:75%}.w-76{width:76%}.w-77{width:77%}.w-78{width:78%}.w-79{width:79%}.w-80{width:80%}.w-81{width:81%}.w-82{width:82%}.w-83{width:83%}.w-84{width:84%}.w-85{width:85%}.w-86{width:86%}.w-87{width:87%}.w-88{width:88%}.w-89{width:89%}.w-90{width:90%}.w-91{width:91%}.w-92{width:92%}.w-93{width:93%}.w-94{width:94%}.w-95{width:95%}.w-96{width:96%}.w-97{width:97%}.w-98{width:98%}.w-99{width:99%}.w-100{width:100%}
.plain-list { list-style: none; padding: 0; margin: 0 0 12px; }
.plain-list li { padding: 3px 0; }
.select-cell select { width: auto; min-width: 180px; padding: 6px 8px; }

/* Tweestapsverificatie */
.methods { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.methods .panel + .panel { margin-top: 0; }
.method-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.method-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.method-list { margin-bottom: 16px; }
.verify-option { margin-bottom: 8px; }
.verify-option p { margin-top: 8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.verify-email { margin-top: 14px; text-align: center; font-size: 0.9rem; }
