/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --sidebar-bg: #ffffff;
  --rail-bg: #f2f3f5;
  --rail-hover: #e7e8eb;
  --rail-icon: #6b7280;
  --rail-active-bg: #ffffff;
  --border: #e5e7eb;
  --border-soft: #eef0f2;
  --text: #1a1f26;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --accent: #2b7dfa;
  --accent-soft: #eaf2ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --orange: #ea7f1a;
  --orange-soft: #fff5e9;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --yellow: #b45309;
  --yellow-soft: #fffbeb;
  --gray: #4b5563;
  --gray-soft: #f3f4f6;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .12);
  --sidebar-w: 252px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a { color: inherit; }
button { font-family: inherit; border: none; background: none; padding: 0; cursor: pointer; color: inherit; }
svg { display: block; }

/* ==========================================================================
   Shell layout
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--rail-w, 68px) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
  background: var(--rail-bg);
}

/* ---- Top strip: spans the rail + side-panel width, holds the workspace switcher */
.nav-topstrip {
  grid-column: 1;
  grid-row: 1;
  background: linear-gradient(
82deg, #f2f3f5, #ffffff);
  border-bottom: 0px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 7;
}

.workspace-badge {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.topbar-brand {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 240px;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-topstrip .workspace-name {
  font-weight: 600;
  font-size: 19.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-topstrip .nav-icon {
  color: var(--text-tertiary);
  width: 15px;
  height: 15px;
  display: flex;
}

/* ---- Rail: slim icon-only far-left column -------------------------- */
.rail {
  grid-column: 1;
  grid-row: 2;
  width: var(--rail-w, 68px);
  background: var(--rail-bg);
  height: calc(100vh - var(--topbar-h));
  position: sticky;
  top: var(--topbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 4px;
}

/* Scheiding tussen werkomgeving-brede functies (Dashboard/Relations/Finance)
   en persoonlijke functies (Tasks/Contacts/Inbox) in de rail. */
.rail-divider {
  width: 28px;
  height: 1px;
  background: var(--border);
  margin: 6px 0;
  flex: 0 0 auto;
}

.rail-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7ed0ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 auto;
}

.rail-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rail-icon, #9195a1);
  text-decoration: none;
  position: relative;
}

.rail-icon-btn:hover { background: var(--rail-hover); color: var(--text); }
.rail-icon-btn.active { background: var(--rail-active-bg); color: var(--text); box-shadow: var(--shadow-sm); }

.rail-icon-btn .rail-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rail-bg);
}

.rail-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rail-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  border: 2px solid transparent;
  overflow: hidden;
}

.rail-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-avatar.active { border-color: var(--accent); }

/* ---- Side panel: contextual second column --------------------------- */
.side-panel {
  position: fixed;
  left: var(--rail-w, 68px);
  top: var(--topbar-h);
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  z-index: 40;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  border-top-right-radius: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s;
  pointer-events: none;
}

.app-shell.panel-open .side-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
  pointer-events: auto;
}

.side-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 14px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 1px solid var(--border-soft);
}

.side-panel-header .nav-icon { color: var(--text); }

.side-panel-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.side-panel-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  padding: 12px 10px 6px;
}

.nav-child {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
}

.nav-child-row { display: flex; align-items: center; gap: 2px; }
.nav-child-row .nav-child { flex: 1; min-width: 0; }

.nav-child-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.nav-child-delete {
  width: 24px; height: 24px; border-radius: var(--radius-sm); border: none; background: none;
  color: var(--text-tertiary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; flex: 0 0 auto;
}
.nav-child-row:hover .nav-child-delete { opacity: 1; }
.nav-child-delete:hover { background: var(--red-soft); color: var(--red); }

.nav-child:hover { background: var(--gray-soft); color: var(--text); }
.nav-child.active { background: var(--gray-soft); color: var(--text); font-weight: 600; }

.nav-child .nav-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-child.active .nav-icon { color: var(--text); }

.side-panel-bottom {
  border-top: 1px solid var(--border);
  padding: 8px;
}

.side-panel-bottom .nav-child { color: var(--text-secondary); }

/* ==========================================================================
   Main area / topbar
   ========================================================================== */
.main-area {
  grid-column: 2;
  grid-row: 1 / 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-search {
  flex: 1;
  display: flex;
  justify-content: center;
}

.topbar-search-box {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-tertiary);
  font-size: 13px;
  background: var(--bg);
}

.topbar-search-box.has-search { position: relative; background: var(--surface); padding: 0 12px; }
.topbar-search-box .ts-icon { display: inline-flex; flex: 0 0 auto; color: var(--text-tertiary); }
.topbar-search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 8px 0; font-size: 13.5px; color: var(--text); font-family: inherit; }
.topbar-search-box.has-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 70vh; overflow-y: auto; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px;
}
.search-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.search-row.active { background: var(--gray-soft); }
.search-row-icon { display: inline-flex; flex: 0 0 auto; color: var(--text-secondary); }
.search-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.search-row-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-row-sub { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-row .lv-pill { flex: 0 0 auto; }
.search-empty { padding: 14px; font-size: 13px; color: var(--text-secondary); text-align: center; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover { background: var(--gray-soft); }

/* ---- Language switch: sits right next to the notification bell ---- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border-radius: 999px;
  background: var(--gray-soft);
  cursor: pointer;
  flex: 0 0 auto;
}

.lang-switch-opt {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text-tertiary);
}

.lang-switch-opt.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.page-content {
  padding: 28px 32px 60px;
  max-width: 1180px;
  width: 100%;
}

/* ==========================================================================
   Page header
   ========================================================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title-icon {
  width: 22px;
  height: 22px;
  background: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-title h1 {
  font-size: 21px;
  font-weight: 600;
  margin: 0;
}

.count-badge {
  background: var(--gray-soft);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}

.page-header-actions { display: flex; align-items: center; gap: 10px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab {
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--gray-soft); }

.btn-primary {
  background: #ffffff;
  border-color: var(--accent);
  color: #2b7dfa;
}

.btn-primary:hover { background: #1c6ce8; color: #ffffff; }

.btn-danger { color: var(--red); border-color: var(--red-soft); }
.btn-danger:hover { background: var(--red-soft); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ==========================================================================
   List view (Plane-style rows)
   ========================================================================== */
.lv-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lv-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.lv-search {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  background: var(--bg);
}

.lv-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  width: 100%;
  color: var(--text);
}

.lv-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.lv-shell .lv-group:first-child .lv-group-header { border-top: none; }

.lv-group-header .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid currentColor;
  flex: 0 0 auto;
}

.lv-group-count { color: var(--text-tertiary); font-weight: 500; }

.lv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  color: inherit;
  background: var(--surface);
}

