/* ============================================================
   HQC PLANNER — Obsidian Edition
   Premium Dark UI · High-performance · Zero flicker
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ─── Design Tokens ──────────────────────────────────────── */
:root {
  /* Brand */
  --brand:        #4ade80;
  --brand-dim:    #22c55e;
  --brand-glow:   rgba(74, 222, 128, 0.15);
  --brand-pale:   rgba(74, 222, 128, 0.06);
  --gold:         #f59e0b;
  --gold-light:   #fef3c7;
  --gold-glow:    rgba(245, 158, 11, 0.15);
  --blue:         #60a5fa;
  --blue-glow:    rgba(96, 165, 250, 0.15);
  --coral:        #fb7185;
  --coral-glow:   rgba(251, 113, 133, 0.12);

  /* Surfaces (Default Dark) */
  --bg:           #0a0c0f;
  --bg-1:         #0f1117;
  --bg-2:         #141720;
  --bg-3:         #1a1e2b;
  --bg-4:         #212637;
  --bg-glass:     rgba(15, 17, 23, 0.88);
  --bg-hover:     rgba(255, 255, 255, 0.04);

  /* Borders */
  --border:       rgba(255, 255, 255, 0.06);
  --border-mid:   rgba(255, 255, 255, 0.10);
  --border-hi:    rgba(255, 255, 255, 0.16);

  /* Text */
  --text:         #f1f5f9;
  --text-mid:     #94a3b8;
  --text-light:   #475569;
  --text-muted:   #334155;
}

/* ─── Light Mode Overrides ────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f8fafc;
  --bg-1:         #ffffff;
  --bg-2:         #f1f5f9;
  --bg-3:         #e2e8f0;
  --bg-4:         #cbd5e1;
  --bg-glass:     rgba(255, 255, 255, 0.9);
  --bg-hover:     rgba(0, 0, 0, 0.04);

  --border:       rgba(0, 0, 0, 0.08);
  --border-mid:   rgba(0, 0, 0, 0.12);
  --border-hi:    rgba(0, 0, 0, 0.20);

  --text:         #0f172a;
  --text-mid:     #475569;
  --text-light:   #64748b;
  --text-muted:   #94a3b8;

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.1);
  --shadow:       0 4px 12px rgba(0,0,0,0.05), 0 1px 4px rgba(0,0,0,0.05);
  --shadow-lg:    0 12px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  
}

[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(74,222,128,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(96,165,250,0.06) 0%, transparent 60%);
}

[data-theme="light"] .cal-event.admin  { background: rgba(245,158,11,0.1); color: #b45309; }
[data-theme="light"] .cal-event.mine   { background: rgba(96,165,250,0.1); color: #1d4ed8; }
[data-theme="light"] .cal-event.others { background: rgba(74,222,128,0.1); color: #15803d; }
[data-theme="light"] .ms-options { background: var(--bg-1); }
[data-theme="light"] .btn-outline { background: var(--bg-1); }
[data-theme="light"] .btn-outline:hover { background: var(--bg-2); }
[data-theme="light"] .timeline-dot { background: var(--bg-3); border-color: var(--border-mid); }
[data-theme="light"] .tl-task-card { background: var(--bg-1); }
[data-theme="light"] .tl-task-card:hover { background: var(--bg-2); }
[data-theme="light"] .tl-action-btn { background: var(--bg-2); }
[data-theme="light"] .tl-action-btn:hover { background: var(--bg-3); }
[data-theme="light"] .calendar-cell.today { background: var(--bg-1); border: 2px solid var(--brand-dim); }
[data-theme="light"] .calendar-cell.today .day-num { box-shadow: 0 0 10px rgba(74,222,128,0.2); }
[data-theme="light"] .modal { background: var(--bg-1); }
[data-theme="light"] .event-modal { background: var(--bg-1); }
[data-theme="light"] .ms-toggle { background: var(--bg-1); }

:root {

  /* Backwards-compat aliases */
  --primary:        var(--brand-dim);
  --primary-dark:   #15803d;
  --primary-light:  var(--brand);
  --primary-pale:   var(--brand-pale);
  --green:          var(--brand-dim);
  --green-dark:     #15803d;
  --green-deep:     #166534;
  --green-light:    var(--brand);
  --green-pale:     var(--brand-pale);
  --secondary:      var(--gold);
  --secondary-light:var(--gold-light);
  --warning:        var(--gold);
  --border-dark:    var(--border-mid);
  --bg-card:        var(--bg-2);
  --bg-hover:       rgba(255, 255, 255, 0.04);

  /* Layout */
  --sidebar-w:    256px;
  --topbar-h:     64px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
  --shadow:       0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg:    0 24px 48px rgba(0,0,0,0.6), 0 8px 16px rgba(0,0,0,0.4);

  /* Radii */
  --radius:       14px;
  --radius-sm:    9px;
  --radius-lg:    20px;
  --radius-xl:    28px;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(74,222,128,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(96,165,250,0.03) 0%, transparent 60%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; cursor: pointer; }
