/* Hoppa — Bordio-geïnspireerde theme, mobile-first */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root, [data-theme="light"] {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --border: #e5e8ef;
  --border-strong: #cdd2dc;
  --muted: #6b7280;
  --text: #1d2433;
  --text-soft: #4b5263;
  --accent: #5b6cff;
  --accent-soft: #eef0ff;
  --accent-dark: #4453cc;
  --weekend: #eef0f5;
  --today-accent: #ff9f43;
  --today-soft: #fff4e6;
  --done-tint: 0.42;
  --shadow-sm: 0 1px 2px rgba(20,28,55,.06);
  --shadow-md: 0 2px 8px rgba(20,28,55,.07), 0 1px 2px rgba(20,28,55,.04);
  --shadow-lg: 0 8px 24px rgba(20,28,55,.10);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --bg: #0f1116;
  --panel: #181b22;
  --panel-2: #20242d;
  --border: #2a2f3a;
  --border-strong: #3a4050;
  --muted: #8c93a3;
  --text: #e6e8ee;
  --text-soft: #b0b6c4;
  --accent: #6b7bff;
  --accent-soft: #2a2f4a;
  --accent-dark: #8590ff;
  --weekend: #14171e;
  --today-accent: #f59e0b;
  --today-soft: #2a2010;
  --done-tint: 0.4;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

/* Theme-toggle: toon juiste icoon */
.theme-toggle { padding: 4px 8px !important; font-size: 16px; }
.theme-light, .theme-dark { display: none; }
[data-theme="light"] .theme-light { display: inline; }
[data-theme="dark"] .theme-dark { display: inline; }

/* Timer overlay (fixed bottom-right) */
.timer-overlay {
  position: fixed; bottom: 16px; right: 16px; z-index: 200;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--vak-kleur);
  border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow-lg);
  min-width: 220px; display: flex; flex-direction: column; gap: 6px;
}
.timer-overlay.over {
  background: #fef3c7; border-color: #f59e0b;
  animation: timer-pulse 1.6s infinite;
}
[data-theme="dark"] .timer-overlay.over {
  background: #422006; border-color: #f59e0b;
}
@keyframes timer-pulse {
  0%, 100% { box-shadow: var(--shadow-lg); }
  50% { box-shadow: 0 0 0 6px rgba(245,158,11,.35), var(--shadow-lg); }
}
.timer-titel { font-size: 12px; color: var(--muted); }
.timer-clock {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 28px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.timer-overlay.over .timer-clock { color: #b45309; }
.timer-actions { display: flex; gap: 6px; }
.timer-actions button { flex: 1; padding: 6px 10px; font-size: 13px; }
.timer-btn {
  width: 100%; padding: 10px !important; font-size: 14px;
  margin-top: 8px;
}

/* Temperatuur-meter op Vandaag */
.temp-meter {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.temp-header {
  display: flex; gap: 12px; align-items: baseline;
  flex-wrap: wrap; margin-bottom: 10px;
}
.temp-header strong { font-size: 14px; }
.temp-header .muted { font-size: 11px; }
.temp-bars {
  display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px;
  align-items: end; height: 70px; color: inherit; text-decoration: none;
}
.temp-bar {
  position: relative; height: 100%;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end;
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--panel-2);
}
.temp-bar-fill {
  height: var(--load, 0%);
  min-height: 4px;
  border-radius: 2px 2px 0 0;
}
.t-green .temp-bar-fill { background: linear-gradient(180deg, #34d399, #10b981); }
.t-orange .temp-bar-fill { background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.t-red .temp-bar-fill { background: linear-gradient(180deg, #f87171, #dc2626); }
.t-red { animation: temp-red-pulse 2s infinite; }
@keyframes temp-red-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
  50% { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25); }
}
.t-today { border-color: var(--today-accent); border-width: 2px; }
.temp-bar-day {
  position: absolute; bottom: 2px; left: 0; right: 0;
  text-align: center; font-size: 9px; color: var(--text-soft);
  text-shadow: 0 0 2px var(--panel);
  pointer-events: none;
}

@media (max-width: 600px) {
  .temp-bars { grid-template-columns: repeat(7, 1fr); height: 56px; }
  .temp-meter .temp-bars { gap: 3px; }
}

/* Quote-bar onder topbar */
.quote-bar {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: #78350f;
  padding: 8px 22px; font-size: 13px;
  border-bottom: 1px solid #fbbf24;
  display: flex; align-items: center; gap: 8px;
}
.quote-bar em { font-style: italic; }
[data-theme="dark"] .quote-bar {
  background: linear-gradient(90deg, #422006, #78350f);
  color: #fde68a; border-color: #b45309;
}
@media print { .quote-bar { display: none; } }

/* Streak badge */
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #fed7aa, #fbbf24);
  color: #7c2d12; font-weight: 700; font-size: 13px;
  border: 1px solid #f59e0b;
}
[data-theme="dark"] .streak-badge {
  background: linear-gradient(135deg, #7c2d12, #b45309);
  color: #fef3c7; border-color: #f59e0b;
}
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  transition: background .12s, border-color .12s, transform .06s;
}
button:hover { background: var(--panel-2); border-color: var(--border-strong); }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent); border-color: var(--accent); color: white;
}
button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.danger { color: #e54848; }
button.danger:hover { background: #fef2f2; border-color: #fecaca; }
button.linkbtn {
  background: none; border: none; padding: 2px 6px; color: var(--muted);
}
button.linkbtn:hover { color: var(--text); background: var(--panel-2); }
input, select, textarea {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="color"] { padding: 2px; height: 36px; }
label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0;
        font-size: 13px; color: var(--text-soft); }

.muted { color: var(--muted); font-size: 12px; }
.error { background: #fef2f2; color: #b91c1c; padding: 10px 14px;
         border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid #fecaca; }
[x-cloak] { display: none !important; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px;
          font-weight: 700; }
.brand .logo { font-size: 22px; }
.topbar nav { display: flex; gap: 6px; flex: 1; }
.navlink { color: var(--muted); padding: 6px 12px; border-radius: var(--radius-sm);
           font-weight: 500; }
.navlink:hover { color: var(--text); background: var(--panel-2); }
.topbar .user { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.periode-picker select {
  width: auto; padding: 6px 10px; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-dark);
  border-color: var(--accent-soft); font-weight: 600;
}

/* Adviseur knop + modal */
.adviseur-trigger {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e !important; border: 1px solid #fbbf24;
  padding: 6px 12px !important; border-radius: var(--radius-sm);
  font-weight: 600 !important; cursor: pointer;
}
.adviseur-trigger:hover { filter: brightness(1.05); }
.adviseur-trigger:disabled { opacity: .6; cursor: wait; }
.adviseur-modal { min-width: 420px; max-width: 640px; }
.capture-modal { min-width: 420px; max-width: 640px; }
.capture-preview {
  max-height: 50vh; overflow-y: auto;
  background: var(--panel-2); padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin: 8px 0;
}
.capture-h { margin-bottom: 8px; }
.capture-h ul { margin: 4px 0 8px 24px; padding: 0; font-size: 13px; }
.capture-h li { padding: 2px 0; }
.adviseur-text {
  font-size: 14px; line-height: 1.55;
  max-height: 60vh; overflow-y: auto;
  padding: 4px 0;
}
.adviseur-text h1, .adviseur-text h2, .adviseur-text h3 {
  font-size: 15px; margin: 14px 0 6px;
}
.adviseur-text ul, .adviseur-text ol { padding-left: 20px; margin: 8px 0; }
.adviseur-text li { margin-bottom: 4px; }
.adviseur-text strong { color: var(--accent-dark); }
.adviseur-text code {
  background: var(--panel-2); padding: 1px 6px; border-radius: 4px;
  font-size: 12px;
}

/* Settings dropdown menu */
.settings-menu { position: relative; }
.settings-menu .gear {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px 8px; border-radius: var(--radius-sm);
}
.settings-menu .gear:hover { background: var(--panel-2); }
.settings-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
  box-shadow: var(--shadow-lg); z-index: 50; min-width: 220px;
  display: flex; flex-direction: column; gap: 2px;
}
.settings-dropdown button, .settings-dropdown a {
  background: none; border: none; text-align: left;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font: inherit; color: var(--text); cursor: pointer;
  display: block; text-decoration: none;
}
.settings-dropdown button:hover, .settings-dropdown a:hover {
  background: var(--panel-2);
}

/* Print styles — verberg UI-chrome, planner is content */
@page { size: A4 landscape; margin: 8mm; }

@media print {
  html, body {
    background: white !important; color: black !important;
    width: 100% !important; margin: 0 !important; padding: 0 !important;
    font-size: 9px;
  }
  .topbar, .planner-header, .backlog, .modal, .settings-menu,
  .navbtn, .plan-btn, .vak-filter, .week-nav,
  .pw-banner, .vandaag-section .big-tile-actions,
  .voortgang-section, .voortgang-strip, .add-inline, .vak-actions {
    display: none !important;
  }
  main { padding: 0 !important; width: 100% !important; }
  .planner {
    display: block !important; height: auto !important;
    width: 100% !important;
  }
  .planner-grid {
    display: block !important; width: 100% !important;
    grid-template-columns: none !important; gap: 0 !important;
  }
  .days-scroll {
    display: grid !important;
    /* minmax(0, 1fr) is essentieel: zonder de "0" gebruiken kolommen
       hun min-content (= titel-breedte) en dan past 7 nooit. */
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    grid-auto-rows: min-content;
    gap: 2mm !important;
    width: 100% !important;
    overflow: visible !important;
  }
  /* 1 week per pagina — page-break na elke 7e dag-kolom */
  .daycol {
    display: flex !important; flex-direction: column !important;
    flex: none !important;
    width: auto !important; min-width: 0 !important; max-width: none !important;
    overflow: visible !important;
    background: white !important;
    border: 1px solid #999 !important;
    border-radius: 2mm !important;
    box-shadow: none !important; color: black !important;
    min-height: 0 !important;
    break-inside: avoid; page-break-inside: avoid;
  }
  .daycol:nth-of-type(7n):not(:last-of-type) {
    break-after: page;
    page-break-after: always;
  }
  .daycol > header {
    background: #eee !important; padding: 1.5mm 2mm;
    gap: 2mm; border-bottom: 1px solid #999 !important;
    display: flex !important; flex-wrap: wrap; align-items: baseline;
  }
  .daycol .dayname { font-size: 10pt; text-transform: capitalize; }
  .daycol .daydate { font-size: 8pt; color: #555 !important; }
  .daycol .daytotal {
    background: #eaeaea !important; color: #333 !important;
    margin-left: auto; padding: 0 2mm; border-radius: 999px; font-size: 7pt;
  }
  .daycol.today, .daycol.weekend { background: white !important; }
  .dagdeel {
    padding: 1.5mm 2mm; border-top: 1px dashed #ccc !important;
    display: flex !important; flex-direction: column; gap: 1mm;
  }
  .dagdeel-label {
    font-size: 6pt; text-transform: uppercase; color: #888 !important;
    letter-spacing: 0.5px;
  }
  .tile {
    background: white !important; border: 1px solid #ccc !important;
    border-left: 3px solid var(--vak-kleur, #888) !important;
    box-shadow: none !important;
    color: black !important;
    padding: 1.5mm; margin: 1mm 0; border-radius: 1.5mm !important;
    page-break-inside: avoid;
    word-wrap: break-word; overflow-wrap: break-word;
    overflow: visible !important;
  }
  .tile-vak { font-size: 6pt; color: #666 !important; }
  .tile-title { font-size: 8pt; font-weight: 600; margin: 0.5mm 0; }
  .tile-sub { font-size: 7pt; color: #555 !important;
              -webkit-line-clamp: 3; }
  .tile-meta { font-size: 6pt; color: #888 !important; }
  .tile.has-notes::after, .tile.has-quiz::before { display: none; }
  .pw-flag {
    background: #ddd !important; color: black !important;
    margin: 1mm; padding: 1mm 2mm; border-radius: 1mm;
    font-size: 7pt;
  }
  a { color: inherit; text-decoration: none; }
}

main { padding: 18px 22px; }

/* Login */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef0ff 0%, #f5f6fa 60%);
}
.login-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px; min-width: 320px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { margin: 0; font-size: 30px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.login-card button { padding: 11px; font-size: 15px; }

/* Page header */
.page-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
}
.page-header h2 { margin: 0; font-size: 22px; font-weight: 700; }
.page-header .back { color: var(--muted); }

/* Vakken overview */
.vak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.vak-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .1s;
}
.vak-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--vak-kleur);
}
.vak-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.vak-card-body {
  display: block; text-align: center; color: inherit; padding-top: 8px;
}
.vak-card .vak-icon { font-size: 34px; }
.vak-card .vak-naam { font-weight: 600; margin-top: 6px; font-size: 15px; }
.vak-card .vak-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.vak-actions {
  position: absolute; top: 8px; right: 6px;
  display: flex; gap: 2px; opacity: 0; transition: opacity .15s;
}
.vak-card:hover .vak-actions { opacity: 1; }
.vak-actions button { padding: 4px 8px; font-size: 14px; line-height: 1; }

/* Vak detail / stof builder */
.vak-detail { max-width: 900px; margin: 0 auto; }
.vak-detail .vak-icon { font-size: 26px; }
.stof-section, .proefwerken-section {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.stof-section h3, .proefwerken-section h3 { margin-top: 0; font-size: 17px; }

.hoofdstuk-list, .paragraaf-list, .unit-list {
  list-style: none; padding: 0; margin: 0;
}
.hoofdstuk { margin-bottom: 16px; padding: 14px; background: var(--panel-2);
              border-radius: var(--radius); border: 1px solid var(--border); }
.hoofdstuk > header { display: flex; justify-content: space-between;
                       align-items: center; }
.paragraaf-list { margin-left: 8px; margin-top: 10px; }
.paragraaf {
  background: var(--panel); padding: 12px; border-radius: var(--radius-sm);
  margin-bottom: 8px; border-left: 3px solid var(--vak-kleur);
  border: 1px solid var(--border); border-left-width: 3px;
}
.paragraaf > header { display: flex; justify-content: space-between; }
.unit-list { margin-left: 8px; margin-top: 8px; }
.unit {
  display: flex; gap: 8px; align-items: center; padding: 6px 0;
  border-bottom: 1px dashed var(--border); flex-wrap: wrap;
}
.unit-title { flex: 1 1 50%; min-width: 0; }
.unit-type {
  background: var(--vak-kleur); color: #fff;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  opacity: 0.85; flex-shrink: 0;
}
.unit-min-input {
  width: 4.5em; padding: 4px 6px; text-align: right; font-size: 13px;
  flex-shrink: 0;
}
.plan-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.4;
  background: var(--accent-soft); color: var(--accent-dark); font-weight: 600;
  text-decoration: none; flex-shrink: 0; white-space: nowrap;
}
.plan-tag.done {
  background: #d1fae5; color: #047857;
}
.plan-tag.backlog {
  background: #fef3c7; color: #92400e;
}
.plan-tag.none {
  background: none; color: var(--muted); font-weight: 400;
}
.plan-tag:hover:not(.none):not(.backlog) { filter: brightness(1.05); }

.add-inline {
  display: flex; gap: 6px; padding: 8px 0; flex-wrap: wrap;
}
.add-inline input, .add-inline select { flex: 0 1 auto; width: auto; }

/* Planner */
.planner { display: flex; flex-direction: column;
            height: calc(100vh - 64px); }
.planner-header {
  display: flex; gap: 16px; align-items: center;
  padding: 4px 0 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.vak-filter { display: flex; gap: 8px; align-items: center; }
.vak-filter label { font-size: 13px; color: var(--muted); margin: 0; }
.vak-filter select { width: auto; }
.week-nav { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.navbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 18px;
}
.navbtn-today {
  background: var(--accent-soft); color: var(--accent-dark);
  border-color: var(--accent-soft); font-size: 14px;
}
.navbtn-today:hover { background: var(--accent); color: white; }
.navlabel { color: var(--text-soft); font-size: 13px; font-weight: 500; min-width: 140px; text-align: center; }

.planner-grid {
  flex: 1; display: grid; grid-template-columns: 300px 1fr;
  gap: 14px; min-height: 0;
}

.backlog {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column;
  min-height: 0; box-shadow: var(--shadow-sm);
}
.backlog h3 { margin: 0 0 12px 0; display: flex; justify-content: space-between;
               align-items: center; font-size: 15px; gap: 8px; }
.backlog-toggle-all { display: inline-flex; gap: 2px; }
.backlog-toggle-all button { padding: 0 6px; font-size: 14px; line-height: 1; }
.backlog .count {
  background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700;
}
.backlog .tile-list { min-height: 30px; padding: 4px; }
.backlog-groups {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1; overflow-y: auto; min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.backlog-group {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--panel-2);
}
.backlog-group-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--panel); border: none; padding: 8px 10px;
  cursor: pointer; text-align: left;
  border-bottom: 1px solid var(--border);
  border-radius: 0; font-weight: 500;
}
.backlog-group-head:hover { background: var(--accent-soft); }
.bg-arrow { width: 12px; color: var(--muted); font-size: 11px; }
.bg-icon { font-size: 16px; }
.bg-naam { flex: 1; font-weight: 600; font-size: 13px; }
.bg-count {
  background: var(--vak-kleur); color: white;
  font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; min-width: 26px; text-align: center;
}

.days-scroll {
  display: flex; gap: 10px; overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.daycol {
  flex: 0 0 200px; scroll-snap-align: start;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.daycol.weekend { background: var(--weekend); }
.daycol.today {
  background: var(--today-soft);
  border-color: var(--today-accent);
  box-shadow: 0 0 0 2px rgba(255,159,67,.18), var(--shadow-sm);
}
.daycol > header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
}
.daycol .dayname { font-weight: 700; text-transform: capitalize;
                    font-size: 13px; letter-spacing: 0; }
.daycol .daydate { color: var(--muted); font-size: 12px; }
.daycol .daytotal {
  margin-left: auto;
  font-size: 12px; color: var(--accent-dark); font-weight: 700;
  background: var(--accent-soft); padding: 3px 10px; border-radius: 999px;
  min-width: 38px; text-align: center;
}
.daycol .daytotal:empty::before {
  content: "0m"; opacity: 0.5;
}
.daycol .pw-flag {
  margin: 6px 10px; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--vak-kleur); color: white; font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.dagdeel {
  border-top: 1px dashed var(--border); padding: 6px 8px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 70px;
}
.dagdeel:first-of-type { border-top: none; }
.dagdeel-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted); font-weight: 600;
  padding: 2px 0;
}
.dagdeel .tile-list { min-height: 36px; }

/* Tiles */
.tile {
  background: color-mix(in srgb, var(--vak-kleur) 12%, var(--panel));
  border-left: 3px solid var(--vak-kleur);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 4px 0;
  cursor: grab;
  user-select: none;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .12s, transform .08s;
  touch-action: none;
}
.tile:hover {
  background: color-mix(in srgb, var(--vak-kleur) 22%, var(--panel));
  box-shadow: var(--shadow-md);
}
.tile.done {
  opacity: var(--done-tint); text-decoration: line-through;
  background: var(--panel-2); border-left-color: var(--border-strong);
}
.tile-vak {
  font-size: 11px; color: var(--text-soft); font-weight: 600;
  display: flex; gap: 4px; align-items: center;
}
.tile-title { font-weight: 600; margin: 3px 0; font-size: 13.5px; }
.tile-sub {
  font-size: 12px; color: var(--text-soft); line-height: 1.3;
  margin: 2px 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-sub:empty { display: none; }
.tile { position: relative; }
.tile.has-notes::after {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251,191,36,.25);
}
.tile.has-quiz::before {
  content: "?"; position: absolute; top: 4px; right: 22px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #3b82f6; color: white;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px rgba(59,130,246,.25);
}
.tile.has-quiz.has-notes::before { right: 22px; }
.notes-dot, .quiz-dot { font-size: 12px; }
.tile-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}

/* SortableJS visual feedback */
.sortable-ghost { opacity: 0.35; }
.sortable-drag { cursor: grabbing; opacity: 0.95; box-shadow: var(--shadow-lg); }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(20, 28, 55, 0.35);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px; min-width: 320px; max-width: 480px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-card h3 { margin: 0 0 8px 0; font-size: 18px; }
.form-row { display: flex; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.form-row label { flex: 1 1 100px; }
.status-row { display: flex; gap: 6px; margin: 12px 0; }
.status-row button { flex: 1; padding: 9px; }
.status-row button.active { background: var(--accent); border-color: var(--accent); color: white; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.modal-actions button { flex: 1; }
.modal-actions button.danger { flex: 0 0 auto; }

/* ----- Vandaag page ----- */
.vandaag-page { max-width: 1180px; margin: 0 auto; }
.vandaag-2col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
  align-items: start;
}
.vandaag-main { min-width: 0; }
.vandaag-side { position: sticky; top: 76px; }
.vandaag-side .voortgang-section { margin: 0; }
@media (max-width: 900px) {
  .vandaag-2col { grid-template-columns: 1fr; }
  .vandaag-side { position: static; }
}
.vandaag-section { margin: 22px 0 28px; }
.vandaag-section h3 { font-size: 18px; margin: 0 0 12px; }
.vandaag-section.overdue h3 { color: #c2410c; }

.pw-banner {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.pw-chip {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 8px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--vak-kleur) 15%, var(--panel));
  border-left: 3px solid var(--vak-kleur);
  font-size: 13px; box-shadow: var(--shadow-sm);
}

.big-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
              gap: 12px; }
.big-tiles.compact { grid-template-columns: 1fr; }
.big-tile {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--vak-kleur);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
}
.big-tile.done { opacity: var(--done-tint); text-decoration: line-through; }
.big-tile.compact { flex-direction: row; align-items: center; gap: 12px;
                     padding: 8px 14px; }