.lv-row:last-child { border-bottom: none; }
.lv-row:hover { background: #f9fafb; }

.lv-row-melding .lv-row-icon { transition: color .12s ease; }
.lv-row-melding.melding-orange:hover .lv-row-icon { color: var(--orange); }
.lv-row-melding.melding-green:hover .lv-row-icon { color: var(--green); }
.lv-row-melding.melding-blue:hover .lv-row-icon { color: var(--accent); }
.lv-row-melding.melding-red:hover .lv-row-icon { color: var(--red); }
.lv-row-melding.melding-purple:hover .lv-row-icon { color: var(--purple); }
.lv-row-melding.melding-yellow:hover .lv-row-icon { color: var(--yellow); }
.lv-row-melding.melding-gray:hover .lv-row-icon { color: var(--gray); }
.lv-row-melding.melding-custom:hover .lv-row-icon { color: var(--pl-c); }

.lv-row-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lv-row-id {
  font-size: 12px;
  color: var(--text-tertiary);
  flex: 0 0 auto;
  min-width: 46px;
}

.lv-row-title {
  flex: 1;
  min-width: 120px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv-row-sub {
  color: var(--text-tertiary);
  font-weight: 400;
  margin-left: 6px;
}

.lv-row-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}

.lv-avatars {
  display: flex;
  align-items: center;
}

.lv-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  border: 2px solid var(--surface);
  margin-left: -7px;
  overflow: hidden;
  flex: 0 0 auto;
}

.lv-avatar:first-child { margin-left: 0; }
.lv-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Taak-toegewezene: voornaam + achternaam-initiaal, dus een pil i.p.v. een
   vaste cirkel (de tekst past niet in 24px). */
.lv-avatar-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}

.lv-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.lv-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}

.lv-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.lv-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 74px;
}

.lv-date svg { width: 14px; height: 14px; }
.lv-date.is-past { color: var(--red); }
.lv-date.is-today { color: var(--orange); }

.lv-priority {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 16px;
  height: 14px;
}

.lv-priority i {
  width: 3px;
  border-radius: 1px;
  background: var(--border);
  display: block;
}

.lv-priority i:nth-child(1) { height: 40%; }
.lv-priority i:nth-child(2) { height: 70%; }
.lv-priority i:nth-child(3) { height: 100%; }

.lv-priority.urgent i { background: var(--red); }
.lv-priority.high i:nth-child(-n+3) { background: var(--orange); }
.lv-priority.medium i:nth-child(-n+2) { background: var(--yellow); }
.lv-priority.low i:nth-child(1) { background: var(--text-tertiary); }

.lv-row-menu {
  color: var(--text-tertiary);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.lv-row-menu:hover { background: var(--gray-soft); }

.filter-select {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.lv-status-select {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.lv-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13.5px;
}

/* group-header dot color variants (text/icon color only, no fill background) */
.dot-blue { color: var(--accent); }
.dot-purple { color: var(--purple); }
.dot-orange { color: var(--orange); }
.dot-green { color: var(--green); }
.dot-red { color: var(--red); }
.dot-yellow { color: var(--yellow); }
.dot-gray { color: var(--gray); }

/* pill color variants */
.pill-blue { background: var(--accent-soft); color: var(--accent); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }
.pill-orange { background: var(--orange-soft); color: var(--orange); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill-gray { background: var(--gray-soft); color: var(--gray); }

/* ==========================================================================
   KPI cards (dashboard overview)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-split {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.kpi-split-item { white-space: nowrap; }

.kpi-split-item .kpi-split-value { font-size: 16px; font-weight: 700; }
.kpi-split-item .kpi-split-label { font-size: 12px; color: var(--text-tertiary); }

.section-heading {
  font-size: 15px;
  font-weight: 600;
  margin: 28px 0 12px;
}

.dropdown-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 190px;
  padding: 4px;
  z-index: 150;
}
.dropdown-item {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
}
.dropdown-item:hover { background: var(--gray-soft); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-soft); }

/* Voorraad-suggesties bij het typen van een factuur-/inkoopfactuurregel.
   position:fixed + JS-berekende coördinaten (zoals .dropdown-menu) — de
   regel-rij zelf zit in een overflow:hidden container (.line-items, voor
   de afgeronde hoeken), dus een geneste absolute box zou daarin geclipt
   worden. Top/left/width worden per instantie in JS gezet. */
.lv-suggest-box {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 250;
  max-height: 220px;
  overflow-y: auto;
}
.lv-suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
}
.lv-suggest-item:hover { background: var(--gray-soft); }

/* Meldingenbelletje: tot 3 gekleurde bolletjes (bericht/taak/verzoek). */
.notif-dots {
  position: absolute;
  top: 3px;
  right: 3px;
  display: flex;
  gap: 2px;
}
.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: 1.5px solid var(--surface);
  flex: 0 0 auto;
}
.notif-dot-blue { background: var(--accent); }
.notif-dot-red { background: var(--red); }
.notif-dot-green { background: var(--green); }
.notif-dot-orange { background: var(--orange); }
.notif-dot-purple { background: var(--purple); }

.notif-panel {
  position: fixed;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 250;
}
.notif-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  padding: 10px 8px 4px;
}
.notif-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
a.notif-item:hover, .notif-item:hover { background: var(--gray-soft); }
.notif-item span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-lg { width: 760px; }