button, input, select, textarea { font-family: inherit; }

/* ─── Layout ─────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ─── Sidebar (ALTIJD DONKER) ────────────────────────────── */
.sidebar, 
.sidebar * { 
  /* Forceer donkere basis voor alle elementen in de sidebar */
}

.sidebar {
  width: var(--sidebar-w);
  background: #0f1117 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  contain: layout style;
}

.sidebar .sidebar-logo { 
  background: #0f1117 !important; 
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important; 
}

.sidebar .sidebar-logo-name { color: #f1f5f9 !important; }
.sidebar .sidebar-logo-sub { color: #94a3b8 !important; }

.sidebar .sidebar-user {
  margin: 0 12px 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar .sidebar-username { font-size: 0.88rem; font-weight: 600; color: #f1f5f9 !important; }
.sidebar .sidebar-role     { font-size: 0.68rem; color: #94a3b8 !important; }

.sidebar .sidebar-section { 
  color: #94a3b8 !important; 
  opacity: 0.5 !important; 
  text-transform: uppercase;
  font-size: 0.63rem;
  font-weight: 700;
  margin: 20px 10px 6px;
}

.sidebar .sidebar-link { 
  color: #94a3b8 !important; 
  background: transparent !important;
}

.sidebar .sidebar-link:hover { 
  background: rgba(255, 255, 255, 0.04) !important; 
  color: #f1f5f9 !important; 
}

.sidebar .sidebar-link.active { 
  background: rgba(74, 222, 128, 0.06) !important; 
  color: #4ade80 !important; 
}

.sidebar .sidebar-footer { 
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important; 
}

/* Zorg dat iconen ook de juiste kleur hebben */
.sidebar .sidebar-icon { color: inherit !important; }

.sidebar .sidebar-logo-img {
  display: block;
  max-width: 256px;
  max-height: 120px;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.sidebar .sidebar-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dim));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 16px rgba(74,222,128,0.3), 0 2px 8px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

.sidebar .sidebar-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand-dim), var(--brand));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
  color: #0a0c0f;
  flex-shrink: 0;
}

.sidebar .sidebar-nav { flex: 1; padding: 0 10px; overflow-y: auto; }
.sidebar .sidebar-nav::-webkit-scrollbar { width: 0; }

.sidebar .sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.sidebar .sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(74,222,128,0.4);
}

.sidebar .sidebar-icon { width: 18px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }

.sidebar .sidebar-badge {
  margin-left: auto;
  background: var(--coral); color: white;
  font-size: 0.65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}

.sidebar .sidebar-footer { padding: 12px 10px 20px; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ─── Main ───────────────────────────────────────────────── */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar > div { display: flex; flex-direction: column; justify-content: center; }
.topbar .topbar-actions { display: flex; flex-direction: row; align-items: center; gap: 10px; }

.menu-toggle {
  display: none;
  background: transparent; border: none; font-size: 1.1rem;
  padding: 8px; cursor: pointer; color: var(--text-mid);
  border-radius: 8px; transition: background 0.15s, color 0.15s;
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text); }