.big-tile.compact .big-tile-title { flex: 1; }
.big-tile-head { display: flex; justify-content: space-between; align-items: baseline; }
.big-tile-vak { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.big-tile-title { font-size: 16px; font-weight: 600; }
.big-tile-sub { font-size: 12px; margin: 2px 0 6px; }
.big-tile-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.big-tile-actions button { padding: 8px 14px; font-size: 13px; }

/* ----- Periodes page + bulk-paragraaf textarea ----- */
.periodes-tbl {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.periodes-tbl th, .periodes-tbl td { padding: 10px 14px; text-align: left;
                                       border-bottom: 1px solid var(--border); }
.periodes-tbl th { background: var(--panel-2); font-size: 12px;
                    text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.periodes-tbl tr:last-child td { border-bottom: none; }

.bulk-wrap {
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: 12px; margin: 8px 0;
}
.bulk-help { font-size: 12px; color: var(--text-soft); margin-bottom: 8px; }
.bulk-help code {
  background: var(--panel); padding: 1px 6px; border-radius: 4px;
  font-size: 11px; border: 1px solid var(--border);
}
.bulk-wrap textarea {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px; line-height: 1.4;
}

/* Voortgang-section op Vandaag */
.voortgang-section { margin: 0 0 22px; }
.voortgang-section h3 { font-size: 16px; margin: 0 0 10px; }
.voortgang-list {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 2px;
}
.voortgang-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px; align-items: center;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: inherit; text-decoration: none;
}
.voortgang-row .vg-bar { grid-column: 1 / -1; height: 6px; margin-top: -2px; }
.voortgang-row .vg-stats { grid-column: 1 / -1; font-size: 11px; }
.voortgang-row:hover { background: var(--panel-2); }
.vg-icon { font-size: 18px; }
.vg-naam { font-weight: 600; font-size: 14px; }
.vg-bar {
  height: 8px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.vg-fill {
  height: 100%; background: var(--vak-kleur); transition: width .3s;
}
.vg-stats {
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  min-width: 80px; text-align: right;
}
@media (max-width: 600px) {
  .voortgang-row { grid-template-columns: 24px 1fr auto; gap: 8px; }
  .vg-bar { grid-column: 1 / -1; height: 6px; }
}

/* Voortgang-strip op Planner (compact) */
.voortgang-strip {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.vg-mini {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px 4px 8px;
  box-shadow: var(--shadow-sm); color: inherit; text-decoration: none;
  border-left: 3px solid var(--vak-kleur);
}
.vg-mini:hover { background: var(--panel-2); }
.vg-mini-icon { font-size: 14px; }
.vg-mini-bar {
  width: 60px; height: 6px; background: var(--border);
  border-radius: 999px; overflow: hidden;
}
.vg-mini-pct {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  min-width: 30px; text-align: right;
}

/* Slim plannen knop + modal */
.plan-btn { padding: 7px 14px; font-size: 13px; }
.dagdeel-row {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  margin: 8px 0; font-size: 13px;
}
.dagdeel-row strong { min-width: 180px; }
.dagdeel-row label {
  display: inline-flex; align-items: center; gap: 4px; margin: 0;
}
.dagdeel-row input[type=checkbox] { width: auto; }
.plan-result {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; margin: 12px 0;
  max-height: 240px; overflow-y: auto;
}
.plan-preview { list-style: none; padding: 0; margin: 6px 0 0;
                  font-size: 12px; }
.plan-preview li {
  padding: 3px 0; border-bottom: 1px dashed var(--border);
  display: flex; gap: 6px; flex-wrap: wrap;
}
.plan-preview li:last-child { border-bottom: none; }

.pw-list { list-style: none; padding: 0; margin: 0 0 12px; }
.pw-list li { padding: 8px 0; border-bottom: 1px dashed var(--border);
               display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.pw-list li:last-child { border-bottom: none; }
.pw-list .pw-actions { margin-left: auto; display: inline-flex; gap: 2px; }
.pw-omschr { width: 100%; font-style: italic; margin-top: 2px; }

/* ----- Icoon-picker in vak-modal ----- */
.icon-modal { min-width: 380px; max-width: 560px; }
.icon-picker { margin: 12px 0; }
.icon-picker-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--text-soft); margin-bottom: 8px;
}
.icon-group { margin-bottom: 12px; }
.icon-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 6px 0 4px; font-weight: 600;
}
.icon-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
}
.icon-btn {
  padding: 8px 4px; display: flex; flex-direction: column;
  align-items: center; gap: 2px; min-height: 56px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.icon-btn.active {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.icon-btn .icon-glyph { font-size: 20px; line-height: 1; }
.icon-btn .icon-label { font-size: 10px; color: var(--muted); text-align: center; }
.icon-btn.active .icon-label { color: var(--accent-dark); }
.icon-custom { margin-top: 8px; font-size: 12px; }

@media (max-width: 600px) {
  .icon-grid { grid-template-columns: repeat(4, 1fr); }
  .icon-modal { min-width: 0; }
}

/* ----- Mobile / iPhone Safari (< 768px) ----- */
@media (max-width: 768px) {
  body { font-size: 15px; }
  .topbar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .topbar nav { order: 3; flex-basis: 100%; }
  .topbar .user { font-size: 12px; }
  main { padding: 12px 14px; }

  .planner { height: auto; min-height: calc(100vh - 64px); }
  .planner-header { flex-wrap: wrap; gap: 10px; }
  .navlabel { min-width: 0; flex: 1; text-align: center; }

  .planner-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .backlog {
    max-height: 35vh; min-height: 180px;
    order: 2;  /* tussen header en weken voor mobiel? — boven beter */
  }
  .days-scroll {
    flex: 1;
    /* mobiele dag-kolommen iets smaller maar leesbaar */
  }
  .daycol { flex-basis: 78vw; max-width: 320px; }

  .vak-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .vak-actions { opacity: 1; }  /* altijd zichtbaar op touch */

  .modal-card { min-width: 0; }
  .form-row { flex-direction: column; gap: 8px; }
}

@media (max-width: 480px) {
  .topbar .user span:first-child { display: none; }  /* verberg naam, alleen logout */
  .topbar nav { gap: 2px; }
  .topbar nav .navlink { padding: 4px 6px; font-size: 13px; }
}

/* Compacte unit-rij op mobiel: 2-rijen layout */
@media (max-width: 720px) {
  .unit {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px 8px;
    align-items: center;
  }
  .unit .unit-title {
    grid-column: 2 / 3; font-size: 14px;
  }
  .unit > .linkbtn,        /* alle icon-buttons */
  .unit .plan-tag,
  .unit .unit-min-input,
  .unit > .muted {
    grid-row: 2;            /* tweede rij */
    font-size: 12px;
  }
  .unit > .linkbtn:first-of-type { grid-column: 1; }
  .unit-type {
    grid-row: 1; grid-column: 1;
  }
  .unit > button.danger.linkbtn:last-child {
    grid-row: 1; grid-column: 3; justify-self: end;
  }
  .unit-min-input { width: 3.5em; }
  .plan-tag { font-size: 10px; padding: 2px 6px; }
}
