/* ============================================================================
   Weekendschool - gedeeld ontwerpsysteem
   ============================================================================ */

:root {
  --bg: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --border: #e4ddc9;
  --text: #23291f;
  --text-muted: #6b6b5f;
  --accent: #1f6f5c;
  --accent-dark: #16503f;
  --accent-soft: #e3efe9;
  --gold: #b9791e;
  --gold-soft: #f5e8d3;
  --good: #1f7a4d;
  --good-soft: #e2f3e6;
  --warn: #b9791e;
  --warn-soft: #f8ecd6;
  --critical: #b2382b;
  --critical-soft: #fbe6e2;
  --neutral: #6b6b5f;
  --neutral-soft: #ece9de;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(35, 41, 31, 0.06), 0 6px 20px -8px rgba(35, 41, 31, 0.14);
  --font-display: 'Bitter', Georgia, 'Times New Roman', serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a15;
    --surface: #21251d;
    --surface-2: #262a20;
    --border: #383d30;
    --text: #eeece2;
    --text-muted: #a4a493;
    --accent: #4fa88d;
    --accent-dark: #7ec4ac;
    --accent-soft: #24352d;
    --gold: #d99b3f;
    --gold-soft: #3a301c;
    --good: #4caf7d;
    --good-soft: #1f3327;
    --warn: #d99b3f;
    --warn-soft: #3a301c;
    --critical: #e0776a;
    --critical-soft: #3a231f;
    --neutral: #a4a493;
    --neutral-soft: #2c2f26;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -8px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0 0 4px; text-wrap: balance; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; color: var(--text-muted); }
a { color: var(--accent-dark); }
::selection { background: var(--accent-soft); }

/* --- layout shell -------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.sidebar-brand .mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
}
.sidebar-brand .name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.sidebar-brand .sub { font-size: 0.72rem; color: var(--text-muted); }

.nav-group-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 14px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 0.9rem; cursor: pointer;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title h1 { font-size: 1.2rem; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold-soft); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem;
  font-family: var(--font-display);
}
.topbar-user { text-align: right; line-height: 1.2; }
.topbar-user .name { font-weight: 600; font-size: 0.86rem; }
.topbar-user .role { font-size: 0.72rem; color: var(--text-muted); }

.menu-toggle { display: none; }

.content { padding: 26px; max-width: 1180px; width: 100%; margin: 0 auto; }
.content-header { margin-bottom: 20px; }

/* --- cards / grid ---------------------------------------------------------*/
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-row h2, .card-row h3 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.6rem; font-weight: 700; color: var(--accent-dark); }
.stat-card .label { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* --- buttons ----------------------------------------------------------- */
.btn {
  font-family: var(--font-body); font-size: 0.86rem; font-weight: 600; border-radius: 8px;
  padding: 9px 15px; border: 1px solid transparent; cursor: pointer; display: inline-flex;
  align-items: center; gap: 6px; transition: filter 0.12s ease, background 0.12s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--critical-soft); color: var(--critical); }
.btn-danger:hover:not(:disabled) { filter: brightness(0.97); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }

/* --- forms --------------------------------------------------------------*/
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.field .hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
input, select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 0.9rem; padding: 9px 11px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
legend { font-weight: 700; font-size: 0.85rem; padding: 0 6px; }

/* --- table ----------------------------------------------------------------*/
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* --- badges ---------------------------------------------------------------*/
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge--good { background: var(--good-soft); color: var(--good); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--critical { background: var(--critical-soft); color: var(--critical); }
.badge--neutral { background: var(--neutral-soft); color: var(--neutral); }

/* --- tabs ------------------------------------------------------------------*/
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; font-size: 0.86rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
}
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- empty state ------------------------------------------------------------*/
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 1.8rem; margin-bottom: 8px; }

/* --- modal ------------------------------------------------------------------*/
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(23, 26, 21, 0.45); display: none;
  align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); padding: 22px; width: 100%;
  max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.modal-close { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* --- toast ------------------------------------------------------------------*/
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 0.85rem; opacity: 0; pointer-events: none; transition: all 0.18s ease; z-index: 80; box-shadow: var(--shadow);
}
.toast--visible { opacity: 1; transform: translate(-50%, 0); }
.toast--critical { background: var(--critical); color: #fff; }
.toast--good { background: var(--good); color: #fff; }

/* --- auth / public pages -----------------------------------------------------*/
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .card { padding: 30px 28px; }
.brand-lockup { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; }
.brand-lockup .mark { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; }
.brand-lockup .name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }

.config-warning { background: var(--critical-soft); color: var(--critical); text-align: center; padding: 8px; font-size: 0.8rem; font-weight: 600; }

.error-text { color: var(--critical); font-size: 0.83rem; margin-top: 10px; }

/* --- public marketing / inschrijven header -----------------------------------*/
.public-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.public-header-inner { max-width: 900px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; }
.public-wrap { max-width: 760px; margin: 0 auto; padding: 40px 24px 70px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 18px 0 26px; }
.course-option {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; cursor: pointer;
  background: var(--surface); transition: border-color 0.12s ease, background 0.12s ease;
}
.course-option:hover { border-color: var(--accent); }
.course-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.course-option .title { font-weight: 700; font-size: 0.88rem; margin-bottom: 3px; }
.course-option .meta { font-size: 0.74rem; color: var(--text-muted); }

.helper-strip { display: flex; gap: 8px; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 18px; }

@media (max-width: 880px) {
  .sidebar { position: fixed; left: -240px; top: 0; z-index: 40; transition: left 0.18s ease; box-shadow: var(--shadow); }
  .sidebar.sidebar--open { left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 18px; }
}
