/* PKM — Atelier Dark */
/* Geïnspireerd op de Claude-app: warm donker, terracotta accenten */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variabelen ─────────────────────────────────────────────── */
:root {
  /* Achtergronden */
  --bg:           #0e0c09;
  --bg-surface:   #141210;
  --bg-card:      #1c1914;
  --bg-elevated:  #232019;
  --bg-hover:     #2a261e;

  /* Randen */
  --border:       #2e2a22;
  --border-light: #221f18;

  /* Tekst */
  --text:         #ede6d0;
  --text-dim:     #b5ad97;
  --muted:        #7a7060;

  /* Hoofdkleur: terracotta / amber (Claude-stijl) */
  --accent:       #c8865a;
  --accent-light: #e09870;
  --accent-glow:  rgba(200, 134, 90, 0.12);

  /* MIP: goud */
  --mip:          #d4a84e;
  --mip-dim:      #9a7a38;
  --mip-glow:     rgba(212, 168, 78, 0.14);

  /* TODON'T: rood */
  --todont:       #b85555;
  --todont-glow:  rgba(184, 85, 85, 0.1);

  /* Gewoontes: blauw */
  --habit:        #6a8fc8;
  --habit-glow:   rgba(106, 143, 200, 0.12);

  /* States */
  --success:  #6ba86b;
  --danger:   #c86060;
  --warning:  #c8a04a;

  /* Layout */
  --sidebar-w: 230px;
  --radius:    10px;
  --radius-sm: 6px;
  --transition: 0.18s ease;
}

/* ─── Light Mode: Claude perkament-kleuren ───────────────────────── */
[data-theme="light"] {
  /* Achtergronden: warm gebroken wit, perkament-toon */
  --bg:           #f7f3ed;
  --bg-surface:   #ede8df;
  --bg-card:      #fdfaf6;
  --bg-elevated:  #f0ebe2;
  --bg-hover:     #e8e2d8;

  /* Randen: warm lichtgrijs */
  --border:       #d8d0c4;
  --border-light: #e4ddd5;

  /* Tekst: diepe warme bruintonen */
  --text:         #1e1a14;
  --text-dim:     #5a5044;
  --muted:        #8a7d6e;

  /* Accent: terracotta — gelijk aan dark mode */
  --accent:       #b86840;
  --accent-light: #c8785a;
  --accent-glow:  rgba(184, 104, 64, 0.10);

  /* MIP: rijker goud op lichte achtergrond */
  --mip:          #a87820;
  --mip-dim:      #7a5a18;
  --mip-glow:     rgba(168, 120, 32, 0.12);

  /* TODON'T */
  --todont:       #a84040;
  --todont-glow:  rgba(168, 64, 64, 0.08);

  /* Gewoontes */
  --habit:        #4a72b0;
  --habit-glow:   rgba(74, 114, 176, 0.10);

  /* States */
  --success:  #3a7a3a;
  --danger:   #a83030;
  --warning:  #906820;
}

/* Lichte sidebar: iets warmere ondergrond */
[data-theme="light"] .sidebar {
  background: var(--bg-surface);
  border-right-color: var(--border);
}

/* Hover in sidebar werkt niet goed met witte alpha op lichte bg */
[data-theme="light"] .sidebar-nav a:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Server-url was hardcoded donker */
[data-theme="light"] .server-url {
  color: var(--muted);
}

/* Kaarten krijgen een subtiele schaduw i.p.v. alleen border */
[data-theme="light"] .card,
[data-theme="light"] .focus-item,
[data-theme="light"] .event-item,
[data-theme="light"] .inbox-item,
[data-theme="light"] .mip-block,
[data-theme="light"] .todont-item {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Scrollbar licht */
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border); }

/* Thema-toggle knop in sidebar footer */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  transition: var(--transition);
  width: 100%;
}

.theme-toggle:hover {
  color: var(--text-dim);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.theme-toggle-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.8;
}

/* ─── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}

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

/* ─── Sidebar (standaard ingeklapt — Logseq-stijl) ──────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-100%);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay.open {
  display: block;
}

.sidebar-logo {
  padding: 56px 22px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

.logo-name {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 22px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 400;
  transition: color var(--transition), background var(--transition);
  border-left: 2px solid transparent;
  letter-spacing: 0.01em;
}

.sidebar-nav a:hover {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav a.active {
  color: var(--accent-light);
  background: var(--accent-glow);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity var(--transition);
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.server-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: #3a3428;
  letter-spacing: 0.03em;
}

/* ─── Main Content (gecentreerd, geen sidebar offset) ────────────── */
.main {
  flex: 1;
  min-width: 0;
  padding: 56px 48px 100px;
  padding-top: 64px;
  max-width: 920px;
  margin: 0 auto;
}

/* ─── Pagina header ──────────────────────────────────────────────── */
.page-header {
  margin-bottom: 44px;
}

.page-date {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.page-greeting {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 8px;
  font-weight: 300;
}

.page-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ─── Journal Quick-Capture ──────────────────────────────────────── */
.journal-capture {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 44px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.journal-capture:focus-within {
  border-color: rgba(200, 134, 90, 0.4);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 24px rgba(0, 0, 0, 0.3);
}

.journal-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.7;
  padding: 24px 28px 16px;
  resize: none;
  outline: none;
  min-height: 80px;
  transition: min-height 0.25s ease;
}

.journal-textarea::placeholder {
  color: var(--muted);
  font-style: italic;
  font-weight: 300;
}

.journal-capture:focus-within .journal-textarea {
  min-height: 130px;
}

.journal-capture-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px 16px;
  border-top: 1px solid var(--border-light);
}