.topbar-title    { font-size: 1.05rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.topbar-subtitle { font-size: 0.78rem; color: var(--text-light); }

.content { padding: 28px; flex: 1; }

/* ─── Welcome Banner ─────────────────────────────────────── */
.welcome-banner {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  color: var(--text);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, var(--brand), transparent 60%);
  opacity: 0.7;
}
.welcome-banner::after {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(74,222,128,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-title { font-size: 1.7rem; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; }
.welcome-title span { color: var(--brand); }
.welcome-sub { font-size: 0.9rem; color: var(--text-mid); }

/* ─── Stats ──────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-2); padding: 20px 22px;
  border-radius: var(--radius); display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border); cursor: default;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border-mid); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.green { background: var(--brand-pale); color: var(--brand); }
.stat-icon.gold  { background: var(--gold-glow); color: var(--gold); }
.stat-icon.blue  { background: var(--blue-glow); color: var(--blue); }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--text-light); margin-top: 3px; font-weight: 500; }

/* ─── Calendar ───────────────────────────────────────────── */
.calendar-wrap {
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: visible;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.calendar-header {
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.calendar-month { font-size: 1.1rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--border); gap: 1px;
  width: 100%;
  overflow: visible;
  position: relative;
}
.calendar-day-header {
  background: var(--bg-1); padding: 10px; text-align: center;
  font-size: 0.7rem; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.08em;
  overflow: hidden;
}
.calendar-cell {
  background: var(--bg-2); min-height: 120px; padding: 10px;
  transition: background 0.12s;
  overflow: visible;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
}
.calendar-cell:hover { background: var(--bg-3); }
.calendar-cell.other-month { background: var(--bg-1); opacity: 0.5; }
.calendar-cell.today { background: var(--bg-3); }
.calendar-cell.today .day-num {
  background: var(--brand); color: #0a0c0f;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.82rem;
  box-shadow: 0 0 10px rgba(74,222,128,0.4);
}
.day-num {
  font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--text-mid);
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
}
.cal-event {
  font-size: 0.7rem; padding: 4px 8px; border-radius: 5px; margin-bottom: 3px;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600; transition: opacity 0.12s, transform 0.12s;
  contain: layout;
  /* Prevent long text from ever stretching the cell */
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.cal-event:hover { transform: scale(1.02); opacity: 0.9; }
.cal-event.admin  { background: rgba(245,158,11,0.15); color: #fbbf24; border-left: 2px solid var(--gold); }
.cal-event.mine   { background: rgba(96,165,250,0.15); color: #93c5fd; border-left: 2px solid var(--blue); }
.cal-event.others { background: rgba(74,222,128,0.12); color: var(--brand); border-left: 2px solid var(--brand-dim); }
.cal-event.done   { opacity: 0.35; text-decoration: line-through; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 10px;
  font-weight: 600; font-size: 0.86rem; cursor: pointer; border: none;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  letter-spacing: 0.01em; white-space: nowrap;
}
.btn:active { transform: scale(0.97) !important; }
.btn-primary {
  background: var(--brand); color: #0a0c0f; font-weight: 700;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(74,222,128,0.3), 0 2px 6px rgba(0,0,0,0.3);
}
.btn-danger {
  background: rgba(251,113,133,0.15); color: var(--coral);
  border: 1px solid rgba(251,113,133,0.25);
}
.btn-danger:hover { background: rgba(251,113,133,0.22); transform: translateY(-1px); }
.btn-outline {
  background: var(--bg-3); border: 1px solid var(--border-mid); color: var(--text-mid);
}
.btn-outline:hover { background: var(--bg-4); border-color: var(--border-hi); color: var(--text); transform: translateY(-1px); }
.btn-sm { padding: 6px 13px; font-size: 0.78rem; }
.w-full { width: 100%; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text-mid); font-size: 0.82rem; }
.form-control {
  width: 100%; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--border-mid); background: var(--bg-3); color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: rgba(74,222,128,0.4);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.08);
}
.form-control::placeholder { color: var(--text-light); }
.form-control[readonly], .form-control[disabled] { opacity: 0.6; cursor: not-allowed; }
.form-row { display: flex; gap: 12px; }
.form-hint { font-size: 0.75rem; color: var(--text-light); margin-top: 5px; }
textarea.form-control { resize: vertical; min-height: 80px; }
input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: dark; }

/* ─── Modals ─────────────────────────────────────────────── */
.event-modal-overlay,
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.event-modal-overlay.show, .modal-overlay.show { display: flex; }

.event-modal, .modal {
  background: var(--bg-2); border: 1px solid var(--border-mid);
  width: 100%; max-width: 480px;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal { max-width: 680px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.event-modal-header, .modal .modal-header {
  padding: 20px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-3);
}
.event-modal-title, .modal .modal-title {
  font-size: 1rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em;
}
.event-modal-close, .modal .modal-close {
  background: none; border: none; font-size: 1rem; cursor: pointer;
  color: var(--text-light); padding: 4px; border-radius: 6px;
  transition: color 0.15s, background 0.15s; line-height: 1;
}
.event-modal-close:hover, .modal .modal-close:hover { color: var(--text); background: var(--bg-hover); }

.event-modal-body, .modal .modal-body { padding: 20px 22px; }

.event-detail-row {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 16px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.event-detail-row:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.event-detail-icon { font-size: 1rem; color: var(--text-light); flex-shrink: 0; margin-top: 2px; }
.event-detail-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.07em;
  width: 88px; flex-shrink: 0; margin-top: 2px;
}
.event-detail-value { font-size: 0.92rem; font-weight: 500; color: var(--text); flex: 1; }

.modal-footer {
  padding: 16px 22px; background: var(--bg-3); border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ─── Badges ─────────────────────────────────────────────── */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }
.badge-done    { background: rgba(74,222,128,0.12); color: var(--brand); border: 1px solid rgba(74,222,128,0.2); }
.badge-pending { background: rgba(245,158,11,0.12); color: var(--gold); border: 1px solid rgba(245,158,11,0.2); }

/* ─── Toggle switch ──────────────────────────────────────── */
.toggle-switch { display: inline-block; position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-4); border: 1px solid var(--border-mid);
  border-radius: 999px; transition: background 0.18s, border-color 0.18s;
}
.toggle-slider:before {
  content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px;
  background: var(--text-mid); border-radius: 50%; transition: transform 0.18s, background 0.18s;
}
.toggle-switch input:checked + .toggle-slider { background: rgba(74,222,128,0.2); border-color: rgba(74,222,128,0.4); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); background: var(--brand); }