/* ---- Client detail card ---- */
.client-detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.client-detail-avatar {
  width: 52px; height: 52px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: 0 0 auto;
}
.client-detail-meta { font-size: 12.5px; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.client-detail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.client-detail-tab {
  padding: 8px 4px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; background: none; border-left: none; border-right: none; border-top: none;
}
.client-detail-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.client-detail-panel { display: none; }
.client-detail-panel.active { display: block; }
.conv-item { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.conv-item:last-child { border-bottom: none; }
.conv-item-meta { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 3px; }
.doc-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.doc-item:last-child { border-bottom: none; }
.doc-item .doc-name { flex: 1; }
.doc-item .doc-meta { font-size: 12px; color: var(--text-tertiary); }

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

.modal-header h2 { font-size: 16px; margin: 0; font-weight: 600; }

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-close:hover { background: var(--gray-soft); }

.modal-body { padding: 18px 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

.line-items { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 6px; }
.line-item-row { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--border-soft); align-items: center; }
.line-item-row:last-child { border-bottom: none; }
.line-item-row input { padding: 6px 8px; font-size: 13px; }
.line-item-remove {
  width: 26px; height: 26px; border-radius: var(--radius-sm); border: none; background: transparent;
  color: var(--text-tertiary); cursor: pointer; flex: 0 0 auto;
}
.line-item-remove:hover { background: var(--red-soft); color: var(--red); }

/* Regel-editor met kolomkoppen: aantal, prijs (euro) en btw zijn duidelijk gescheiden. */
.line-item-head {
  display: flex; gap: 8px; padding: 6px 8px; align-items: flex-end;
  background: var(--gray-soft); border-bottom: 1px solid var(--border-soft);
  font-size: 11px; font-weight: 600; color: var(--text-secondary); line-height: 1.25;
}
.line-item-head .li-total { text-align: right; }
.li-desc { flex: 2 1 0; min-width: 0; }
.li-qty { width: 72px; flex: 0 0 72px; }
.li-price { width: 112px; flex: 0 0 112px; }
.li-vat { width: 72px; flex: 0 0 72px; }
.li-total { width: 92px; flex: 0 0 92px; text-align: right; font-size: 13px; font-weight: 600; }
.li-x { width: 26px; flex: 0 0 26px; }
.line-item-row select.li-vat { padding: 6px 4px; font-size: 13px; }
.input-euro { position: relative; display: block; }
.input-euro::before {
  content: '€'; position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  font-size: 12.5px; color: var(--text-tertiary); pointer-events: none;
}
.input-euro input { width: 100%; padding-left: 22px !important; text-align: right; }

/* Voortgangslijn met pijlen (orders): tekst + icoon, geen achtergrond. */
.flow-steps { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; font-weight: 600; }
.flow-step { display: inline-flex; align-items: center; gap: 4px; color: var(--text-tertiary); white-space: nowrap; }
.flow-step.is-done { color: var(--green); }
.flow-step.is-partial { color: var(--orange); }
.flow-step.is-error { color: var(--red); }
.flow-arrow { color: var(--border); flex: 0 0 auto; }

/* ==========================================================================
   Misc
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }

.mono-note {
  font-size: 12px;
  color: var(--text-tertiary);
}

.reset-link {
  font-size: 12.5px;
  color: var(--text-secondary);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 480px;
}

.profile-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-card-avatar {
  width: 72px; height: 72px; border-radius: 999px; background: var(--gray-soft); color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px;
  overflow: hidden; flex: 0 0 auto;
}
.profile-card-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.avatar-upload-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.avatar-upload-actions { display: flex; flex-direction: column; gap: 6px; }
.avatar-upload-hint { font-size: 12px; color: var(--text-tertiary); }
.profile-field { padding: 10px 0; border-top: 0px solid var(--border-soft); font-size: 13.5px; display: flex; justify-content: space-between; }
.profile-field span:first-child { color: var(--text-secondary); }

/* ==========================================================================
   Dashboard: begroeting + twee-koloms layout (hoofdinhoud + team chat)
   ========================================================================== */
.dashboard-greeting {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
  padding: 6px 0;
}
.dashboard-greeting h1 { font-size: 24px; margin: 0; font-weight: 600; }
.dashboard-greeting .dashboard-date { font-size: 13px; color: var(--text-secondary); text-transform: capitalize; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}
.dashboard-main { min-width: 0; }

/* ==========================================================================
   Task management (Kanban-bord)
   ========================================================================== */
.page-content.wide { max-width: none; }

.tm-board {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.tm-column {
  flex: 0 0 320px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 120px);
}

.tm-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 0px solid var(--border);
  flex: 0 0 auto;
}

.tm-column-count { color: var(--text-tertiary); font-weight: 500; }

.tm-column-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tm-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }

.tm-card-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.tm-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tm-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tm-card-meta-right { margin-left: auto; }

/* Kleur komt van de gecombineerde .lv-pill.pill-* classes (zelfde palet als
   labels/statussen elders); dit voegt alleen het klikbare gedrag toe. */
.tm-status-pill {
  cursor: pointer;
  border: none;
  font-size: 11.5px;
}

.tm-status-pill:hover { filter: brightness(0.95); }

.tm-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
}

.tm-card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 11.5px;
  font-weight: 500;
}

.tm-card-action:hover { background: var(--gray-soft); color: var(--text); }
.tm-card-action.tm-complete:hover { background: var(--green-soft); color: var(--green); }

.tm-empty-column {
  padding: 24px 10px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12.5px;
}

/* ---- Task detail-modal (Task management): Details/Comments/Attachments/History tabs.
   Zelfde patroon als .client-detail-tabs in clients.php, hier generiek gemaakt
   zodat andere pagina's 'm ook kunnen hergebruiken. */
.task-detail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.task-detail-tab {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.task-detail-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.task-detail-panel { display: none; }
.task-detail-panel.active { display: block; }

.th-item { padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.th-item:last-child { border-bottom: none; }
.th-item-meta { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 3px; }

.kpi-card {
  position: relative;
  overflow: hidden;
  transition: box-shadow .15s ease, transform .15s ease;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent);
}
.kpi-card.kpi-orange::before { background: var(--orange); }
.kpi-card.kpi-green::before { background: var(--green); }
.kpi-card.kpi-purple::before { background: var(--purple); }
.kpi-card.kpi-red::before { background: var(--red); }

/* Natuurvak: 4 SVG-taferelen die om de 8s in elkaar overvloeien (puur CSS,
   overleeft dus elke herrender van het dashboard). */
.kpi-card.kpi-nature { padding: 0; min-height: 150px; }
.kpi-card.kpi-nature::before { display: none; }
.nature-slide { position: absolute; inset: 0; opacity: 0; animation: nature-fade 32s infinite; }
.nature-slide svg { display: block; position: absolute; inset: 0; }
.nature-caption {
  position: absolute; left: 12px; bottom: 10px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(15, 23, 42, .45); color: #fff; font-size: 11.5px; font-weight: 600;
  backdrop-filter: blur(4px);
}
@keyframes nature-fade {
  0% { opacity: 0; }
  4% { opacity: 1; }
  25% { opacity: 1; }
  29% { opacity: 0; }
  100% { opacity: 0; }
}

/* Beide vakken op de dashboard-tweede-rij (taken links, groups rechts)
   vullen in dashboard.php via JS de resterende viewporthoogte, zodat de
   pagina zelf niet hoeft te scrollen (grotere schermen krijgen dus vanzelf
   hogere vakken). min-height hieronder is alleen de vloer voor erg lage
   viewports en voor het allereerste moment vóór die meting. Content die
   toch niet past scrollt intern, niet de hele pagina. */
#upcoming-tasks { min-height: 220px; overflow-y: auto; }

/* ---- Team chat widget ---- */
.chat-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 260px;
  min-height: 220px;
  overflow: hidden;
}
.chat-widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(120deg, #e6eaf0 0%, #ffffff 100%);
}
.chat-room-select {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  padding: 4px 0;
}
.chat-widget-header .icon-btn { flex: 0 0 auto; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-message { display: flex; flex-direction: column; max-width: 84%; }
.chat-message.own { align-self: flex-end; align-items: flex-end; }
.chat-message-meta { font-size: 11px; color: var(--text-tertiary); margin-bottom: 3px; padding: 0 4px; }
.chat-bubble {
  background: var(--gray-soft);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 14px 14px 14px 4px;
  font-size: 13.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-message.own .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.chat-input-wrap { position: relative; flex: 1; }
.chat-input-row textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  max-height: 80px;
  box-sizing: border-box;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--accent); }
.chat-char-counter {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 10.5px;
  color: var(--text-tertiary);
  background: var(--surface);
  padding: 0 2px;
  pointer-events: none;
}
.chat-char-counter.is-near-limit { color: var(--red); font-weight: 600; }
.chat-send-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.chat-send-btn:disabled { opacity: .5; }

.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); font-size: 13px; text-align: center; padding: 20px; }

/* ==========================================================================
   Planner (weekoverzicht: taken, aanwezigheid, verlof/ziekte, facturen)
   ========================================================================== */