.journal-hint {
  font-size: 0.73rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s;
  font-family: 'JetBrains Mono', monospace;
}

.journal-capture:focus-within .journal-hint {
  opacity: 1;
}

.journal-success {
  padding: 9px 22px;
  font-size: 0.82rem;
  color: var(--success);
  border-top: 1px solid rgba(107, 168, 107, 0.15);
  background: rgba(107, 168, 107, 0.06);
}

.journal-success.hidden {
  display: none;
}

/* ─── Dashboard Grid ─────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 36px;
  margin-bottom: 44px;
  align-items: start;
}

.grid-left {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.grid-right {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ─── Focus sectie volle breedte ────────────────────────────────── */
.section-focus-fullwidth {
  margin-bottom: 36px;
}

/* ─── Focus overige (inklapbaar) ────────────────────────────────── */
.focus-overige-wrapper {
  margin-top: 4px;
}

.focus-overige-wrapper.hidden {
  display: none;
}

.focus-overige-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 13px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.focus-overige-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.focus-overige-chevron {
  display: inline-block;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.focus-overige-wrapper.collapsed .focus-overige-lijst {
  display: none;
}

.focus-overige-wrapper.collapsed .focus-overige-chevron {
  transform: rotate(0deg);
}

.focus-overige-wrapper:not(.collapsed) .focus-overige-chevron {
  transform: rotate(90deg);
}

.focus-overige-lijst {
  margin-top: 6px;
}

/* ─── Secties ────────────────────────────────────────────────────── */
.section {
  /* geen margin-bottom hier, gap op parent */
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title-link {
  text-decoration: none;
  cursor: pointer;
}

.section-title-link:hover {
  color: var(--accent);
}

.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.section-hint {
  font-size: 0.7rem;
  color: #4a4030;
  font-style: italic;
}

.section-header-acties {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-focus-toevoegen {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  padding: 0;
}

.btn-focus-toevoegen:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Focus Modal ────────────────────────────────────────────────── */
.focus-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.focus-modal.hidden {
  display: none;
}

.focus-modal-inhoud {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 480px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.focus-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.focus-modal-titel {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.focus-modal-sluiten {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}

.focus-modal-sluiten:hover {
  color: var(--text);
}

.focus-modal-lijst {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.focus-modal-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 8px 4px;
}

.focus-modal-taak {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: var(--transition);
}

.focus-modal-taak:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.focus-modal-taak-naam {
  font-size: 0.875rem;
  color: var(--text);
}

.focus-modal-taak-badge {
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.focus-verwijder-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.focus-verwijder-btn:hover {
  color: var(--danger);
}

.section-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.section-link:hover {
  opacity: 1;
}

/* ─── MIP Block ──────────────────────────────────────────────────── */
.mip-block {
  background: linear-gradient(135deg, rgba(212, 168, 78, 0.1) 0%, rgba(212, 168, 78, 0.04) 100%);
  border: 1px solid rgba(212, 168, 78, 0.25);
  border-left: 3px solid var(--mip);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.mip-block.hidden {
  display: none;
}

.mip-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mip-dim);
  margin-bottom: 8px;
}

.mip-star-icon {
  color: var(--mip);
  font-size: 0.85rem;
}

.mip-title {
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 14px;
}

.mip-actions {
  display: flex;
  gap: 8px;
}

/* ─── Focus Taken ────────────────────────────────────────────────── */
.focus-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.focus-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), background var(--transition);
}

.focus-item:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--bg-elevated);
}

.focus-item.is-mip {
  border-color: rgba(212, 168, 78, 0.25);
  border-left: 3px solid var(--mip);
  background: rgba(212, 168, 78, 0.04);
}

.focus-item.done-flash {
  background: rgba(107, 168, 107, 0.08);
  border-color: rgba(107, 168, 107, 0.2);
}

.focus-item.fading-out {
  opacity: 0;
  transform: scale(0.98) translateX(-4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Afgeronde focustaak — doorgestreept, gedimd */
.focus-item.is-done {
  opacity: 0.45;
  border-color: transparent;
}

.focus-item.is-done .focus-title {
  text-decoration: line-through;
  color: var(--muted);
}

.focus-item.is-done .focus-checkbox {
  cursor: pointer;
}

/* ─── Focus nieuw invoerveld ─────────────────────────────────────── */
.focus-nieuw {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  margin-top: 4px;
  transition: border-color var(--transition);
}

.focus-nieuw:focus-within {
  border-color: var(--accent);
  border-style: solid;
}

.focus-nieuw-icoon {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--transition);
}

.focus-nieuw:focus-within .focus-nieuw-icoon {
  color: var(--accent);
}

.focus-nieuw-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  padding: 0;
}

.focus-nieuw-input::placeholder {
  color: var(--muted);
}

/* Plaatshouder zodat layout klopt zonder ster-knop */
.star-placeholder {
  display: inline-block;
  width: 24px;
  flex-shrink: 0;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 2px;
  line-height: 1;
  opacity: 0.4;
  transition: opacity var(--transition), color var(--transition);
  flex-shrink: 0;
  margin-top: 1px;
}

.star-btn:hover {
  opacity: 0.85;
  color: var(--mip);
}

.star-btn.active {
  opacity: 1;
  color: var(--mip);
}

.focus-checkbox {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.focus-content {
  flex: 1;
  min-width: 0;
}

.focus-title {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.4;
}

.focus-goal {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
  font-style: italic;
}

/* ─── TODON'T ────────────────────────────────────────────────────── */
.section-todont .section-title {
  color: rgba(184, 85, 85, 0.65);
}

.todont-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.todont-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(184, 85, 85, 0.05);
  border: 1px solid rgba(184, 85, 85, 0.14);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

.todont-item:focus-within {
  border-color: rgba(184, 85, 85, 0.3);
}

.todont-number {
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  color: rgba(184, 85, 85, 0.4);
  min-width: 16px;
  font-weight: 600;
  user-select: none;
}

.todont-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  outline: none;
  line-height: 1.4;
}

.todont-input::placeholder {
  color: rgba(184, 85, 85, 0.28);
  font-style: italic;
}

.todont-toggle {
  cursor: pointer;
  user-select: none;
}

.todont-chevron {
  margin-left: auto;
  font-size: 1.1rem;
  color: rgba(184, 85, 85, 0.4);
  transition: transform var(--transition);
  transform: rotate(90deg);
}

.section-todont.collapsed .todont-chevron {
  transform: rotate(0deg);
}

.section-todont.collapsed .todont-list {
  display: none;
}

/* ─── Gewoontes pagina ────────────────────────────────────────────── */

/* Intro tekst bovenaan */
.habits-intro {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 600px;
  margin-bottom: 32px;
}

.habits-intro em {
  color: var(--habit);
  font-style: italic;
  font-family: 'Playfair Display', serif;
}

/* Identiteitsblok */
.identity-block {
  margin-bottom: 28px;
  animation: fadeInUp 0.4s ease both;
}

.identity-block:nth-child(2) { animation-delay: 0.05s; }
.identity-block:nth-child(3) { animation-delay: 0.10s; }
.identity-block:nth-child(4) { animation-delay: 0.15s; }
.identity-block:nth-child(5) { animation-delay: 0.20s; }
.identity-block:nth-child(6) { animation-delay: 0.25s; }
.identity-block:nth-child(7) { animation-delay: 0.30s; }
.identity-block:nth-child(8) { animation-delay: 0.35s; }
.identity-block:nth-child(9) { animation-delay: 0.40s; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.identity-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 14px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.identity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--habit);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--habit-glow);
}