.reminder-toggle-row { display: flex; align-items: center; justify-content: space-between; cursor: pointer; gap: 12px; }
.reminder-label { font-size: 0.85rem; font-weight: 600; color: var(--text-mid); }
.reminder-time-box { display: none; margin-top: 10px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.reminder-time-box.show { display: block; }
.reminder-hint { font-size: 0.75rem; color: var(--text-light); margin-top: 6px; }

/* ─── Cards ──────────────────────────────────────────────── */
.card { background: var(--bg-2); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.card-header {
  padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); background: var(--bg-3);
}
.card-title    { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 0.8rem; color: var(--text-light); }
.card .card-body, .card > .content { padding: 16px; }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; font-weight: 600; font-size: 0.88rem; }
.alert-success { background: rgba(74,222,128,0.1); color: var(--brand); border-color: rgba(74,222,128,0.2); }
.alert-danger  { background: rgba(251,113,133,0.1); color: var(--coral); border-color: rgba(251,113,133,0.2); }

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
table thead th { font-weight: 700; color: var(--text-light); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; background: var(--bg-3); }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Login ──────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; background: var(--bg);
  background-image: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(74,222,128,0.06) 0%, transparent 60%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-2); border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl); padding: 36px 32px; box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dim));
  border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin-bottom: 14px;
  box-shadow: 0 0 24px rgba(74,222,128,0.25);
}
.login-logo h1 { font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.login-logo p  { font-size: 0.8rem; color: var(--text-light); margin-top: 4px; }
.login-error { background: rgba(251,113,133,0.1); color: var(--coral); border: 1px solid rgba(251,113,133,0.2); border-radius: 9px; padding: 10px 14px; font-size: 0.85rem; font-weight: 600; margin-bottom: 16px; }
.login-info  { background: rgba(96,165,250,0.1); color: var(--blue); border: 1px solid rgba(96,165,250,0.2); border-radius: 9px; padding: 10px 14px; font-size: 0.85rem; font-weight: 600; margin-bottom: 16px; }

/* ─── Multi-select ───────────────────────────────────────── */
.multi-select { position: relative; display: inline-block; width: 100%; }
.ms-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border-mid);
  background: var(--bg-3); cursor: pointer; color: var(--text);
  transition: border-color 0.15s;
}
.ms-toggle:hover { border-color: var(--border-hi); }
.ms-placeholder { color: var(--text-mid); font-size: 0.9rem; }
.ms-caret { color: var(--text-light); }
.ms-options {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--bg-3); border-radius: 10px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-mid); max-height: 200px; overflow-y: auto;
  padding: 6px; z-index: 1200;
}
.ms-option { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; border-radius: 7px; font-size: 0.88rem; color: var(--text); }
.ms-option:hover { background: var(--bg-hover); }
.ms-option input { accent-color: var(--brand); }