.pl-week-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 14px;
}
.pl-week-range { font-size: 15px; font-weight: 600; min-width: 170px; text-align: center; }
.pl-spacer { flex: 1 1 0; min-width: 0; }
.pl-week-header .btn, .pl-week-header .pl-seg { flex: 0 0 auto; white-space: nowrap; }
.pl-week-header .pl-week-range { white-space: nowrap; }
@media (max-width: 1180px) { .pl-week-header .pl-lbl { display: none; } .pl-week-range { min-width: 0; } }
@media (max-width: 760px) { .pl-week-header { flex-wrap: wrap; } }
.pl-week-nav-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; background: var(--surface); cursor: pointer;
}
.pl-week-nav-btn:hover { background: var(--gray-soft); }

/* Tijdraster */
.pl-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.pl-seg button { border: 0; background: transparent; padding: 5px 12px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; font-family: inherit; }
.pl-seg button.on { background: var(--gray-soft); color: var(--text); font-weight: 600; }

.pl-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.pl-g-scroll { flex: 1; min-height: 0; overflow: auto; position: relative; }
.pl-g-sticky, .pl-g-body { min-width: max-content; }
.pl-g-sticky { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--border); }
.pl-g-row { display: flex; }
.pl-g-axis { width: 52px; flex: 0 0 52px; position: relative; }
.pl-g-dh { flex: 1 1 0; min-width: 150px; position: relative; text-align: center; padding: 7px 0 6px; border-left: 1px solid var(--border-soft); }
.pl-g-dname { border: 0; background: none; font-family: inherit; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 8px; }
.pl-g-dnum { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%; font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: 0; }
.pl-g-dh.is-today .pl-g-dnum { background: var(--red); color: #fff; }
.pl-g-dh.is-today .pl-g-dname { color: var(--red); }
.pl-day-add { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-tertiary); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s; }
.pl-g-dh:hover .pl-day-add, .pl-day-add:focus-visible { opacity: 1; }
.pl-day-add:hover { background: var(--gray-soft); color: var(--text); }

.pl-g-ad { border-top: 1px solid var(--border-soft); max-height: 150px; overflow-y: auto; }
.pl-g-axis-lbl { font-size: 11px; color: var(--text-tertiary); text-align: right; padding: 8px 8px 0 0; }
.pl-view-sep { border-top: 1px solid var(--border-soft); margin-top: 6px; padding-top: 10px; }
.pl-g-lane { background: var(--gray-soft); border-top: 1px solid var(--border-soft); }
.pl-grid.lane-open .pl-g-lane { max-height: 170px; overflow-y: auto; }
.pl-g-lane .pl-g-axis { display: flex; justify-content: center; padding-top: 6px; }
.pl-lane-toggle { border: 0; background: none; color: var(--text-secondary); cursor: pointer; width: 22px; height: 22px; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: transform .15s; }
.pl-lane-toggle:hover { background: var(--border-soft); color: var(--text); }
.pl-g-lc { flex: 1 1 0; min-width: 150px; border-left: 1px solid var(--border-soft); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-height: 30px; }
.pl-chip { display: flex; align-items: center; gap: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.3; border-radius: 0; min-width: 0; }
.pl-chip-count { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); cursor: pointer; font-family: inherit; border-radius: 4px; }
.pl-chip-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-chip.pl-c { cursor: pointer; }
.pl-chip.is-done .pl-chip-title { text-decoration: line-through; opacity: .6; }
.pl-cb { flex: 0 0 auto; width: 13px; height: 13px; border: 1.5px solid var(--pl-c); border-radius: 3px; background: var(--surface); cursor: pointer; position: relative; }
.pl-cb.is-on { background: var(--pl-c); }
.pl-cb.is-on::after { content: ''; position: absolute; left: 3px; top: 0; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.pl-g-body { position: relative; display: flex; }
.pl-g-axis-body { height: 100%; }
.pl-g-hl { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--text-tertiary); background: var(--surface); padding: 0 2px; }
.pl-g-col {
  flex: 1 1 0; min-width: 150px; position: relative; border-left: 1px solid var(--border-soft);
  background-image: linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px);
  background-size: 100% 56px; cursor: cell;
}
.pl-g-col.is-today { background-color: color-mix(in srgb, var(--red) 3%, var(--surface)); }

/* Kleur per soort/agenda: --pl-c wordt per item gezet */
.pl-c { border-left: 3px solid var(--pl-c); background: color-mix(in srgb, var(--pl-c) 14%, var(--surface)); color: var(--text); }
.pl-c[data-open-event]:hover, .pl-c[data-open-task]:hover { background: color-mix(in srgb, var(--pl-c) 26%, var(--surface)); }
.pl-ev { position: absolute; display: flex; flex-direction: column; gap: 1px; padding: 3px 6px; overflow: hidden; cursor: pointer; font-size: 12px; line-height: 1.3; border-radius: 0; z-index: 1; }
.pl-ev.is-compact { flex-direction: row; align-items: baseline; gap: 5px; white-space: nowrap; padding-top: 2px; }
.pl-ev-title { font-weight: 500; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; padding-right: 14px; }
.pl-ev-title.is-one { display: block; flex: 1; min-width: 0; white-space: nowrap; text-overflow: ellipsis; -webkit-line-clamp: unset; }
.pl-ev.is-tight { font-size: 11px; padding: 3px 4px; }
.pl-ev.is-tight .pl-ev-time { font-size: 10.5px; }
.pl-ev-time { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--text); }
.pl-ev-loc { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-ev .pl-note-btn { position: absolute; top: 2px; right: 2px; }
.pl-ev-allday { overflow: visible; z-index: 0; }
.pl-ev-allday .pl-ev-title { display: block; }
.pl-ev-sticky { position: sticky; top: calc(var(--pl-sticky-h, 100px) + 6px); display: flex; flex-direction: column; gap: 1px; padding-right: 18px; }
.pl-ev-wrap { position: absolute; top: 0; right: 0; bottom: 0; pointer-events: none; }
.pl-ev-wrap .pl-ev { pointer-events: auto; }
.pl-ad-strip { position: absolute; top: 0; bottom: 0; z-index: 1; cursor: pointer; border-radius: 0; overflow: visible; }
.pl-ad-text { position: sticky; top: calc(var(--pl-sticky-h, 100px) + 8px); display: block; writing-mode: vertical-rl; max-height: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; padding: 22px 0 0 4px; }
.pl-ad-strip.is-wide .pl-ad-text { writing-mode: horizontal-tb; max-height: none; white-space: normal; padding: 6px 22px 0 8px; display: flex; flex-direction: column; gap: 1px; word-break: break-word; }
.pl-ad-strip.is-wide .pl-note-btn { left: auto; right: 3px; transform: none; }
.pl-ad-strip .pl-note-btn { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); }
.pl-att { position: absolute; right: 0; width: 5px; background: var(--green); opacity: .75; border-radius: 3px 0 0 3px; z-index: 2; }

.pl-now { position: absolute; left: 52px; right: 0; border-top: 2px solid var(--red); z-index: 3; pointer-events: none; }
.pl-now-label { position: absolute; left: -52px; width: 48px; transform: translateY(-50%); text-align: right; font-size: 11px; font-weight: 700; color: var(--red); background: var(--surface); padding-right: 2px; }