.identity-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
  flex: 1;
}

.identity-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--transition);
}

.identity-block:hover .identity-actions {
  opacity: 1;
}

.identity-action-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.identity-action-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* Habit kaarten binnen identiteit */
.habits-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.habit-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  position: relative;
}

.habit-card:hover {
  border-color: rgba(106, 143, 200, 0.25);
  background: var(--bg-elevated);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

/* Icoon links */
.habit-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: var(--habit-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  margin-top: 1px;
}

/* Inhoud */
.habit-card-body {
  flex: 1;
  min-width: 0;
}

.habit-card-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 2px;
}

.habit-card-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 4px;
}

.habit-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.habit-card-freq {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--habit);
  background: var(--habit-glow);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Acties rechts */
.habit-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
  margin-top: 2px;
}

.habit-card:hover .habit-card-actions {
  opacity: 1;
}

.habit-action-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  transition: color var(--transition), background var(--transition);
}

.habit-action-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.habit-action-btn.danger:hover {
  color: var(--danger);
  background: rgba(200, 96, 96, 0.08);
}

/* Zonder identiteit blok */
.identity-block.uncategorized .identity-title {
  color: var(--muted);
  font-style: italic;
}

.identity-block.uncategorized .identity-dot {
  background: var(--muted);
  opacity: 0.4;
  box-shadow: none;
}

/* Toevoeg knop */
.add-habit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  width: 100%;
  margin-top: 6px;
}

.add-habit-btn:hover {
  color: var(--habit);
  border-color: var(--habit);
  background: var(--habit-glow);
}

.add-identity-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: 'DM Sans', sans-serif;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  width: 100%;
  margin-top: 12px;
}

.add-identity-btn:hover {
  color: var(--habit);
  border-color: var(--habit);
  background: var(--habit-glow);
}

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 5, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}

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

.modal-header {
  padding: 20px 24px 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.modal-field input,
.modal-field textarea,
.modal-field select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition);
}

.modal-field input:focus,
.modal-field textarea:focus,
.modal-field select:focus {
  border-color: var(--habit);
}

.modal-field textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.modal-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7060' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.modal-field select option {
  background: var(--bg-card);
  color: var(--text);
}

.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-footer .btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: 'DM Sans', sans-serif;
  transition: background var(--transition), color var(--transition);
}

.modal-footer .btn-primary {
  background: var(--habit);
  color: var(--bg);
}

.modal-footer .btn-primary:hover {
  background: #7da0d4;
}