/* ─── Checkbox list ──────────────────────────────────────── */
.checkbox-list { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--bg-3);
  cursor: pointer; font-size: 0.85rem; color: var(--text-mid);
  transition: border-color 0.15s, color 0.15s;
}
.checkbox-item:hover { border-color: var(--border-mid); color: var(--text); }
.checkbox-item input { accent-color: var(--brand); margin: 0; }
.checkbox-item-avatar {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--brand-pale); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.72rem;
}

/* ─── Task list ──────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.task-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2);
  transition: border-color 0.15s;
}
.task-item:hover { border-color: var(--border-mid); }
.task-item.done { opacity: 0.5; }
.task-check {
  width: 18px; height: 18px; border-radius: 5px; background: transparent;
  border: 2px solid var(--border-mid); flex-shrink: 0; cursor: pointer; margin-top: 3px;
  transition: background 0.15s, border-color 0.15s;
}
.task-check.checked { background: var(--brand); border-color: var(--brand); color: #0a0c0f; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.task-title { font-weight: 600; font-size: 0.92rem; color: var(--text); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; font-size: 0.77rem; color: var(--text-light); }
.task-meta-item { background: var(--bg-3); padding: 2px 8px; border-radius: 6px; }
.task-actions { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }
.task-body { flex: 1; }

/* ─── Icon buttons ───────────────────────────────────────── */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px; border-radius: 8px; border: 1px solid var(--border); background: transparent; cursor: pointer;
  color: var(--text-mid); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); border-color: var(--border-mid); color: var(--text); }
.btn-icon.danger { color: var(--coral); border-color: transparent; }
.btn-icon.danger:hover { background: rgba(251,113,133,0.1); }

/* ─── Avatars ────────────────────────────────────────────── */
.avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--brand-pale); color: var(--brand); border-radius: 9px; font-weight: 700; }

/* ─── Empty states ───────────────────────────────────────── */
.empty-state { padding: 32px; text-align: center; color: var(--text-light); }
.empty-icon  { font-size: 2rem; margin-bottom: 8px; opacity: 0.5; }

/* ─── Two-col layout ─────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 400px 1fr; gap: 20px; align-items: start; }

/* ─── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* Chat styles removed (feature deprecated) */

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s cubic-bezier(0.16,1,0.3,1); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
}