.pl-view { position: relative; }
.pl-view-count { color: var(--text-secondary); font-weight: 400; margin-left: 2px; }
.pl-view-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px;
}
.pl-view-title { padding: 6px 8px 4px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); }
.pl-view-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.pl-view-row:hover { background: var(--gray-soft); }
.pl-view-row input { accent-color: var(--accent); margin: 0; }
.pl-view-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-view-all { display: block; width: 100%; margin-top: 4px; padding: 7px 8px; border: 0; border-top: 1px solid var(--border-soft); background: none; text-align: left; font-size: 12.5px; color: var(--accent); cursor: pointer; }
.pl-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
/* ==========================================================================
   Nieuwsbrief (wekelijks overzicht)
   ========================================================================== */
.nl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.nl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.nl-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.nl-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nl-card-title { font-size: 14.5px; font-weight: 700; }
.nl-card-meta { font-size: 12px; color: var(--text-tertiary); }

.nl-card-actions { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.nl-card-actions .btn { flex: 1; justify-content: center; }

@media (max-width: 1020px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .rail, .side-panel, .nav-topstrip { display: none; }
  .app-shell { display: block; }
  .page-content { padding: 20px; }
}

/* Kleurkiezer in het koppelingenvenster van de planner */
.cl-color { width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; flex: 0 0 auto; }

/* Aantekening-knop op een agendapunt in de planner */
.pl-note-btn { flex: 0 0 auto; align-self: center; display: inline-flex; padding: 2px; border: 0; background: none; border-radius: 4px; color: var(--text-tertiary); opacity: .55; cursor: pointer; }
.pl-note-btn:hover { opacity: 1; background: rgba(0, 0, 0, .06); color: var(--text); }
.pl-note-btn.has-note { opacity: 1; color: var(--text); }
.pl-note-box { margin: 0 0 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--yellow-soft); font-size: 13px; white-space: pre-wrap; line-height: 1.5; }
.pl-orphan { padding: 12px 0; border-top: 1px solid var(--border); }
.pl-orphan:first-of-type { border-top: 0; }

/* Informatie-pop-up bij een melding op het overzicht */
.mi-row { display: flex; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; align-items: baseline; }
.mi-row:last-child { border-bottom: 0; }
.mi-label { flex: 0 0 120px; color: var(--text-secondary); font-size: 12.5px; }
.mi-value { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }

/* ==========================================================================
   Glas-stijl (optioneel, per apparaat): achtergrondafbeelding + doorschijnende, vervaagde vlakken
   Wordt aangezet via de knop "Uiterlijk" in de bovenbalk (html.glass).
   ========================================================================== */
.appearance-panel { position: fixed; z-index: 150; width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 14px; font-size: 13px; }
.ap-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.ap-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; padding: 6px 0 12px; }
.ap-row small { display: block; color: var(--text-secondary); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.ap-switch { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: 999px; background: var(--border); position: relative; flex: 0 0 auto; cursor: pointer; transition: background .15s; }
.ap-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.ap-switch:checked { background: var(--accent); }
.ap-switch:checked::after { transform: translateX(16px); }
.ap-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); margin: 4px 0 8px; }
.ap-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ap-swatch { width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.ap-swatch.on { border-color: var(--accent); }
.ap-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ap-actions .btn { cursor: pointer; }
.ap-hint { margin-top: 10px; font-size: 11.5px; color: var(--text-tertiary); }

html.glass {
  --surface: rgba(255, 255, 255, .58);
  --sidebar-bg: rgba(255, 255, 255, .82);
  --rail-bg: rgba(255, 255, 255, .46);
  --rail-hover: rgba(255, 255, 255, .6);
  --bg: transparent;
  --border: rgba(15, 23, 42, .10);
  --border-soft: rgba(15, 23, 42, .06);
  --gray-soft: rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .10);
  --shadow-md: 0 10px 34px rgba(15, 23, 42, .16);
}
html.glass, html.glass body { background: var(--glass-bg) fixed; }
html.glass .app-shell { background: transparent; }
html.glass .nav-topstrip { background: transparent; }

/* grote vlakken: doorschijnend met blur */
html.glass .rail,
html.glass .main-area,
html.glass .lv-shell, html.glass .kpi-card, html.glass .profile-card, html.glass .tm-column, html.glass .tm-card,
html.glass .nl-card, html.glass .pl-grid, html.glass .chat-widget {
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border-color: rgba(255, 255, 255, .55);
}
html.glass .main-area { background: rgba(255, 255, 255, .36); margin: 10px 12px 12px 4px; border-radius: 24px; border: 1px solid rgba(255, 255, 255, .5); min-height: calc(100vh - 22px); box-shadow: 0 10px 40px rgba(15, 23, 42, .18); }
html.glass .topbar { background: rgba(255, 255, 255, .5); -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5); border-radius: 24px 24px 0 0; border-bottom: 1px solid rgba(255, 255, 255, .5); }
html.glass .rail { margin: 0 4px 12px 10px; width: calc(var(--rail-w, 68px) - 14px); height: calc(100vh - var(--topbar-h) - 12px); border-radius: 22px; box-shadow: 0 8px 30px rgba(15, 23, 42, .16); }
html.glass .lv-shell, html.glass .kpi-card, html.glass .profile-card, html.glass .nl-card, html.glass .pl-grid { box-shadow: 0 4px 20px rgba(15, 23, 42, .10); }
html.glass .lv-row { background: transparent; }
html.glass .lv-row:hover { background: rgba(255, 255, 255, .45); }
html.glass .lv-group-header { background: rgba(255, 255, 255, .35); }