.modal-footer .btn-ghost {
  background: none;
  color: var(--muted);
}

.modal-footer .btn-ghost:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.modal-footer .btn-danger {
  background: none;
  color: var(--danger);
}

.modal-footer .btn-danger:hover {
  background: rgba(200, 96, 96, 0.1);
}

/* Vandaag-afvinken status */
.habit-card.today-done {
  border-color: rgba(106, 143, 200, 0.2);
  background: rgba(106, 143, 200, 0.04);
}

.habit-card.today-done .habit-card-title {
  color: var(--habit);
}

.habit-card.today-done .habit-icon {
  background: rgba(106, 143, 200, 0.15);
}

/* Voortgang label */
.section-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--habit);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Pagina titel */
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

/* ─── Agenda ─────────────────────────────────────────────────────── */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.event-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.event-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 500;
  min-width: 44px;
  flex-shrink: 0;
}

.event-time.allday-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-width: 44px;
}

.event-title {
  color: var(--text-dim);
  line-height: 1.35;
}

.event-empty {
  font-size: 0.83rem;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

/* ─── Agenda meer-toggle ─────────────────────────────────────────── */
.agenda-meer-wrapper {
  margin-top: 2px;
}

.agenda-meer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 13px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.agenda-meer-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.agenda-meer-chevron {
  display: inline-block;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.agenda-meer-lijst {
  display: none;
  flex-direction: column;
  gap: 5px;
  margin-top: 5px;
}

.agenda-meer-lijst.open {
  display: flex;
}

/* ─── Inbox ──────────────────────────────────────────────────────── */
.inbox-capture {
  margin-bottom: 8px;
}

.inbox-capture-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition), border-style var(--transition);
}

.inbox-capture-input:focus {
  border-color: var(--accent);
  border-style: solid;
}

.inbox-capture-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.inbox-content {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.inbox-time {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
}

.inbox-item { cursor: pointer; }

.inbox-meer {
  display: block;
  text-align: center;
  padding: 8px;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.inbox-meer:hover {
  opacity: 1;
}

/* ─── Journal (recente grid + tijdlijn) ──────────────────────────── */
.journal-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.journal-day {
  max-width: 780px;
  margin: 0 auto 28px;
}

/* Datum-header — subtiel, scheidt dagen zonder te schreeuwen */
.journal-day-header {
  font-family: 'DM Sans', sans-serif;
  font-style: normal;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 400;
  color: var(--text-dim);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.journal-block {
  display: flex;
  gap: 20px;
  margin-bottom: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.journal-block:hover {
  background: var(--bg-elevated);
}

.journal-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
  min-width: 38px;
  padding-top: 10px;
  flex-shrink: 0;
}

.journal-block-body {
  flex: 1;
  min-width: 0;
  position: relative;
}

.journal-excerpt {
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.8;
}

/* Headings in journal excerpts */
.journal-excerpt .content-heading {
  margin-top: 4px;
  margin-bottom: 6px;
}

/* Afbeeldingen in het journaaloverzicht iets kleiner */
.journal-excerpt .content-afbeelding {
  max-height: 300px;
}

/* Zorg dat de tekst in het overzicht de juiste kleur heeft */
.journal-excerpt .content-alinea,
.journal-excerpt .content-bullet {
  color: var(--text-dim);
}

.journal-read-more {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 5px;
  opacity: 0.7;
}

/* ─── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  border-color: rgba(255, 255, 255, 0.07);
}

.card-meta {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.card-badge {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

.card-excerpt {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-top: 6px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* ─── Taken (taken.html) ─────────────────────────────────────────── */
/* ─── Task items — Todoist / inbox-stijl ─────────────────────────── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  margin-bottom: 0;
  transition: opacity 0.3s, background var(--transition);
}

.task-item:last-child {
  border-bottom: none;
}

.task-item.done-flash {
  background: rgba(107, 168, 107, 0.06);
}

.task-item.fading-out {
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.task-item:hover .taak-verwijder-btn {
  opacity: 1;
}

.taak-verwijder-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  margin-top: 1px;
}

.taak-verwijder-btn:hover {
  color: var(--danger);
}

/* Circulaire checkbox — Todoist-stijl */
.task-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  cursor: pointer;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0;
  color: transparent;
  flex-shrink: 0;
}

.task-checkbox:hover {
  background: var(--accent);
}

.task-checkbox:hover::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.task-done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 0.9rem;
  font-style: normal;
  color: var(--text);
  line-height: 1.5;
}

.task-title.completed {
  text-decoration: line-through;
  color: var(--muted);
}

/* Due date rechts uitlijnen */
.task-due-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  margin-top: 2px;
}

.task-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.task-add-row .form-input {
  flex: 1;
}