@media (max-width: 900px) {
  .app { display: block; }
  .topbar { padding: 0 16px; position: fixed; top: 0; left: 0; right: 0; z-index: 60; }
  .content { padding: calc(var(--topbar-h) + 16px) 16px 24px; }
  .stats-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .stat-card { padding: 14px 16px; gap: 12px; }
  .stat-icon { width: 40px; height: 40px; font-size: 1rem; border-radius: 10px; }
  .stat-value { font-size: 1.5rem; }
  .two-col { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .topbar-actions { display: none; }
  .welcome-banner { padding: 22px 20px; }
  .welcome-title { font-size: 1.3rem; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .table-wrap { padding: 6px; }
  table th, table td { padding: 8px; font-size: 0.86rem; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .calendar-cell { min-height: 60px; padding: 4px; }
  .cal-event { font-size: 0.62rem; padding: 3px 5px; }
  .calendar-day-header { font-size: 0.6rem; padding: 6px 2px; letter-spacing: 0.02em; }
  .day-num { font-size: 0.72rem; width: 22px; height: 22px; }
  .modal { width: 95%; }
  .login-card { padding: 24px 18px; }
}

@media (max-width: 360px) {
  .calendar-cell { min-height: 50px; padding: 3px; }
  .cal-event { font-size: 0.58rem; padding: 2px 4px; margin-bottom: 2px; }
  .calendar-day-header { font-size: 0.55rem; padding: 5px 1px; }
}
/* ─── Mobile Responsive Fixes ────────────────────────────── */

/* Topbar: altijd "+ Nieuwe Taak" knop zichtbaar op mobiel */
@media (max-width: 900px) {
  .topbar-actions {
    display: flex !important;
  }
  .topbar-actions .btn {
    font-size: 0.78rem;
    padding: 7px 12px;
  }
}

/* Modal: volledig mobiel-vriendelijk */
@media (max-width: 600px) {
  /* Overlay padding kleiner zodat modal meer ruimte heeft */
  .event-modal-overlay,
  .modal-overlay {
    padding: 16px;
    align-items: center;
  }

  /* Event modal (taakdetail) */
  .event-modal {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg);
    max-height: 88vh;
    overflow-y: auto;
  }

  /* Reguliere modal (nieuwe taak / edit) */
  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg);
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Modal header: titel afkappen met ellipsis */
  .event-modal-title,
  .modal .modal-title {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 40px);
  }

  /* Modal body: minder padding */
  .event-modal-body,
  .modal .modal-body {
    padding: 14px 16px;
  }

  .event-modal-header,
  .modal .modal-header {
    padding: 14px 16px;
  }

  /* Detail rijen: label boven waarde op zeer kleine schermen */
  .event-detail-row {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }
  .event-detail-label {
    width: auto;
    min-width: 80px;
  }
  .event-detail-value {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Modal footer: knoppen wrappen en full-width worden */
  .modal-footer {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  /* Kalender cellen kleiner op mobiel */
  .calendar-cell {
    min-height: 52px;
    padding: 3px;
  }
  .cal-event {
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
  }
  .day-num {
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
  }
  .calendar-day-header {
    font-size: 0.58rem;
    padding: 5px 2px;
  }

  /* Welcome banner kleiner */
  .welcome-banner {
    padding: 16px 14px;
  }
  .welcome-title {
    font-size: 1.1rem;
  }
  .welcome-sub {
    font-size: 0.75rem;
  }

  /* Stat cards: 3 op een rij op mobiel */
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .stat-card {
    padding: 10px 8px;
    gap: 8px;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .stat-icon {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
    border-radius: 8px;
  }
  .stat-value {
    font-size: 1.3rem;
  }
  .stat-label {
    font-size: 0.68rem;
  }

  /* Topbar compacter */
  .topbar {
    padding: 0 12px;
    height: 54px;
  }
  .topbar-title {
    font-size: 0.92rem;
  }
  .topbar-subtitle {
    font-size: 0.68rem;
  }

  /* Content top padding aanpassen voor kleinere topbar */
  .content {
    padding: calc(54px + 12px) 12px 20px;
  }

  /* Form row: 2 kolommen naast elkaar (datum + tijd) */
  .form-row {
    flex-direction: row;
    gap: 8px;
  }
  .form-row .form-group {
    flex: 1;
    margin-bottom: 10px;
  }

  /* Kalender header compacter */
  .calendar-header {
    padding: 12px 14px;
  }
  .calendar-month {
    font-size: 0.92rem;
  }
}

/* Extra klein (360px en minder) */
@media (max-width: 380px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .stat-label {
    font-size: 0.6rem;
  }
  .modal-footer .btn {
    font-size: 0.72rem;
    padding: 7px 6px;
  }
  /* Topbar actions: alleen icoon tonen */
  .topbar-actions .btn span.btn-text {
    display: none;
  }
}