/* zwevende lagen: iets dichter zodat tekst goed leesbaar blijft */
html.glass .side-panel, html.glass .notif-panel, html.glass .dropdown-menu, html.glass .search-dropdown, html.glass .pl-view-menu,
html.glass .lv-suggest-box, html.glass .appearance-panel {
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  backdrop-filter: blur(28px) saturate(1.6);
}
html.glass .modal { background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6); border: 1px solid rgba(255, 255, 255, .6); }
html.glass .modal-overlay { background: rgba(15, 23, 42, .32); }
html.glass .topbar-search-box.has-search { background: rgba(255, 255, 255, .6); }
html.glass .btn { background: rgba(255, 255, 255, .6); }
html.glass .btn:hover { background: rgba(255, 255, 255, .88); }
html.glass .btn-primary:hover { background: #1c6ce8; color: #fff; }
html.glass .btn-danger:hover { background: var(--red-soft); }

/* planner */
html.glass .pl-g-sticky { background: rgba(255, 255, 255, .78); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
html.glass .pl-g-hl, html.glass .pl-now-label { background: transparent; }
html.glass .pl-g-col.is-today { background-color: rgba(226, 75, 74, .05); }
html.glass .pl-g-lane { background: rgba(15, 23, 42, .04); }

@media (max-width: 860px) {
  html.glass .main-area { margin: 8px; min-height: calc(100vh - 16px); }
}

/* Keuze Normaal / Glas op de profielpagina */
.ap-modes { display: flex; gap: 14px; flex-wrap: wrap; }
.ap-mode { flex: 1 1 200px; min-width: 180px; text-align: left; border: 2px solid var(--border); border-radius: 14px; padding: 12px; background: transparent; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font-family: inherit; color: var(--text); }
.ap-mode:hover { border-color: var(--border-strong, var(--border)); }
.ap-mode.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ap-mode small { color: var(--text-secondary); font-size: 12px; line-height: 1.35; }
.ap-mode-prev { display: flex; gap: 6px; align-items: flex-end; height: 70px; border-radius: 10px; padding: 8px; margin-bottom: 6px; }
.ap-mode-prev i { flex: 1; height: 100%; border-radius: 7px; display: block; }
.ap-mode-prev i:nth-child(2) { height: 62%; }
.ap-prev-normal { background: #eef0f3; }
.ap-prev-normal i { background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.ap-prev-glass-light, .ap-prev-glass-dark { background: radial-gradient(60% 70% at 15% 20%, rgba(46,196,182,.9), transparent 65%), radial-gradient(55% 70% at 90% 15%, rgba(66,133,244,.85), transparent 65%), linear-gradient(160deg, #0a2e3d, #0f5a73); }
.ap-prev-glass-light i { background: rgba(255, 255, 255, .5); border: 1px solid rgba(255, 255, 255, .6); }

.ap-prev-glass-dark i { background: rgba(10, 20, 32, .55); border: 1px solid rgba(255, 255, 255, .22); }

/* ==========================================================================
   Glas, donker: donkere vervaagde vlakken met lichte tekst (html.glass-dark)
   ========================================================================== */
html.glass-dark {
  color-scheme: dark;
  --text: #f2f6fb;
  --text-secondary: rgba(232, 240, 250, .74);
  --text-tertiary: rgba(232, 240, 250, .5);
  --surface: rgba(10, 20, 32, .46);
  --sidebar-bg: rgba(12, 22, 34, .84);
  --rail-bg: rgba(10, 20, 32, .5);
  --rail-hover: rgba(255, 255, 255, .12);
  --rail-icon: rgba(232, 240, 250, .72);
  --rail-active-bg: rgba(255, 255, 255, .18);
  --border: rgba(255, 255, 255, .14);
  --border-soft: rgba(255, 255, 255, .08);
  --gray-soft: rgba(255, 255, 255, .08);
  --accent: #5ea3ff;
  --accent-soft: rgba(94, 163, 255, .2);
  --green: #4ade9b;  --green-soft: rgba(74, 222, 155, .18);
  --red: #ff8585;    --red-soft: rgba(255, 133, 133, .18);
  --orange: #ffab5c; --orange-soft: rgba(255, 171, 92, .18);
  --purple: #b79bff; --purple-soft: rgba(183, 155, 255, .2);
  --yellow: #ffd166; --yellow-soft: rgba(255, 209, 102, .18);
  --gray: #d3dce8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md: 0 12px 38px rgba(0, 0, 0, .45);
}
html.glass-dark .main-area { background: rgba(8, 16, 26, .34); border-color: rgba(255, 255, 255, .14); box-shadow: 0 12px 44px rgba(0, 0, 0, .4); }
html.glass-dark .topbar { background: rgba(10, 20, 32, .5); border-bottom-color: rgba(255, 255, 255, .1); }
html.glass-dark .rail, html.glass-dark .nav-topstrip-bg { border-color: rgba(255, 255, 255, .14); }
html.glass-dark .lv-shell, html.glass-dark .kpi-card, html.glass-dark .profile-card, html.glass-dark .tm-column, html.glass-dark .tm-card,
html.glass-dark .nl-card, html.glass-dark .pl-grid, html.glass-dark .chat-widget { border-color: rgba(255, 255, 255, .14); box-shadow: 0 6px 24px rgba(0, 0, 0, .28); }
html.glass-dark .lv-row:hover { background: rgba(255, 255, 255, .07); }
html.glass-dark .lv-group-header { background: rgba(255, 255, 255, .05); }
html.glass-dark .side-panel, html.glass-dark .notif-panel, html.glass-dark .dropdown-menu, html.glass-dark .search-dropdown, html.glass-dark .pl-view-menu,
html.glass-dark .lv-suggest-box, html.glass-dark .appearance-panel { background: rgba(14, 24, 36, .9); border-color: rgba(255, 255, 255, .14); }
html.glass-dark .modal { background: rgba(16, 26, 40, .92); border-color: rgba(255, 255, 255, .16); }
html.glass-dark .modal-overlay { background: rgba(0, 0, 0, .45); }
html.glass-dark .topbar-search-box.has-search { background: rgba(255, 255, 255, .08); }
html.glass-dark .btn { background: rgba(255, 255, 255, .09); color: var(--text); }
html.glass-dark .btn:hover { background: rgba(255, 255, 255, .17); }
html.glass-dark .btn-primary { background: rgba(94, 163, 255, .22); color: #cfe3ff; border-color: rgba(94, 163, 255, .7); }
html.glass-dark .btn-primary:hover { background: #3b82f6; color: #fff; }
html.glass-dark .btn-danger:hover { background: var(--red-soft); }
html.glass-dark .lang-switch-opt.active { background: rgba(255, 255, 255, .2); color: var(--text); }
html.glass-dark .form-group input, html.glass-dark .form-group select, html.glass-dark .form-group textarea { background: rgba(255, 255, 255, .07); color: var(--text); }
html.glass-dark .pl-g-sticky { background: rgba(12, 22, 34, .82); }
html.glass-dark .pl-g-col.is-today { background-color: rgba(255, 133, 133, .06); }
html.glass-dark .pl-g-lane { background: rgba(255, 255, 255, .04); }
html.glass-dark .pl-g-hl, html.glass-dark .pl-now-label { background: transparent; }
html.glass-dark .pl-cb { background: transparent; }
html.glass-dark .pl-g-dh.is-today .pl-g-dnum { color: #fff; background: #e5484d; }
html.glass-dark .ap-switch::after { background: #fff; }
html.glass-dark .workspace-badge { background: rgba(255, 255, 255, .14); color: var(--text); border-color: rgba(255, 255, 255, .2); }
html.glass-dark .tabs .tab.active, html.glass-dark .tab.active { color: var(--text); }

/* ==========================================================================
   Glas: logo en zijbalk als één doorlopend vlak
   ========================================================================== */
html.glass .nav-topstrip { align-items: flex-start; padding-top: 20px; margin-left: 10px; width: calc(var(--rail-w, 68px) - 14px); z-index: 9; }
html.glass .rail { grid-row: 1 / 3; top: 10px; height: calc(100vh - 22px); margin-top: 10px; padding-top: 70px; }
html.glass .side-panel { top: 10px; height: calc(100vh - 22px); border-radius: 22px; }
@media (max-width: 860px) { html.glass .nav-topstrip, html.glass .rail { display: none; } }

/* vaste lichte kleuren die in glas-modus moeten meekleuren */
html.glass .chat-widget-header { background: rgba(255, 255, 255, .4); }
html.glass-dark .chat-widget-header { background: rgba(255, 255, 255, .07); }
html.glass-dark input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):not(.ap-switch),
html.glass-dark select, html.glass-dark textarea { background: rgba(255, 255, 255, .07); color: var(--text); border-color: var(--border); }
html.glass-dark ::placeholder { color: var(--text-tertiary); }
html.glass-dark .chat-room-select option, html.glass-dark select option { background: #16212f; color: #f2f6fb; }
html.glass-dark .lv-search input, html.glass-dark .topbar-search-box input { background: transparent; border: 0; }

/* Glas, donker: doorschijnender en sterkere blur. Het grote hoofdvlak blijft licht vervaagd; de kaarten
   daarop zijn sterk vervaagd, zodat je het matglas-effect ziet. */
html.glass-dark {
  --surface: rgba(10, 20, 32, .30);
  --sidebar-bg: rgba(12, 22, 34, .70);
  --rail-bg: rgba(10, 20, 32, .32);
}
html.glass-dark .main-area { background: rgba(8, 16, 26, .14); -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3); }
html.glass-dark .topbar { background: rgba(10, 20, 32, .26); -webkit-backdrop-filter: blur(30px) saturate(1.7); backdrop-filter: blur(30px) saturate(1.7); }
html.glass-dark .rail, html.glass-dark .lv-shell, html.glass-dark .kpi-card, html.glass-dark .profile-card, html.glass-dark .tm-column,
html.glass-dark .tm-card, html.glass-dark .nl-card, html.glass-dark .pl-grid, html.glass-dark .chat-widget {
  -webkit-backdrop-filter: blur(42px) saturate(1.8);
  backdrop-filter: blur(42px) saturate(1.8);
}
html.glass-dark .side-panel, html.glass-dark .notif-panel, html.glass-dark .dropdown-menu, html.glass-dark .search-dropdown,
html.glass-dark .pl-view-menu, html.glass-dark .lv-suggest-box, html.glass-dark .appearance-panel {
  background: rgba(14, 24, 36, .72);
  -webkit-backdrop-filter: blur(44px) saturate(1.8);
  backdrop-filter: blur(44px) saturate(1.8);
}
html.glass-dark .modal { background: rgba(16, 26, 40, .78); -webkit-backdrop-filter: blur(44px) saturate(1.8); backdrop-filter: blur(44px) saturate(1.8); }
html.glass-dark .pl-g-sticky { background: rgba(12, 22, 34, .55); -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px); }
html.glass-dark .lv-row:hover { background: rgba(255, 255, 255, .06); }

/* Glas, donker: vakken iets donkerder voor betere leesbaarheid (blur blijft hetzelfde) */
html.glass-dark {
  --surface: rgba(10, 20, 32, .44);
  --sidebar-bg: rgba(12, 22, 34, .80);
  --rail-bg: rgba(10, 20, 32, .42);
}
html.glass-dark .main-area { background: rgba(8, 16, 26, .20); }
html.glass-dark .topbar { background: rgba(10, 20, 32, .38); }
html.glass-dark .side-panel, html.glass-dark .notif-panel, html.glass-dark .dropdown-menu, html.glass-dark .search-dropdown,
html.glass-dark .pl-view-menu, html.glass-dark .lv-suggest-box, html.glass-dark .appearance-panel { background: rgba(14, 24, 36, .82); }
html.glass-dark .modal { background: rgba(16, 26, 40, .88); }
html.glass-dark .pl-g-sticky { background: rgba(12, 22, 34, .68); }

/* ==========================================================================
   Responsive: tablet en telefoon
   ========================================================================== */
#mobile-menu-btn, .mnav, .mnav-overlay { display: none; }

@media (max-width: 860px) {
  #mobile-menu-btn { display: inline-flex; flex: 0 0 auto; }
  .mnav-overlay { display: block; position: fixed; inset: 0; z-index: 190; background: rgba(15, 23, 42, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .mnav {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 200; width: min(86vw, 330px);
    background: var(--sidebar-bg); box-shadow: var(--shadow-md); transform: translateX(-105%); transition: transform .22s ease; overflow: hidden;
  }
  html.mnav-open .mnav { transform: none; }
  html.mnav-open .mnav-overlay { opacity: 1; pointer-events: auto; }
  html.mnav-open { overflow: hidden; }
  .mnav-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--border-soft); flex: 0 0 auto; }
  .mnav-brand { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mnav-body { flex: 1; overflow-y: auto; padding: 8px; }
  .mnav-sep { height: 1px; background: var(--border-soft); margin: 8px 10px; }
  .mnav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px; border-radius: 10px; font-size: 15px; font-weight: 500; color: var(--text); text-decoration: none; text-align: left; cursor: pointer; }
  .mnav-item:hover, .mnav-item.active { background: var(--gray-soft); }
  .mnav-item.active { font-weight: 600; }
  .mnav-ico { display: inline-flex; flex: 0 0 22px; justify-content: center; color: var(--text-secondary); }
  .mnav-item.active .mnav-ico { color: var(--accent); }
  .mnav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mnav-badge { background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
  .mnav-chev { display: inline-flex; color: var(--text-tertiary); transition: transform .15s; }
  .mnav-group.open .mnav-chev { transform: rotate(180deg); }
  .mnav-children { display: none; padding: 2px 0 6px 22px; }
  .mnav-group.open .mnav-children { display: block; }
  .mnav-child { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 14.5px; color: var(--text-secondary); text-decoration: none; }
  .mnav-child:hover { background: var(--gray-soft); }
  .mnav-child.active { color: var(--text); font-weight: 600; background: var(--gray-soft); }
  .mnav-group-label { padding: 10px 12px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); }
  .mnav-foot { flex: 0 0 auto; border-top: 1px solid var(--border-soft); padding: 8px; }
  html.glass .mnav { background: var(--sidebar-bg); -webkit-backdrop-filter: blur(40px) saturate(1.7); backdrop-filter: blur(40px) saturate(1.7); }

  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-brand { display: none; }
  .topbar-search { min-width: 0; }
  .topbar-search-box { max-width: none; }
  .topbar-actions { gap: 8px; flex: 0 0 auto; }
  html.glass .topbar { border-radius: 24px 24px 0 0; }
}

@media (max-width: 600px) {
  .page-content { padding: 14px 12px 40px; }
  .page-header { gap: 10px; margin-bottom: 14px; }
  .page-header-actions { flex-wrap: wrap; }
  .page-title h1 { font-size: 20px; }
  .tabs { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; }
  .form-row { flex-direction: column; gap: 0; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-lg { width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 18px 18px 0 0; }
  .topbar-actions .lang-switch { transform: scale(.92); transform-origin: right center; }
  #appearance-btn { display: none; }
}

@media (max-width: 600px) {
  /* lijstrijen: titel op een eigen regel (volledig leesbaar), details eronder */
  .lv-row { flex-wrap: wrap; row-gap: 6px; padding: 12px 14px; }
  .lv-row-title { flex: 1 1 calc(100% - 90px); min-width: 0; white-space: normal; overflow: visible; }
  .lv-row-sub { display: block; margin-left: 0; }
  .lv-row-right { flex: 1 1 100%; flex-wrap: wrap; gap: 8px 14px; padding-left: 30px; }
  .lv-toolbar { padding: 10px; }
}

/* Regel-editor: de kolomlabels staan op een desktop in de kop; op een telefoon boven elk veld */
.li-lbl { display: none; }
.li-cell input, .li-cell select { width: 100%; }
.li-cell .li-vat { width: 100%; flex: initial; }
.li-vatcell { width: 72px; flex: 0 0 72px; }
.li-cell.li-total { display: flex; align-items: center; justify-content: flex-end; }

@media (max-width: 600px) {
  .line-item-head { display: none; }
  .line-item-row { flex-wrap: wrap; gap: 8px; align-items: flex-end; }
  .line-item-row > input.li-desc { order: 1; flex: 1 1 calc(100% - 40px); width: auto; }
  .line-item-row > .li-x { order: 2; }
  .line-item-row > .li-qty { order: 3; flex: 0 0 66px; width: 66px; }
  .line-item-row > .li-price { order: 4; flex: 1 1 100px; width: auto; }
  .line-item-row > .li-vatcell { order: 5; flex: 0 0 76px; width: 76px; }
  .line-item-row > .li-cell.li-total { order: 6; flex: 1 1 100%; width: auto; justify-content: space-between; align-items: baseline; }
  .li-lbl { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 3px; }
  .li-cell.li-total .li-lbl { margin-bottom: 0; }
}

@media (max-width: 600px) {
  /* venstervoeten: knoppen mogen doorlopen naar een volgende regel in plaats van buiten beeld te vallen */
  .modal-footer { flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 14px; }
  .modal-footer .btn { flex: 1 1 auto; justify-content: center; }
  /* brede tabellen in vensters scrollen zijwaarts */
  .modal-body table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal-body table th, .modal-body table td { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 600px) {
  .modal-body table th, .modal-body table td { padding-left: 8px !important; padding-right: 8px !important; }
  .modal-body table th { white-space: nowrap; }
}

/* KPI-kaarten op een telefoon: compact, twee naast elkaar */
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
  .kpi-card { padding: 12px 12px 10px; border-radius: 14px; }
  .kpi-card::before { height: 3px; }
  .kpi-card:hover { transform: none; }
  .kpi-value { font-size: 21px; }
  .kpi-label { font-size: 12px; margin-top: 1px; }
  .kpi-icon { width: 28px; height: 28px; flex: 0 0 28px; }
  .kpi-icon svg { width: 15px; height: 15px; }
  .kpi-split { margin-top: 8px; padding-top: 8px; gap: 4px 10px; flex-wrap: wrap; }
  .kpi-split-item .kpi-split-value { font-size: 14px; }
  .kpi-split-item .kpi-split-label { font-size: 11px; }
  .kpi-card.kpi-nature { grid-column: 1 / -1; min-height: 110px; }
}
@media (max-width: 600px) {
  .kpi-split { gap: 4px 8px; }
  .kpi-split-item .kpi-split-label { font-size: 10.5px; }
}
@media (max-width: 380px) {
  .kpi-split-item .kpi-split-label { font-size: 10px; }
  .kpi-card { padding: 11px 10px 9px; }
}

/* ==========================================================================
   Persoonlijke bestanden
   ========================================================================== */
.files-usage { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.files-usage-bar { flex: 0 0 160px; height: 6px; border-radius: 99px; background: var(--gray-soft); overflow: hidden; border: 1px solid var(--border-soft); }
.files-usage-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.files-usage-bar span.warn { background: var(--red); }
.files-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; font-size: 13px; }
.files-crumbs a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--accent); font-weight: 500; }
.files-crumbs a:hover { text-decoration: underline; }
.files-crumb-sep { color: var(--text-tertiary); }
.files-crumb-cur { font-weight: 600; }
.files-ico-folder { color: var(--yellow); }
.files-row .files-meta { white-space: nowrap; }
.files-row .lv-row-menu { text-decoration: none; }
.files-row .lv-row-menu.files-danger:hover { color: var(--red); background: var(--red-soft); }
.files-shell.dragging { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.files-dropnote { padding: 10px 16px; font-size: 12px; color: var(--text-tertiary); border-top: 1px solid var(--border-soft); text-align: center; }
@media (max-width: 700px) {
  .files-usage-bar { flex-basis: 100px; }
  .files-row .files-date { display: none; }
  .files-row { gap: 8px; padding: 10px 12px; }
  .files-row .lv-row-right { gap: 4px; }
  .files-row .lv-row-title { min-width: 0; }
  .files-row .lv-row-sub { display: none; }
  .files-dropnote { display: none !important; }
}

/* ==========================================================================
   Eigenaar bekijkt de werkomgeving van een lid (alleen lezen)
   ========================================================================== */
.viewas-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin: 0 0 16px; border-radius: var(--radius); background: var(--yellow-soft); border: 1px solid #f3d9a4; color: var(--yellow); font-weight: 500; }
.viewas-banner .viewas-text { flex: 1; min-width: 180px; }
.viewas-banner .viewas-icon { display: flex; }
html.viewing-as .topbar-search { visibility: hidden; }
html.viewing-as .viewas-hide { display: none !important; }

/* Teamoverzicht */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.team-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.team-card-head { display: flex; align-items: center; gap: 12px; }
.team-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex: 0 0 auto; }
.team-avatar img { width: 100%; height: 100%; object-fit: cover; }
.team-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-mail { font-size: 12px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-head-text { min-width: 0; flex: 1; }
.team-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.team-stat { background: var(--gray-soft); border-radius: var(--radius-sm); padding: 8px 10px; }
.team-stat b { display: block; font-size: 17px; }
.team-stat span { font-size: 11px; color: var(--text-secondary); }
.team-stat.warn b { color: var(--red); }
.team-links { display: flex; flex-wrap: wrap; gap: 8px; }
.team-links .btn { flex: 1 1 auto; justify-content: center; }
html.viewing-as .pl-day-add { display: none; }
html.viewing-as .pl-cb, html.viewing-as [data-status-pill] { pointer-events: none; cursor: default; }
html.viewing-as [data-task-toggle], html.viewing-as [data-restore-task] { pointer-events: none; }
html.viewing-as [data-restore-task] { display: none; }
html.viewing-as .tm-card-action[data-action="complete"], html.viewing-as .tm-card-action[data-action="edit"] { display: none; }
.team-card-head .pill { flex: 0 0 auto; }
.team-setting { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.team-setting input { margin-top: 3px; width: 16px; height: 16px; flex: 0 0 auto; }
/* Weergave van een lid: duidelijk herkenbaar en niets dat wijzigt */
html.viewing-as .topbar { box-shadow: inset 0 -3px 0 #f0cf8a; }
html.viewing-as .viewas-banner { position: sticky; top: 0; z-index: 20; }
html.viewing-as .page-header-actions { display: none !important; }
html.viewing-as .chat-widget, html.viewing-as #chat-widget { display: none !important; }
.team-card-head .pill { margin-left: auto; white-space: nowrap; max-width: none; overflow: visible; }
.files-row[draggable="true"] { cursor: grab; }
.files-row.dragging-file { opacity: .45; }
.files-drop-target.drop-over { background: var(--accent-soft) !important; outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }
.files-crumbs a.files-drop-target.drop-over { padding: 2px 8px; }