/* ─── Badges / due dates ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  border: none;
  background: transparent;
  white-space: nowrap;
}

.badge-open {
  color: var(--muted);
}

.badge-open.bewerkbaar {
  cursor: pointer;
}

.badge-open.bewerkbaar:hover {
  color: var(--accent-light);
}

.badge-done {
  color: var(--muted);
  font-style: italic;
}

.badge-overdue {
  color: var(--danger);
  font-weight: 600;
}

.badge-due {
  color: var(--accent);
  font-weight: 600;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid rgba(200, 134, 90, 0.2);
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 7px;
  margin-left: 7px;
}

/* ─── Knoppen ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
  font-family: 'DM Sans', inherit;
  text-decoration: none;
  line-height: 1;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #0e0c09;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-dim);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-mip-done {
  background: var(--mip-glow);
  color: var(--mip);
  border-color: rgba(212, 168, 78, 0.3);
}

.btn-mip-done:hover {
  background: rgba(212, 168, 78, 0.22);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: rgba(200, 96, 96, 0.1);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.77rem;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ─── Formulieren ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', inherit;
  font-size: 0.875rem;
  padding: 9px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus,
.form-textarea:focus {
  border-color: rgba(200, 134, 90, 0.4);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.55;
}

/* ─── Zoekbalk ───────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 32px;
  max-width: 720px;
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'DM Sans', inherit;
  font-size: 0.875rem;
  outline: none;
}

.search-bar input::placeholder {
  color: var(--muted);
}

.search-icon {
  color: var(--muted);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ─── Tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: 'DM Sans', inherit;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-dim);
}

.tab-btn.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--bg-elevated);
  border-radius: 10px;
  font-size: 0.7rem;
  margin-left: 5px;
}

/* ─── Wikilinks ──────────────────────────────────────────────────── */
.wikilink {
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 134, 90, 0.3);
  transition: border-color var(--transition);
}

.wikilink:hover {
  border-color: var(--accent);
}

/* ─── Externe links ──────────────────────────────────────────────── */
.externe-link {
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px dashed rgba(200, 134, 90, 0.3);
  transition: border-color var(--transition), color var(--transition);
  word-break: break-all;
}

.externe-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── Backlinks ──────────────────────────────────────────────────── */
.backlinks {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.backlinks-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.backlink-item {
  font-size: 0.83rem;
  color: var(--accent-light);
  text-decoration: none;
  display: inline-block;
  margin-right: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(200, 134, 90, 0.3);
}

.backlink-item:hover {
  border-color: var(--accent);
}

/* Linked references: backlinks met content als cards */
.backlink-ref {
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.15s ease;
}

.backlink-ref:hover {
  border-color: var(--accent);
}

.backlink-ref-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}

.backlink-ref-toggle {
  font-size: 0.5rem;
  color: var(--muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}

.backlink-ref.open .backlink-ref-toggle {
  transform: rotate(90deg);
}

.backlink-ref-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 134, 90, 0.25);
}

.backlink-ref-link:hover {
  border-color: var(--accent);
}

.backlink-ref-content {
  display: none;
  padding: 4px 12px 12px 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-light);
}

.backlink-ref.open .backlink-ref-content {
  display: block;
}

/* Beperk geneste outline-styling in backlinks */
.backlink-ref-content .outline-bullet {
  font-size: 0.88rem;
  line-height: 1.6;
}

.backlink-ref-content .content-alinea {
  font-size: 0.88rem;
}

/* Meer laden knop */
.backlinks-meer-btn {
  margin-top: 8px;
  width: 100%;
  text-align: center;
}

/* ─── Journaal schrijfsectie ─────────────────────────────────────── */
.journaal-schrijf-sectie {
  max-width: 780px;
  margin: 0 auto 24px;
  padding-bottom: 16px;
  border-bottom: none;
}

/* Schrijfblok: flex-layout met klok links, textarea rechts — zelfde als journal-block */
.journaal-schrijf-blok {
  display: flex;
  gap: 20px;
  padding: 14px 16px;
}

.journaal-schrijf-body {
  flex: 1;
  min-width: 0;
}

/* Live klok: updatet elke minuut */
.journaal-live-klok {
  padding-top: 3px;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.journaal-schrijf-sectie:focus-within .journaal-live-klok {
  opacity: 1;
}

/* Datum kop boven het schrijfveld — zelfde stijl als page-title */
.journaal-datum-kop {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: normal;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: normal;
  text-transform: none;
}

/* De schrijftextarea zelf — zo weinig chrome mogelijk */
.journaal-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  line-height: 1.8;
  resize: none;
  overflow: hidden;
  min-height: 88px;
  padding: 0;
  transition: min-height 0.2s ease;
  caret-color: var(--accent);
}

.journaal-textarea::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* Footer: upload-knop + woordteller + hint + opslaan — verschijnt bij focus */
.journaal-schrijf-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  margin-top: 16px;
  border-top: 1px solid var(--border-light);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.journaal-schrijf-sectie:focus-within .journaal-schrijf-footer {
  opacity: 1;
}

.journaal-schrijf-footer-links,
.journaal-schrijf-footer-rechts {
  display: flex;
  align-items: center;
  gap: 10px;
}

.journaal-woordteller {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

.journaal-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.7;
}

