:root {
  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary-color: #2563eb;
  --danger-color: #ef4444;
  --header-height: 105px;
  --footer-height: 35px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, sans-serif; }
body { background-color: var(--bg-primary); color: var(--text-main); height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* Header */
.app-header { height: var(--header-height); background: var(--bg-card); border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; justify-content: space-between; padding: 8px 12px; z-index: 10; }
.header-top { display: flex; align-items: center; justify-content: space-between; }
.nav-controls { display: flex; align-items: center; gap: 6px; }
.nav-controls h1 { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.view-selector { display: flex; background: #f1f5f9; border-radius: 8px; padding: 2px; gap: 2px; }
.view-btn { flex: 1; border: none; background: transparent; padding: 6px 0; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); border-radius: 6px; cursor: pointer; }
.view-btn.active { background: var(--bg-card); color: var(--primary-color); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Buttons & Inputs */
.btn { border: 1px solid var(--border-color); background: var(--bg-card); padding: 6px 12px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; }
.btn-primary { background: var(--primary-color); color: white; border: none; }
.btn-secondary { background: #e2e8f0; color: var(--text-main); }
.btn-icon { padding: 4px 8px; font-weight: bold; font-size: 1rem; }
.btn-xs { padding: 2px 8px; font-size: 0.75rem; }
.btn-sm { padding: 4px 8px; font-size: 0.8rem; }
.btn-info { background: #0ea5e9; color: white; border: none; }

/* Kalender Container */
.calendar-container { height: calc(100dvh - var(--header-height) - var(--footer-height)); overflow-y: auto; overflow-x: hidden; position: relative; }

/* Grid weergaves */
.day-grid, .two-day-grid, .week-grid { display: flex; width: 100%; min-height: 100%; }
.day-column { flex: 1; border-right: 1px solid var(--border-color); display: flex; flex-direction: column; min-width: 0; }
.day-header { position: sticky; top: 0; background: #f8fafc; border-bottom: 1px solid var(--border-color); text-align: center; padding: 6px 2px; font-weight: 600; font-size: 0.85rem; z-index: 5; }

/* Hele dag balk */
.allday-section { background: #f1f5f9; border-bottom: 2px solid var(--border-color); padding: 2px; display: flex; flex-direction: column; gap: 2px; }

/* Tijd as (24u = 1200px hoogte) */
.time-body { position: relative; flex: 1; min-height: 1200px; background-size: 100% 50px; background-image: linear-gradient(to bottom, #e2e8f0 1px, transparent 1px); }

/* Afspraak blokjes */
.event-card { position: absolute; border-radius: 4px; padding: 2px 4px; font-size: 0.7rem; overflow: hidden; box-sizing: border-box; color: white; border-left: 3px solid rgba(0,0,0,0.3); box-shadow: 0 1px 2px rgba(0,0,0,0.15); line-height: 1.1; word-wrap: break-word; }
.event-card.allday { position: relative; border-left: none; padding: 3px; font-size: 0.75rem; margin-bottom: 2px; }

/* Cursief + Stippellijn styling voor 'Beschikbaar' */
.event-card.is-free { font-style: italic; background-color: #ffffff !important; color: #0f172a !important; border: 2px dotted #94a3b8 !important; border-left: 4px dashed #64748b !important; }

/* Maand weergave */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(70px, 1fr); height: 100%; }
.month-header-cell { background: #f1f5f9; text-align: center; padding: 6px 0; font-size: 0.8rem; font-weight: bold; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 2; }
.month-day-cell { border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); padding: 2px; display: flex; flex-direction: column; cursor: pointer; overflow: hidden; background: var(--bg-card); transition: background 0.2s; }
.month-day-cell:active { background: #e2e8f0; }
.month-day-number { font-size: 0.75rem; font-weight: bold; margin-bottom: 2px; text-align: right; padding-right: 4px; }
.month-event-pill { font-size: 0.65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 2px; padding: 1px 3px; margin-bottom: 2px; color: white; }
.month-event-pill.is-free { background-color: #ffffff !important; color: #0f172a; border: 1px dotted #94a3b8; font-style: italic; }

/* Log footer */
.log-footer { height: var(--footer-height); background: #0f172a; color: #f8fafc; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; font-size: 0.75rem; }
.log-line-container { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; width: 100%; }
.log-badge { background: #334155; padding: 2px 4px; border-radius: 3px; font-weight: bold; font-size: 0.7rem; }
.log-text { overflow: hidden; text-overflow: ellipsis; flex-grow: 1; }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 10px; }
.modal.hidden { display: none; }
.modal-content { background: var(--bg-card); width: 100%; max-width: 480px; max-height: 90vh; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 12px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.section-title-bar { display: flex; justify-content: space-between; align-items: center; }

/* Help tekst opmaak */
.help-body ol, .help-body ul { padding-left: 24px; margin-top: 8px; margin-bottom: 12px; }
.help-body li { margin-bottom: 6px; line-height: 1.4; }

/* Lijst Agenda's */
.agenda-item { display: flex; align-items: center; justify-content: space-between; padding: 8px; border: 1px solid var(--border-color); border-radius: 6px; background: #f8fafc; }
.agenda-info { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.agenda-badge { padding: 2px 6px; border-radius: 4px; color: white; font-weight: bold; font-size: 0.7rem; }
.agenda-title { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Formulieren */
.input-control { width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 6px; margin-top: 4px; font-size: 1rem; }
.input-control-color { width: 100%; height: 40px; border: none; cursor: pointer; border-radius: 6px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.full-width { width: 100%; }
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; padding: 0 5px; }

/* Responsive Landscape Mode */
@media (orientation: landscape) {
  :root { --header-height: 80px; }
  .header-top { gap: 12px; padding: 4px 12px; }
  .view-selector { padding: 1px; }
  .view-btn { padding: 4px 0; }
  .month-grid { grid-auto-rows: minmax(50px, 1fr); }
}