/* Upload-knop in de schrijf-footer */
.journaal-afbeelding-btn {
  padding: 4px 7px;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.journaal-afbeelding-btn:hover {
  opacity: 1;
}

/* Drag-over staat op de textarea */
.journaal-textarea.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* ─── Rijke content rendering ─────────────────────────────────────── */

/* Outliner boomstructuur */
.outline-item {
  margin: 1px 0;
}

.outline-bullet {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.75;
  font-size: 0.95rem;
  color: var(--text);
}

.outline-tekst {
  flex: 1;
  min-width: 0;
}

.outline-toggle {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-top: 0.4em;
  border-radius: 3px;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
}

.outline-toggle:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

.outline-toggle.open {
  transform: rotate(90deg);
}

.outline-children {
  padding-left: 1.2rem;
  display: none;
}

.outline-children.open {
  display: block;
}

/* Bullet punt (voor bladeren zonder kinderen) */
.bullet-punt {
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.58em;
  opacity: 0.8;
}

/* Oud formaat compatibiliteit */
.content-bullet {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 3px 0;
  line-height: 1.75;
  font-size: 0.95rem;
  color: var(--text);
}

/* Content headings (Logseq #, ##, ###, ####) */
.content-heading {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
  padding: 0;
  font-weight: 600;
}

.content-h1 {
  font-size: 1.5rem;
  margin: 1.2em 0 0.5em;
  color: var(--accent-light);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
}

.content-h2 {
  font-size: 1.25rem;
  margin: 1em 0 0.4em;
  color: var(--accent);
}

.content-h3 {
  font-size: 1.08rem;
  margin: 0.8em 0 0.3em;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.content-h4 {
  font-size: 0.95rem;
  margin: 0.6em 0 0.2em;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: 'DM Sans', sans-serif;
}

/* Eerste heading in content: geen top-margin */
.content-full > .content-heading:first-child {
  margin-top: 0;
}

/* Normale alinea in rijke content */
.content-alinea {
  margin: 4px 0;
  line-height: 1.75;
  font-size: 0.95rem;
  color: var(--text);
}

/* Lege regel-afstand */
.content-leegregel {
  height: 0.6em;
}

/* Inline afbeeldingen */
.content-afbeelding-wrapper {
  margin: 12px 0;
}

.content-afbeelding {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.content-afbeelding:hover {
  opacity: 0.92;
}

/* Lightbox: klik op afbeelding om te vergroten */
.afbeelding-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  cursor: zoom-out;
  padding: 24px;
}

.afbeelding-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

/* Focus-modus: sidebar dimt zodat de aandacht op de tekst ligt */
.journaal-focus .sidebar {
  opacity: 0.12;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.sidebar {
  transition: transform var(--transition), opacity 0.4s ease;
}

/* ─── Back button ────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'DM Sans', inherit;
  padding: 0;
  transition: color var(--transition);
}

.back-btn:hover {
  color: var(--text-dim);
}

/* ─── Detail navigatie ───────────────────────────────────────────── */
.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.detail-acties {
  display: flex;
  gap: 8px;
}

/* ─── Detail datum — als een hoofdstuk-opening ───────────────────── */
.detail-datum {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: 0.01em;
}

/* ─── Detail leesinhoud ──────────────────────────────────────────── */
.detail-inhoud {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
  word-break: break-word;
  max-width: 680px;
}

/* ─── Detail bewerkmode ──────────────────────────────────────────── */
.journaal-edit-textarea {
  width: 100%;
  max-width: 660px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  line-height: 1.85;
  resize: none;
  overflow: hidden;
  min-height: 280px;
  padding: 0 0 16px;
  caret-color: var(--accent);
}

.journaal-edit-textarea:focus {
  border-bottom-color: var(--accent);
}

/* ─── Volledige content (legacy) ─────────────────────────────────── */
.content-full {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Loading / Empty / Error ────────────────────────────────────── */
.loading {
  color: var(--muted);
  font-size: 0.83rem;
  padding: 6px 0;
  font-style: italic;
}

.empty-state {
  color: var(--muted);
  font-size: 0.83rem;
  font-style: italic;
  padding: 4px 0;
}

.error-msg {
  padding: 12px 16px;
  background: rgba(200, 96, 96, 0.08);
  border: 1px solid rgba(200, 96, 96, 0.2);
  border-radius: var(--radius-sm);
  color: #d08080;
  font-size: 0.83rem;
}

/* ─── Undo Toast ─────────────────────────────────────────────────── */
.undo-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  min-width: 260px;
  max-width: 380px;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.undo-toast-bericht {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text);
}

.undo-toast-btn {
  background: var(--accent);
  color: #0e0c09;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'DM Sans', inherit;
}

.undo-toast-btn:hover {
  opacity: 0.85;
}

.undo-toast-balk {
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 8px;
}

.undo-toast-voortgang {
  height: 100%;
  width: 100%;
  background: var(--accent);
  animation: toast-voortgang linear forwards;
}

@keyframes toast-voortgang {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ─── Inline bewerken ────────────────────────────────────────────── */
.bewerkbaar {
  cursor: text;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.12s;
}

.bewerkbaar:hover {
  background: var(--bg-hover);
}

.bewerk-wrapper {
  width: 100%;
}

.bewerk-input {
  width: 100%;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid rgba(200, 134, 90, 0.3);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: 'DM Sans', inherit;
  font-size: inherit;
  line-height: 1.4;
}

.bewerk-input:focus {
  outline: none;
  border-color: rgba(200, 134, 90, 0.5);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.bewerk-textarea {
  resize: vertical;
  min-height: 80px;
}

.bewerk-acties {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.bewerk-acties .btn {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* ─── Hamburger (altijd zichtbaar — Logseq-stijl) ────────────────── */
.hamburger {
  display: flex;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* Home-knop: subtiel huisje rechts van hamburger — alleen buiten dashboard */
.home-btn {
  position: fixed;
  top: 14px;
  left: 54px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 30px;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.home-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .grid-right {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .grid-right .section {
    flex: 1;
    min-width: 240px;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 60px 20px 60px;
  }

  .page-date {
    font-size: 1.6rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .journal-recent-grid {
    grid-template-columns: 1fr;
  }

  .grid-right {
    flex-direction: column;
  }

  .habits-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Mode-switcher verbergen op mobiel — navigatie via bottom nav */
  .mode-switcher {
    display: none !important;
  }

  /* Grotere fonts op mobiel voor leesbaarheid */
  html {
    font-size: 18px;
  }

  .page-title {
    font-size: 1.6rem;
  }
}

/* ─── Mode-switcher (rechtsboven, Shosho-stijl) ─────────────────── */
.mode-switcher {
  position: fixed;
  top: 14px;
  right: 24px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
}

.mode-pill {
  padding: 5px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  border-radius: 17px;
  transition: color 0.18s ease, background 0.18s ease;
  cursor: pointer;
  position: relative;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.mode-pill:hover {
  color: var(--text-dim);
}

.mode-pill.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  font-weight: 500;
}

/* Manage dropdown */
.mode-manage {
  position: relative;
  user-select: none;
}

.mode-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: -4px;
  padding-top: 6px;
  z-index: 210;
}

.mode-dropdown-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.mode-manage:hover .mode-dropdown,
.mode-manage.open .mode-dropdown {
  display: block;
}

.mode-dropdown-inner a {
  display: block;
  padding: 8px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 400;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-dropdown-inner a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.mode-dropdown-inner a.active {
  color: var(--accent-light);
}

/* ─── ⌘K Zoek-overlay ───────────────────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  animation: overlayFadeIn 0.15s ease;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-overlay-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: searchCardIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes searchCardIn {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.search-overlay-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 300;
  padding: 16px 20px;
  outline: none;
}

.search-overlay-input::placeholder {
  color: var(--muted);
}

.search-overlay-results {
  max-height: 360px;
  overflow-y: auto;
}

.search-overlay-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.12s ease;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
}

.search-overlay-item:last-child {
  border-bottom: none;
}

.search-overlay-item:hover,
.search-overlay-item.active {
  background: var(--bg-hover);
  color: var(--text);
}

.search-overlay-type {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  min-width: 52px;
  font-weight: 500;
}

.search-overlay-titel {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-overlay-snippet {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-overlay-leeg {
  padding: 24px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.search-overlay-meer {
  display: block;
  padding: 12px 20px;
  text-align: center;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  background: var(--accent-glow);
  border-top: 1px solid var(--border-light);
  transition: all 0.12s ease;
  cursor: pointer;
  font-weight: 500;
}

.search-overlay-meer:hover {
  background: var(--bg-hover);
  color: var(--accent-light);
}

.search-overlay-hint {
  padding: 10px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  border-top: 1px solid var(--border-light);
  font-family: 'JetBrains Mono', monospace;
}

/* Vandaag entries sluiten naadloos aan op het schrijfveld */
.journal-day-vandaag {
  margin-top: -8px;
  border-top: none;
}

/* ─── Journal inline editing ─────────────────────────────────────── */
.journal-entry-content {
  position: relative;
  border-radius: var(--radius-sm);
  transition: background 0.18s ease;
}

.journal-entry-content:hover {
  background: var(--bg-elevated);
  cursor: text;
}

.journal-entry-edit {
  width: 100%;
  background: transparent;
  border: none;
  border-left: 2px solid var(--accent);
  border-radius: 0;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.7;
  padding: 4px 12px;
  resize: none;
  outline: none;
  min-height: 40px;
  transition: border-color 0.2s ease;
}

.journal-entry-edit:focus {
  border-left-color: var(--accent-light);
}

.journal-entry-edit.unsaved {
  border-color: var(--accent);
}

.journal-save-indicator {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 0.7rem;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s ease;
  font-family: 'JetBrains Mono', monospace;
}

.journal-save-indicator.visible {
  opacity: 1;
}

/* Entry acties (verwijder-knop) — verschijnen bij hover */
.journal-entry-acties {
  position: absolute;
  right: 4px;
  top: 4px;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.journal-block:hover .journal-entry-acties {
  opacity: 1;
}

.journal-entry-actie-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  padding: 3px 7px;
  font-size: 0.7rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.journal-entry-actie-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ─── WYSIWYG Editor (Contenteditable) ─────────────────────────── */
.rich-editor {
  position: relative;
}

/* Floating selection toolbar — Shosho-stijl, verschijnt bij tekstselectie */
.floating-toolbar {
  position: fixed;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 6px;
  background: #1a1816;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.floating-toolbar.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.floating-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: #d4cfc6;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  line-height: 1;
}

.floating-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.floating-toolbar-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.95);
}

.floating-toolbar-btn strong {
  font-weight: 700;
  font-size: 0.88rem;
}

.floating-toolbar-btn em {
  font-style: italic;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.88rem;
}

.floating-toolbar-btn small {
  font-size: 0.68rem;
}

.floating-toolbar-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 3px;
  flex-shrink: 0;
}

/* Light mode: toolbar blijft donker voor contrast */
[data-theme="light"] .floating-toolbar {
  background: #1a1816;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Legacy toolbar (verborgen, backward-compatible) */
.editor-toolbar {
  display: none;
}

.toolbar-link-icon {
  font-size: 0.78rem;
}

/* Contenteditable editor — clean Shosho-achtige stijl */
.ce-editor {
  max-width: 680px;
  min-height: 60px;
  padding: 8px 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  outline: none;
  caret-color: var(--accent);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* CE editor in journal capture card: extra padding */
.journal-capture .ce-editor {
  padding: 24px 28px 16px;
}

/* CE editor in journal schrijfsectie */
.journaal-schrijf-sectie .ce-editor {
  padding: 4px 0;
}

/* Placeholder bij lege editor */
.ce-editor.is-leeg::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-style: italic;
  pointer-events: none;
  position: absolute;
}

/* Headings in de editor */
.ce-editor h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 1em 0 0.3em;
  color: var(--text);
  line-height: 1.3;
}

.ce-editor h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.12rem;
  font-weight: 600;
  margin: 0.8em 0 0.2em;
  color: var(--text);
  line-height: 1.4;
}

.ce-editor h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin: 0.6em 0 0.15em;
  color: var(--text);
}

/* Paragrafen */
.ce-editor p {
  margin: 0 0 0.15em;
}

/* Bullet lijsten */
.ce-editor ul {
  margin: 0.2em 0;
  padding-left: 1.4em;
}

.ce-editor li {
  margin: 1px 0;
}

/* Geneste lijsten: subtiel inspringen */
.ce-editor ul ul {
  margin: 0;
}

/* Wikilinks: gestileerde pills */
.ce-wikilink {
  display: inline;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  cursor: default;
  user-select: all;
  white-space: nowrap;
  transition: background var(--transition);
}

.ce-wikilink:hover {
  background: rgba(200, 134, 90, 0.2);
}

/* Afbeeldingen in de editor */
.ce-editor img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  display: block;
}

/* Links in de editor */
.ce-editor a.ce-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Vet en cursief */
.ce-editor strong,
.ce-editor b {
  font-weight: 600;
}

.ce-editor em,
.ce-editor i {
  font-style: italic;
}

/* Leesweergave: max-width + ademruimte */
.detail-inhoud,
.content-full {
  max-width: 680px;
  line-height: 1.85;
  font-size: 1rem;
}

/* Detail view: meer ruimte */
.detail-nav {
  margin-bottom: 12px;
}

.detail-datum,
.detail-meta-header {
  margin-bottom: 32px;
}

/* Bewerk-formulier ook beperkte breedte */
#detail-bewerk-form {
  max-width: 720px;
}

/* Notitie formulier beperkte breedte */
#nieuwe-notitie-form {
  max-width: 720px;
}

/* ─── [[ Autocomplete Popup ─────────────────────────────────────── */
.ac-popup {
  position: fixed;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition);
}

.ac-item:hover,
.ac-item-actief {
  background: var(--bg-hover);
}

.ac-item-actief {
  color: var(--accent-light);
}

.ac-item-titel {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item-actief .ac-item-titel {
  color: var(--accent-light);
}

.ac-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent-glow);
  color: var(--accent);
  margin-left: 8px;
  flex-shrink: 0;
}

/* ─── PDF Viewer ────────────────────────────────────────────────── */
.pdf-wrapper {
  margin: 12px 0;
}

.pdf-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
  padding: 2px 4px;
  border-radius: 3px;
  display: inline-block;
}

.pdf-link:hover {
  color: var(--accent-light);
  background: var(--accent-glow);
}

.pdf-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.pdf-viewer-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
  height: 90vh;
  max-height: 800px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pdf-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pdf-viewer-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-viewer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
  flex-shrink: 0;
}

.pdf-btn {
  padding: 6px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
  white-space: nowrap;
}

.pdf-btn:hover:not(:disabled) {
  background: var(--accent-glow);
  color: var(--accent-light);
  border-color: var(--accent);
}

.pdf-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#pdf-page-info {
  color: var(--text-dim);
  font-size: 0.85rem;
  min-width: 120px;
  text-align: center;
}

.pdf-viewer-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
}

#pdf-canvas {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  max-width: 100%;
  height: auto;
}

.pdf-error {
  color: var(--danger);
  padding: 20px;
  text-align: center;
}

/* ─── Bottom Navigation (mobiel) ───────────────────────────────── */
.bottom-nav-desktop-hidden {
  display: none;
}

@media (max-width: 768px) {
  .bottom-nav-desktop-hidden {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
  }

  .bottom-nav-desktop-hidden a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    padding: 6px 16px;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-desktop-hidden svg {
    width: 21px;
    height: 21px;
    stroke: var(--muted);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .bottom-nav-desktop-hidden .nav-txt {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.58rem;
    color: var(--muted);
    letter-spacing: 0.02em;
  }

  .bottom-nav-desktop-hidden a.actief svg { stroke: var(--accent); }
  .bottom-nav-desktop-hidden a.actief .nav-txt { color: var(--accent); }

  /* Padding onderaan body zodat content niet achter de nav verdwijnt */
  body {
    padding-bottom: 64px;
  }
}
