:root {
  --bg: #faf3ec;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --text: #2d2a26;
  --muted: #8a847d;
  --accent: #b08966;
  --accent-dark: #8a6a4a;
  --green: #5fa463;
  --red: #c0564b;
  --border: #ece4dc;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --radius: 10px;
}

* { box-sizing: border-box; }

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

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

body.nav-menu-open {
  overflow: hidden;
  touch-action: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

/* Layout */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
  font-size: 15px;
  color: var(--accent-dark);
}

.hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 10px;
  margin: -4px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.hamburger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hamburger span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text);
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item.active {
  background: var(--bg);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-icon { width: 20px; text-align: center; }

/* Sidebar submenu */
.nav-parent { justify-content: space-between; }
.nav-arrow { font-size: 10px; color: var(--muted); transition: transform 0.2s; margin-left: auto; }
.nav-parent.open .nav-arrow { transform: rotate(90deg); }
.nav-sub { display: none; }
.nav-sub.open { display: block; }
.nav-child {
  padding-left: 36px;
  font-size: 13px;
  color: var(--muted);
  border-left: 3px solid transparent;
}
.nav-child.active { color: var(--accent-dark); border-left-color: var(--accent); font-weight: 600; background: var(--bg); }
.nav-child:hover { color: var(--text); }

/* Beheer tabs */
.beheer-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.beheer-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 8px 18px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
}
.beheer-tab:hover { color: var(--text); }
.beheer-tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.beheer-panel.hidden { display: none; }

/* Week preview */
.week-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.week-chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.week-chip.werk { background: #e3f1e5; color: #3f7a44; }
.week-chip.vrij { background: #f5dcd9; color: #a73f34; }

.sidebar-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* Main */
.main {
  padding: 22px 28px;
  padding-left: max(28px, env(safe-area-inset-left));
  padding-right: max(28px, env(safe-area-inset-right));
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

.view.hidden { display: none; }

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.col { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card:last-child { margin-bottom: 0; }
.card-title {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body { padding: 14px 18px; }
.card-body.no-pad { padding: 0; }
.card-body.small { padding: 12px 18px; font-size: 13px; }

.empty {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 12px 0;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.data-table tbody tr:hover { background: #fafafa; }
.data-table .name-link { color: var(--accent); cursor: pointer; }
.data-table .name-link:hover { text-decoration: underline; }

.amount { font-variant-numeric: tabular-nums; }

/* Status pills */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pill.gepland { background: #efe9e1; color: #8a6a4a; }
.pill.afgerond { background: #e3f1e5; color: #3f7a44; }
.pill.geannuleerd { background: #f5dcd9; color: #a73f34; }
.pill.openstaand { background: #fcefc7; color: #8a6d10; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: white; }
.btn.danger { background: var(--red); color: white; border-color: var(--red); }
.btn.danger:hover { filter: brightness(0.92); }
.btn.small { padding: 4px 10px; font-size: 12px; }

.row-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 4px;
}
.row-btn:hover { background: var(--bg); color: var(--text); }
.row-btn.complete { color: var(--green); }
.row-btn.delete { color: var(--red); }

.file-btn { position: relative; cursor: pointer; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input[type="search"],
.toolbar input[type="date"],
.toolbar input[type="month"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: white;
}
.toolbar input[type="search"] { min-width: 240px; }
.toolbar label { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.spacer { flex: 1; }

/* Forms */
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  gap: 4px;
}
.form input, .form select, .form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form button[type="submit"] {
  grid-column: 1 / -1;
  justify-self: start;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: white;
  border-radius: var(--radius);
  width: 520px;
  max-width: min(520px, calc(100% - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right))));
  max-height: min(90dvh, calc(100svh - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  margin: max(0px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body {
  padding: 18px;
  overflow-y: auto;
}

/* Kopie inplannen */
#modalBox.kopie-modal {
  width: min(440px, calc(100vw - 32px));
  max-width: 100%;
}
#modalBox.kopie-modal .modal-body {
  padding: 16px 18px 20px;
}
.kopie-intro {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.45;
}
.kopie-trt-list {
  margin: 0 0 14px;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}
.kopie-field {
  margin: 8px 0 0;
}
.kopie-week-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
select.kopie-week-select {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.35;
  border: 1px solid #d8d0c8;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  box-sizing: border-box;
  min-height: 48px;
}
select.kopie-week-select--dropdown {
  min-height: 48px;
}
select.kopie-week-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 137, 102, 0.22);
}
.kopie-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.kopie-actions--single {
  margin-top: 18px;
  justify-content: flex-start;
}
.kopie-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin: 12px 0 0;
}

/* Klanten: volle breedte + grijs canvas (Salonware-achtig) */
.view-klanten-workspace {
  margin-left: calc(-1 * max(28px, env(safe-area-inset-left)));
  margin-right: calc(-1 * max(28px, env(safe-area-inset-right)));
  padding-left: max(28px, env(safe-area-inset-left));
  padding-right: max(28px, env(safe-area-inset-right));
  padding-bottom: 28px;
  margin-top: -6px;
  min-height: calc(100vh - 120px);
  background: #e8eaed;
  box-sizing: border-box;
}

.klanten-main-full {
  width: 100%;
  max-width: none;
}

.klanten-list-card {
  background: #ffffff !important;
  border: 1px solid #c5c9ce !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  margin: 0;
}

.klanten-list-title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #333 !important;
  border-bottom: 1px solid #dcdee2 !important;
  padding: 12px 16px !important;
  background: linear-gradient(to bottom, #fafafa, #f5f5f5) !important;
}

.klanten-toolbar {
  margin-bottom: 14px;
}
.klanten-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}
.klanten-sort-wrap select {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #c5c9ce;
  background: #fff;
  font-size: 13px;
  color: #222;
  min-width: 158px;
}

.klanten-card-body { display: flex; flex-direction: column; }
.klanten-table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(calc(100vh - 220px), 780px);
  -webkit-overflow-scrolling: touch;
  background: #fff;
}

.klanten-table {
  table-layout: fixed;
  font-size: 13px;
  border-collapse: separate;
  border-spacing: 0;
}
.klanten-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eceff1 !important;
  color: #333 !important;
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 1px solid #cfd6db !important;
  white-space: nowrap;
  padding: 10px 12px !important;
  box-shadow: none;
}
.klanten-table tbody td {
  vertical-align: middle;
  line-height: 1.4;
  border-bottom: 1px solid #e8e8e8;
  padding: 11px 12px !important;
  color: #222;
}
.klanten-table tbody tr { cursor: pointer; }
.klanten-table tbody tr:nth-child(even) { background: #fafafa; }
.klanten-table tbody tr:nth-child(odd) { background: #ffffff; }
.klanten-table tbody tr:hover { background: #e8f4fc !important; }
.klanten-table tbody tr.selected {
  background: #d6ebfa !important;
  box-shadow: inset 3px 0 0 #2196f3;
}
.klanten-table tbody tr.selected:hover { background: #c5e3f7 !important; }

.klanten-table .col-mv { width: 40px; text-align: center; color: #666; font-weight: 500; }
.klanten-table .col-naam { width: 22%; min-width: 140px; font-weight: 500; color: #111; }
.klanten-table .col-adres { width: 18%; min-width: 110px; }
.klanten-table .col-plaats { width: 14%; min-width: 96px; color: #333; }
.klanten-table .col-tel { width: 18%; min-width: 120px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.klanten-table .col-mail { width: 20%; min-width: 140px; word-break: break-word; color: #333; }
.klanten-table .col-act { width: 44px; text-align: center; padding-left: 4px; padding-right: 10px; }
.klanten-row-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #fff;
  color: #777;
  font-size: 18px;
  line-height: 1;
  font-weight: 300;
}
.klanten-table tbody tr:hover .klanten-row-go,
.klanten-table tbody tr.selected .klanten-row-go {
  border-color: #2196f3;
  color: #1976d2;
}

/* Klantdetail: schuifpaneel (geen vaste witte kolom) */
.client-detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  visibility: hidden;
}
.client-detail-drawer.is-open {
  pointer-events: auto;
  visibility: visible;
}
.client-detail-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.client-detail-drawer.is-open .client-detail-drawer-backdrop {
  opacity: 1;
}

.client-detail-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  max-width: 100vw;
  background: #fff;
  box-shadow: -6px 0 28px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid #cfd6db;
}
.client-detail-drawer.is-open .client-detail-drawer-panel {
  transform: translateX(0);
}

.client-detail-drawer-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 12px 12px 16px;
  border-bottom: 1px solid #e0e4e8;
  background: linear-gradient(to bottom, #fafbfc, #f5f6f8);
}
.client-detail-drawer-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
  color: #555;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.client-detail-drawer-close:hover {
  background: #f0f0f0;
  border-color: #999;
}
.client-detail-drawer-heading {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 600;
  color: #222;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.client-detail-drawer-body {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 24px;
  font-size: 14px;
}

body.client-drawer-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .view-klanten-workspace {
    margin-left: calc(-1 * max(14px, env(safe-area-inset-left)));
    margin-right: calc(-1 * max(14px, env(safe-area-inset-right)));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

/* Paginering klantenlijst */
.clients-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid #dcdee2;
  background: #f5f6f8;
  font-size: 13px;
}
.clients-pagination[hidden] { display: none !important; }
.clients-pagination-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.clients-pagination-info { color: var(--muted); }
.clients-pagination-info strong { color: var(--text); font-weight: 600; }
.clients-pagination-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.clients-pagination .clients-page-btn.is-current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.clients-pagination .clients-page-btn.is-current:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}
.clients-page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  user-select: none;
}
.clients-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.history-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.history-table th { background: var(--bg); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.history-totals {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.client-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-bottom: 12px; font-size: 13px; }
.client-meta div span:first-child { color: var(--muted); display: block; font-size: 11px; text-transform: uppercase; }

/* Report KPI */
.kpi {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi .value { font-size: 22px; font-weight: 600; margin-top: 6px; color: var(--accent-dark); }

/* Birthdays */
.birthday-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.birthday-row:last-child { border-bottom: none; }
.birthday-row .name { color: var(--accent); }
.birthday-row .date { color: var(--muted); font-size: 12px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2d2a26;
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  z-index: 500;
}
.toast.hidden { display: none; }

/* ---- Week Agenda ---- */
.agenda-week-card { overflow: hidden; background: var(--bg); }
.agenda-week-card .card-body.no-pad { background: var(--bg); }
.agenda-view-toggle {
  display: inline-flex;
  border: 1px solid #e0d8d0;
  border-radius: 8px;
  overflow: hidden;
  background: #efe9e1;
}
.agenda-view-btn {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.agenda-view-btn:hover { background: rgba(255,255,255,0.45); }
.agenda-view-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.view[data-view="agenda"]:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100dvh - 24px);
}
.view[data-view="agenda"] .agenda-week-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  background: var(--bg);
  border-color: #e0d8d0;
  box-shadow: none;
  min-height: calc(100dvh - 140px);
}
.view[data-view="agenda"] .agenda-week-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--bg);
}
.view[data-view="agenda"] .agenda-scroll {
  flex: 1;
  min-height: calc(100dvh - 150px);
  max-height: none;
  background: var(--bg);
  overflow-x: auto;
  overflow-y: visible;
}
.view[data-view="agenda"] .agenda-week-grid {
  min-height: calc(100dvh - 170px);
  background: var(--bg);
}
.view[data-view="agenda"] .agenda-body {
  min-height: calc(100dvh - 220px);
  background: var(--bg);
}
.agenda-scroll.agenda-scroll--compact { overflow-y: visible; }
.agenda-slot-filler {
  background: var(--bg);
  border-bottom: 0;
  pointer-events: none;
  width: 100%;
}
body.kopie-placing .agenda-slot {
  cursor: pointer;
}
body.kopie-placing .agenda-slot:hover,
body.kopie-placing .agenda-slot:focus-within {
  background: #5c5650;
  color: #fff;
  z-index: 3;
}
body.kopie-placing .agenda-slot:hover .agenda-cell-time,
body.kopie-placing .agenda-slot:focus-within .agenda-cell-time {
  position: relative;
  color: transparent;
}
body.kopie-placing .agenda-slot:hover .agenda-cell-time::after,
body.kopie-placing .agenda-slot:focus-within .agenda-cell-time::after {
  content: attr(data-label);
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  padding: 0 2px;
}
body.kopie-placing .agenda-day-apps {
  pointer-events: none;
}
body.kopie-placing .agenda-day-apps .app-block {
  pointer-events: auto;
  opacity: 0.55;
}
.agenda-kopie-hint {
  background: #fff8e6 !important;
  border-color: #e8c96a !important;
}
.agenda-empty-hint {
  margin: 0 0 10px 0;
  padding: 10px 14px;
  background: #f5f0ea;
  border: 1px solid #e0d8d0;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text, #333);
  line-height: 1.45;
}
.agenda-scroll { overflow-x: auto; overflow-y: auto; background: var(--bg); }

.agenda-week-grid {
  min-width: 720px;
  width: 100%;
  border: 1px solid #e0d8d0;
  background: var(--bg);
  box-sizing: border-box;
}
.agenda-head-row {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: 100%;
  background: var(--card-bg);
  box-shadow: 0 1px 0 #e0d8d0;
}
.day-col {
  text-align: center;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: #fff;
  background: #c4a995;
  border-left: 1px solid #b89a86;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.06);
  box-sizing: border-box;
}
.day-col:first-child { border-left: 0; }
.today-col { background: #b89880 !important; }
.free-week-col {
  background: #a89888 !important;
  color: rgba(255,255,255,0.88);
}
.free-label { font-size: 10px; color: #fff2a0; font-weight: 600; }

.agenda-body { width: 100%; }
.agenda-cols {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: 100%;
  align-items: stretch;
}
.agenda-day-col {
  position: relative;
  border-left: 1px solid #e0d8d0;
  background: var(--bg);
  box-sizing: border-box;
  min-width: 0;
}
.agenda-day-col:first-child { border-left: 0; }
/* Hele vrije (oneven/even) dag — iets donkerder dan werkdag (lichtere grijzen) */
.agenda-day-col.free-day-col { background: #d4cfc6; }
.agenda-day-slots { position: relative; z-index: 0; }
.agenda-day-apps {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
}
.agenda-day-apps .app-block { pointer-events: auto; }
.agenda-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 26px;
  height: 26px;
  border-bottom: 1px solid #ddd4c8;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  z-index: 0;
}
/* Buiten openingstijden of vrije dag: 2 tinten lichter grijs t.o.v. eerdere versie, nog zichtbaar t.o.v. wit */
.agenda-slot.agenda-slot--closed {
  background: #dcd6ce;
  border-bottom-color: #c8c1b7;
  cursor: pointer;
}
.agenda-day-col.free-day-col .agenda-slot.agenda-slot--closed {
  background: #cec8be;
  border-bottom-color: #b8b1a6;
}
.agenda-slot.agenda-slot--closed .agenda-cell-time {
  color: #5c5650;
  font-weight: 500;
}
.agenda-slot:not(.agenda-slot--closed):hover { background: #f5efe8; }
.agenda-slot.agenda-slot--closed:hover { background: #d0c9c0; }
.agenda-day-col.free-day-col .agenda-slot.agenda-slot--closed:hover { background: #c4bdb2; }

/* Weekagenda: op smal scherm volle breedte (geen horizontaal scrollen), compactere rijen */
@media (max-width: 900px) {
  .agenda-scroll {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .agenda-week-grid {
    min-width: 0;
    width: 100%;
  }
  .agenda-head-row,
  .agenda-cols {
    min-width: 0;
  }
  .day-col {
    font-size: 9px;
    padding: 6px 2px;
    line-height: 1.2;
  }
  .free-label {
    font-size: 8px;
  }
  .agenda-cell-time {
    font-size: 7px;
    letter-spacing: -0.02em;
  }
  .agenda-slot.agenda-slot--closed .agenda-cell-time {
    font-size: 7px;
    color: #524a42;
  }
  .agenda-slot {
    min-height: 15px;
    height: 15px;
  }
  .agenda-day-apps .app-block {
    font-size: 9px;
    padding: 2px 4px;
    line-height: 1.2;
  }
  .agenda-day-apps .app-name {
    font-size: 9px;
  }
  .agenda-day-apps .app-service,
  .agenda-day-apps .app-dur {
    font-size: 8px;
  }
  .agenda-day-apps .app-btn {
    padding: 1px 3px;
    font-size: 9px;
  }
}

/* ---------- Login (Hostinger) ---------- */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e8f2ea 0%, #f7faf7 45%, #eef5f0 100%);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.login-gate.hidden { display: none; }
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(45, 90, 61, 0.12);
  padding: 28px 24px 24px;
}
.login-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent, #5fa463);
  margin-bottom: 6px;
}
.login-title {
  margin: 0 0 4px;
  font-size: 24px;
  color: #2d5a3d;
}
.login-sub {
  margin: 0 0 20px;
  color: var(--muted, #667);
  font-size: 14px;
}
.login-form { display: grid; gap: 0; }
.login-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 6px;
}
.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  font-size: 16px;
}
.login-remember {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 8px;
  font-size: 14px;
  color: var(--text, #333);
  cursor: pointer;
}
.login-remember input { margin-top: 3px; flex-shrink: 0; }
.login-submit { width: 100%; margin-top: 8px; padding: 13px; font-size: 16px; }
.login-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #fdecea;
  color: #c0392b;
  border-radius: 8px;
  font-size: 14px;
}
.login-error.hidden { display: none; }
.app.hidden { display: none !important; }

.modal.large { width: 920px; max-width: calc(100% - 40px); }
.appt-layout { display: grid; grid-template-columns: 1fr 190px; gap: 0; min-height: 400px; }
.appt-main { overflow-y: auto; max-height: 78vh; }
.appt-sidebar { background: #f8f8fb; border-left: 1px solid var(--border); padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.appt-sidebar-btn { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; background: white; font-size: 13px; cursor: pointer; transition: background .15s; }
.appt-sidebar-btn:hover { background: var(--bg); }
.appt-sidebar-btn.primary { background: var(--accent); color: white; border-color: var(--accent); font-weight: 600; }
.appt-sidebar-btn.danger { color: var(--red); border-color: #f5c6c6; }
.appt-sidebar-btn.danger:hover { background: #ffeaea; }

/* Tabs bovenin appt modal */
.appt-modal-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg); padding: 0 18px; }
.appt-modal-tab { padding: 10px 16px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 13px; cursor: pointer; color: var(--muted); font-weight: 500; margin-bottom: -1px; }
.appt-modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.appt-modal-panel { padding: 18px; }
.appt-modal-panel.hidden { display: none; }

.appt-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.appt-section { margin-bottom: 16px; }
.appt-section h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.appt-field { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; font-size: 13px; }
.appt-field label { color: var(--muted); min-width: 90px; flex-shrink: 0; padding-top: 2px; }
.appt-field .val { flex: 1; }
.appt-field input, .appt-field select, .appt-field textarea { width: 100%; padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; font-family: inherit; }
.appt-field textarea { resize: vertical; min-height: 60px; }

.treatments-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.treatments-table th, .treatments-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.treatments-table th { background: var(--bg); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.treatments-table tfoot td { font-weight: 600; text-align: right; padding-top: 8px; }

.add-item-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.add-item-row select { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* Bon / Afrekenen */
.bon-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 4px; }
.bon-cat-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 16px; background: white; font-size: 12px; cursor: pointer; white-space: nowrap; }
.bon-cat-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.bon-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bon-table th, .bon-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.bon-table th { background: var(--bg); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.bon-total { display: flex; justify-content: space-between; padding: 10px 10px; font-size: 18px; font-weight: 600; color: var(--accent-dark); border-top: 2px solid var(--border); margin-top: 4px; }
.bon-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pay-btn { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: white; font-size: 14px; font-weight: 500; cursor: pointer; }
.pay-btn:hover { background: var(--bg); }
.pay-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.korting-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.korting-row input { width: 80px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; }

.agenda-cell-time {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 10px;
  line-height: 1.2;
  color: #9a9390;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  user-select: none;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  flex-shrink: 0;
}

/* Vaste hoogte per 5 min; afspraken over meerdere rijen – één uiterlijk voor alle afspraken */
.app-block.app-block--marker {
  background: #f5efe8;
  border: 1px dashed #c4b5a5;
  color: var(--text);
  min-height: 36px !important;
  height: auto !important;
  max-height: 52px;
}
.app-block.app-block--marker .app-service { font-style: italic; }

.app-block {
  position: absolute;
  left: 2px;
  right: 2px;
  width: auto;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 6px 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 0;
  background: #f0e4d7;
  border: 1px solid #d4c4b4;
  border-left: 3px solid var(--accent);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.app-block .app-name { flex-shrink: 0; }
.app-block .app-service { flex: 1; min-height: 0; overflow: hidden; text-overflow: ellipsis; }
.app-time  { font-weight: 600; color: var(--text); font-size: 11px; }
.app-name  { font-weight: 600; color: var(--accent-dark); }
.app-service { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.app-dur  { font-size: 10px; color: var(--muted); }
.app-actions { display: none; gap: 2px; margin-top: 3px; }
.app-block:hover .app-actions { display: flex; }
.app-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text);
}
.app-btn.complete { color: var(--green); }
.app-btn.paid     { color: var(--accent); }
.app-btn.edit     { color: var(--muted); }
.app-btn:hover    { background: var(--bg); }

/* ---- Beheer – categorie blokken ---- */
.cat-block { border-bottom: 2px solid var(--border); }
.cat-block:last-child { border-bottom: none; }
.cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  font-size: 14px;
}
.cat-drag { color: var(--muted); cursor: grab; font-size: 16px; }

/* Compact sidebar */
.sidebar.collapsed { grid-template-columns: 60px 1fr; }
.app.collapsed { grid-template-columns: 60px 1fr; }
.app.collapsed .nav-label,
.app.collapsed .brand { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 10px 0; }

/* Responsive — mobiel & smalle tablets */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  /* Vaste topbalk + volledig scherm menu */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: auto;
    min-height: calc(48px + env(safe-area-inset-top));
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 8px 12px 8px max(12px, env(safe-area-inset-left));
    padding-top: max(8px, env(safe-area-inset-top));
    background: var(--sidebar-bg);
    overflow: hidden;
  }
  .sidebar-header {
    flex: 1;
    min-width: 0;
    border-bottom: none;
    padding: 0;
  }
  .sidebar .nav,
  .sidebar .sidebar-footer {
    display: none !important;
  }
  .app.menu-open .sidebar {
    bottom: 0;
    min-height: 100dvh;
    max-height: none;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
    border-bottom: none;
  }
  .app.menu-open .sidebar-header {
    flex: 0 0 auto;
  }
  .app.menu-open .sidebar .nav {
    display: flex !important;
    flex: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 12px;
    min-height: 0;
  }
  .app.menu-open .sidebar .sidebar-footer {
    display: flex !important;
    flex-shrink: 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .app.menu-open .nav-item {
    min-height: 44px;
    padding: 12px 18px;
    border-left: 3px solid transparent;
    border-bottom: none;
  }
  .app.menu-open .nav-item.active {
    border-left-color: var(--accent);
    border-bottom: none;
  }
  .app.menu-open .nav-child {
    padding-left: 36px;
  }

  .main {
    padding: 12px 14px;
    padding-top: calc(14px + 52px + env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .grid-2,
  .klanten-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .form { grid-template-columns: 1fr; }

  .toolbar {
    gap: 10px;
  }
  .toolbar input[type="search"] {
    min-width: 0;
    flex: 1 1 160px;
    max-width: 100%;
  }

  .card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card-body .data-table {
    min-width: 260px;
  }

  .beheer-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    padding-bottom: 4px;
    margin-bottom: 12px;
  }
  .beheer-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .toast {
    bottom: max(20px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    transform: none;
    max-width: calc(100vw - 24px);
    text-align: center;
  }

  .modal-backdrop {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    align-items: center;
  }
  .modal.large {
    width: 100%;
    max-width: min(100%, calc(100vw - 16px));
    max-height: min(92dvh, calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px));
    display: flex;
    flex-direction: column;
  }
  .modal.large .modal-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
  }
  .modal.large .modal-header {
    flex-shrink: 0;
  }

  /* newappt-* basis staat onderaan (mobile-first); zie @media (min-width: 901px) voor desktop */
  .newappt-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -4px;
    margin-right: -4px;
    padding-bottom: 4px;
  }
  .newappt-items-table {
    min-width: 520px;
  }
}

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

@media print {
  .sidebar, .toolbar, .nav-item, .row-btn { display: none !important; }
  body { background: white; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* =========================================================
   AFSPRAAK DETAIL pagina (geen modal)
   ========================================================= */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.page-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.appt-page-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  align-items: start;
}
.appt-page-main { min-width: 0; }
.appt-page-side .card-title { font-size: 13px; padding: 10px 14px; }

.appt-page .card { padding: 0; }
.appt-modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: white;
  padding: 0 18px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.appt-modal-tab {
  padding: 12px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: -1px;
}
.appt-modal-tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  background: var(--bg);
}
.appt-modal-panel { padding: 18px; }
.appt-modal-panel.hidden { display: none; }

.appt-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 16px;
}
.appt-section h4 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.appt-field {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.appt-field-block { grid-template-columns: 110px 1fr; align-items: start; }
.appt-field label { color: var(--muted); }
.appt-field .val { min-width: 0; }
.appt-field input, .appt-field select, .appt-field textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
}
.appt-field textarea { resize: vertical; min-height: 80px; }
.appt-field .val .name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.appt-field .val .name-grid input { padding: 6px 10px; }

.email-badge {
  display: inline-block;
  padding: 6px 12px;
  background: #f0e9e2;
  color: var(--accent-dark);
  border-radius: 6px;
  font-size: 13px;
}
.client-notes {
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 130px;
  overflow-y: auto;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 10px;
  border-radius: 6px;
}

.beh-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px !important;
  background: white;
}
.beh-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.toevoegen-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.toevoeg-label { font-size: 13px; color: var(--muted); min-width: 80px; }
.toevoegen-row select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: white;
}
.confirm-mail {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text);
}

.appt-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.appt-side-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.appt-side-btn:hover { background: var(--bg); border-color: var(--accent); }
.appt-side-btn.danger { color: var(--red); border-color: #f0c9c5; }
.appt-side-btn.danger:hover { background: #fdecea; }

/* =========================================================
   AFREKENEN pagina
   ========================================================= */
.afr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.afr-search { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.afr-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.afr-split {
  display: grid;
  grid-template-columns: 160px 1fr;
  min-height: 360px;
}
.afr-cats {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.afr-cat-link {
  background: none;
  border: none;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 1px solid var(--border);
}
.afr-cat-link:hover { background: white; }
.afr-cat-link.active {
  background: var(--accent);
  color: white;
  border-left-color: var(--accent-dark);
  font-weight: 600;
}
.afr-cat-content {
  padding: 12px 14px;
  overflow-y: auto;
  max-height: 480px;
}
.afr-cat-block { margin-bottom: 14px; }
.afr-cat-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-dark);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.afr-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 4px;
  font-family: inherit;
  text-align: left;
}
.afr-item-row:hover { background: var(--accent); color: white; border-color: var(--accent); }
.afr-item-row span:last-child { color: var(--muted); margin-left: 8px; white-space: nowrap; }
.afr-item-row .afr-item-meta { font-size: 11px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.afr-item-row:hover span:last-child,
.afr-item-row:hover .afr-item-meta { color: white; }

.bon-client-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.bon-client-bar input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: white;
}
.bon-client-bar input[type="date"] { flex: 0 0 140px; }

.bon-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bon-table th, .bon-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.bon-table th { background: var(--bg); font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.bon-table td.amount, .bon-table th:nth-child(3), .bon-table th:nth-child(4) { text-align: right; }

.bon-korting-line {
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--red);
}
.bon-bottom-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.bon-pay-buttons { display: flex; gap: 6px; flex: 1; }
.bon-pay-buttons .pay-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
}
.bon-pay-buttons .pay-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.bon-totaal {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
}
.bon-amounts-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.bon-betalingen {
  padding: 10px 14px 0;
  border-top: 1px solid var(--border);
  background: #fbf9f6;
}
.bon-betalingen-title {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.bon-pay-line {
  display: grid;
  grid-template-columns: 1fr 1fr auto 36px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.bon-pay-d { color: var(--muted); font-size: 12px; }
.bon-pay-m { font-weight: 600; }
.bon-pay-a { text-align: right; font-variant-numeric: tabular-nums; }
.bon-pay-remove { margin-left: auto; }
.bon-pay-totalline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 4px;
  font-size: 15px;
}
.bon-pay-totalline strong {
  font-size: 18px;
  color: var(--accent-dark);
}
.bon-noshow {
  margin: 0;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}
.link-danger {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--red);
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}
.link-danger:hover { color: #a12; }

.afr-action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
  padding: 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
}

@media (max-width: 1100px) {
  .appt-page-grid { grid-template-columns: 1fr; }
  .afr-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   AUTOCOMPLETE DROPDOWN
   ========================================================= */
.ac-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.ac-wrap input {
  width: 100%;
}
.ac-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  max-height: 320px;
  overflow-y: auto;
}
.ac-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active {
  background: #fbf3ea;
}
.ac-label {
  font-weight: 500;
  color: var(--text);
}
.ac-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* =========================================================
   NEW APPOINTMENT MODAL (afspraak popup)
   Mobile-first: één kolom; vanaf 901px: Klant | Behandelingen naast elkaar
   (Regels staan bewust HIER, ná @media 900, zodat niets de mobiele layout overschrijft.)
   ========================================================= */
.newappt-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}
.newappt-tab {
  background: none;
  border: 0;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.newappt-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: #fbf3ea;
}
.newappt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 0 12px;
  min-width: 0;
}
.newappt-col h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 600;
}
.newappt-field {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 4px;
  margin-bottom: 10px;
  min-width: 0;
}
.newappt-field-block {
  grid-template-columns: 1fr;
}
.newappt-field-block label {
  margin-bottom: 4px;
}
.newappt-field > label {
  padding-top: 0;
  color: var(--muted);
  font-size: 13px;
}
.newappt-field label {
  color: var(--muted);
  font-size: 13px;
}
.newappt-field input,
.newappt-field select,
.newappt-field textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  background: white;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.newappt-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.newappt-row > * {
  flex: none;
  width: 100%;
  min-width: 0;
}

@media (min-width: 901px) {
  .newappt-tabs {
    gap: 0;
    padding: 0 18px;
    margin-bottom: 14px;
    overflow-x: visible;
    flex-wrap: wrap;
  }
  .newappt-tab {
    flex: 0 1 auto;
    white-space: normal;
  }
  .newappt-grid {
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    padding: 0 18px;
  }
  .newappt-col h4 {
    font-size: 16px;
    margin-bottom: 14px;
  }
  .newappt-field {
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 10px;
  }
  .newappt-field > label {
    padding-top: 2px;
  }
  .newappt-field input,
  .newappt-field select,
  .newappt-field textarea {
    font-size: 13px;
    width: auto;
  }
  .newappt-row {
    flex-direction: row;
    align-items: stretch;
  }
  .newappt-row > * {
    flex: 1;
    width: auto;
  }
  .newappt-warn {
    font-size: 13px;
  }
  .newappt-actions {
    flex-direction: row;
    align-items: center;
    padding: 14px 18px 4px;
    gap: 8px;
  }
  .newappt-actions .btn {
    width: auto;
    padding: 8px 14px;
  }
}

.newappt-hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}
.newappt-warn {
  margin-top: 14px;
  padding: 10px 14px;
  background: #fff5e6;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  color: #8a5a16;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.newappt-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 12px 8px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.newappt-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
  box-sizing: border-box;
}
/* Nieuwe afspraak: bevestigingsmail; mobiel = blok, desktop = op één lijn */
#modalBox.large .modal-body .confirm-mail {
  display: block;
  padding: 0 12px;
  line-height: 1.45;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text);
}
@media (min-width: 901px) {
  #modalBox.large .modal-body .confirm-mail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 18px;
  }
}

.newappt-table-wrap {
  min-width: 0;
  width: 100%;
  margin-top: 4px;
}
.newappt-items-table {
  min-width: 480px;
}

/* =========================================================
   MEER dropdown (Appointment detail sidebar)
   ========================================================= */
/* Belangrijk: .card heeft overflow:hidden, dus we overschrijven dat
   voor de zijbalk-card en openen het menu naar BOVEN zodat het altijd zichtbaar is. */
.appt-page-side .card { overflow: visible; }
.meer-wrap {
  position: relative;
}
.meer-dropdown {
  position: absolute;
  /* Open omhoog */
  bottom: calc(100% + 6px);
  top: auto;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.18);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 4px;
  min-width: 200px;
}
.meer-dropdown.hidden { display: none; }
.meer-item {
  background: none;
  border: 0;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  border-radius: 4px;
  font-family: inherit;
}
.meer-item:hover { background: #fbf3ea; }
.meer-item.danger { color: var(--red); }
.meer-item.danger:hover { background: #fbe9e7; }

.appt-side-btn.primary {
  background: var(--accent);
  color: white;
  font-weight: 600;
  border-color: var(--accent);
}
.appt-side-btn.primary:hover {
  background: var(--accent-dark);
}

/* =========================================================
   ANDERS dropdown bij afrekenen
   ========================================================= */
.anders-wrap {
  position: relative;
  display: inline-block;
}
.anders-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.18);
  z-index: 1000;
  min-width: 220px;
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.anders-dropdown.hidden { display: none; }
.anders-item {
  background: none;
  border: 0;
  text-align: left;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 4px;
  font-family: inherit;
  color: var(--text);
}
.anders-item:hover { background: #fbf3ea; }
.anders-item.active {
  background: var(--accent);
  color: white;
}
.anders-item.active span { color: rgba(255,255,255,0.7) !important; }

/* =========================================================
   RAPPORTAGE
   ========================================================= */
.rap-filter-card,
.rap-result-card { margin-bottom: 16px; }

.rap-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}
.rap-row + .rap-row { border-top: none; }

.rap-label {
  color: #444;
  font-size: 14px;
}

.rap-period {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
.rap-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}
.rap-radio input[type="radio"] {
  accent-color: #c89a6f;
  width: 16px;
  height: 16px;
}

.rap-period-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rap-period-inputs select,
.rap-period-inputs input[type="date"],
.rap-soort,
.rap-medewerker {
  padding: 6px 10px;
  border: 1px solid var(--border, #d8d2c7);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  min-width: 140px;
}
.rap-medewerker { min-width: 280px; max-width: 100%; }

.rap-zoeken {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rap-stats {
  display: grid;
  grid-template-columns: 240px 1fr;
  row-gap: 12px;
  margin-bottom: 18px;
  padding-top: 4px;
}
.rap-stats .rap-stat { display: contents; }
.rap-stat-label { color: #555; font-size: 14px; }
.rap-stat-value { font-weight: 500; font-size: 15px; }

.rap-table {
  border: 1px solid var(--border, #d8d2c7);
  margin-top: 8px;
}
.rap-table thead th {
  background: #efe9e0;
  border-bottom: 1px solid var(--border, #d8d2c7);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
}
.rap-table tbody td,
.rap-table tfoot td {
  padding: 10px 12px;
  border-bottom: 1px solid #ece7df;
  font-size: 14px;
}
.rap-table tfoot td {
  background: #f7f3ec;
  font-weight: 600;
  border-top: 2px solid var(--border, #d8d2c7);
}
.rap-table .amount { text-align: right; }

.rap-cat-block { margin-top: 18px; }
.rap-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #efe9e0;
  border: 1px solid var(--border, #d8d2c7);
  border-bottom: none;
  font-weight: 600;
}

.rap-donut-wrap {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 18px;
}
.rap-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}
.rap-legend-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.rap-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.rap-legend-amt {
  font-weight: 600;
  color: #333;
}
.rap-donut-empty {
  padding: 30px;
  color: var(--muted, #888);
  text-align: center;
  width: 100%;
}

@media (max-width: 700px) {
  .rap-row { grid-template-columns: 1fr; }
  .rap-stats { grid-template-columns: 160px 1fr; }
}

.rap-btw-block {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border, #d8d2c7);
}
.rap-btw-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: #444;
}

/* =========================================================
   KLANTDOSSIER pagina
   ========================================================= */
.dossier-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  align-items: flex-start;
}
.dossier-side .card { position: sticky; top: 16px; }

.dossier-stats-hint {
  font-size: 12px;
  color: var(--muted, #6b6560);
  margin: 0 0 12px;
  line-height: 1.45;
}
.dossier-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 16px;
}
.dossier-stats-grid > div > span {
  display: block;
  font-size: 12px;
  color: var(--muted, #6b6560);
  margin-bottom: 2px;
}
.dossier-stats-grid > div > strong {
  font-size: 15px;
  font-weight: 600;
}
.dossier-stats-sub {
  padding-top: 12px;
  border-top: 1px dashed var(--border, #d8d2c7);
}
.dossier-stats-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}
.dossier-stats-filehelp {
  font-size: 12px;
  color: var(--muted, #6b6560);
  margin: 10px 0 0;
  line-height: 1.45;
}

.dossier-form { display: flex; flex-direction: column; gap: 10px; }
.dos-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  align-items: center;
}
.dos-row > label { color: #444; font-size: 14px; }
.dos-row input,
.dos-row select,
.dos-row textarea {
  padding: 7px 10px;
  border: 1px solid var(--border, #d8d2c7);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  max-width: 460px;
}
.dos-row textarea { font-family: inherit; resize: vertical; min-height: 70px; }

.dos-section-title {
  margin: 18px 0 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border, #d8d2c7);
  font-size: 18px;
  font-weight: 500;
  color: #2a2722;
}

.dos-formulieren {
  display: block;
  margin: 6px 0;
}
.dos-formulieren-card {
  border: 2px solid #e2c79a;
  border-radius: 8px;
  padding: 14px 16px;
  background: #fffefb;
  max-width: 600px;
}
.dos-formulieren-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}
.dos-form-table { font-size: 13px; }

@media (max-width: 900px) {
  .dossier-grid { grid-template-columns: 1fr; }
  .dos-row { grid-template-columns: 1fr; gap: 4px; }
  .dossier-side .card { position: static; }
}

/* =========================================================
   AFSPRAKEN & PRODUCTEN pagina
   ========================================================= */
.ka-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  align-items: flex-start;
}
.ka-side .card { position: sticky; top: 16px; }

.ka-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ka-toolbar input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--border, #d8d2c7);
  border-radius: 6px;
  font-size: 13px;
  width: 220px;
}
.ka-filters {
  display: inline-flex;
  border: 1px solid var(--border, #d8d2c7);
  border-radius: 6px;
  overflow: hidden;
}
.ka-filter {
  background: white;
  border: none;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  border-right: 1px solid var(--border, #d8d2c7);
}
.ka-filter:last-child { border-right: none; }
.ka-filter.active { background: #c89a6f; color: white; }

.ka-table { font-size: 13px; }
.ka-table th { background: #efe9e0; padding: 10px 12px; }
.ka-table td { vertical-align: top; padding: 10px 12px; border-bottom: 1px solid #ece7df; }
.ka-items {
  font-family: inherit;
  margin: 0;
  white-space: pre-wrap;
  font-size: 13px;
}

.ka-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border, #d8d2c7);
}
.ka-export { display: flex; gap: 6px; }

@media (max-width: 900px) {
  .ka-layout { grid-template-columns: 1fr; }
  .ka-side .card { position: static; }
}

/* =========================================================
   INTAKE-FORMULIER (huidenquête)
   ========================================================= */
.intake-card { max-width: 820px; margin: 0 auto; }

.intake-section {
  margin: 20px 0 8px;
  padding: 8px 0 4px;
  border-bottom: 2px solid #c89a6f;
  font-size: 18px;
  font-weight: 600;
  color: #2a2722;
}
.intake-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.intake-row { display: flex; flex-direction: column; gap: 4px; }
.intake-row.full { grid-column: 1 / -1; }
.intake-row label { color: #444; font-size: 13px; }
.intake-row input,
.intake-row select,
.intake-row textarea {
  padding: 7px 10px;
  border: 1px solid var(--border, #d8d2c7);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  font-family: inherit;
}
.intake-row textarea { resize: vertical; min-height: 70px; }

.ck-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
  margin-top: 4px;
}
.ck-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.ck-row input[type="checkbox"] { accent-color: #c89a6f; width: 16px; height: 16px; }

@media (max-width: 700px) {
  .intake-grid { grid-template-columns: 1fr; }
  .ck-grid { grid-template-columns: 1fr; }
}

/* ===== Berichten / templates editor ===== */
.tpl-token { background: #efe9e0; padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: ui-monospace, monospace; cursor: pointer; }
.tpl-token:hover { background: #c89a6f; color: white; }

/* ===== Formulier-builder (intake) ===== */
.form-builder-group {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; margin-bottom: 16px; background: #fff;
}
.form-builder-group-head {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
}
.form-builder-group-head input {
  flex: 1; font-weight: 600; font-size: 15px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 4px; background: #fbfbfb;
}
.form-builder-fields td input,
.form-builder-fields td select {
  padding: 4px 6px; font-size: 13px; border: 1px solid var(--line);
  border-radius: 3px; width: 100%; background: #fff;
}

/* ===== Afrond-popup ===== */
.afrond-popup { display: flex; flex-direction: column; gap: 0; }
.afrond-opt {
  background: #fff; border: 1px solid var(--line); border-bottom: 0;
  padding: 14px 16px; text-align: center; font-size: 14px; cursor: pointer;
  color: #444; font-weight: 500; transition: background 0.15s;
}
.afrond-opt:hover { background: #f7f1ea; color: #c89a6f; }
.afrond-opt:first-child { border-top-left-radius: 6px; border-top-right-radius: 6px; }
.afrond-opt:last-child  { border-bottom: 1px solid var(--line); border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }

/* ===== Factuur-pagina ===== */
.factuur-toolbar {
  display: flex; gap: 8px; padding: 12px 0 16px;
  border-bottom: 1px solid var(--line); margin-bottom: 24px;
}
.factuur-page { padding: 0 0 40px; }
.factuur-paper {
  background: #fff;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 60px 60px;
  font-family: Georgia, 'Times New Roman', serif;
  color: #222;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 800px;
  position: relative;
}
.factuur-header { display: flex; align-items: center; gap: 18px; margin-bottom: 30px; }
.factuur-logo { max-height: 70px; max-width: 200px; object-fit: contain; }
.factuur-brand-title { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.factuur-aan { margin: 30px 0 18px; font-size: 14px; line-height: 1.5; }
.factuur-meta {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin: 18px 0 24px; font-size: 13px;
}
.factuur-anbos { font-weight: 600; line-height: 1.5; }
.factuur-anbos > div { font-weight: 400; font-size: 12px; color: #444; }
.factuur-anbos > div:first-child { font-weight: 600; font-size: 13px; color: #222; }
.factuur-nr { text-align: right; line-height: 1.6; }
.factuur-tabel {
  width: 100%; border-collapse: collapse; margin: 16px 0;
  font-size: 13px;
}
.factuur-tabel th {
  text-align: left; font-weight: 600; padding: 6px 4px;
  border-bottom: 1px solid #ccc;
}
.factuur-tabel td { padding: 6px 4px; vertical-align: top; }
.factuur-tabel .amount { text-align: right; }
.factuur-totals {
  margin-top: 18px; font-size: 13px; max-width: 360px; margin-left: auto;
}
.factuur-totals-line {
  display: flex; justify-content: space-between; padding: 2px 0;
}
.factuur-totals-strong {
  font-weight: 700;
  border-top: 2px double #333;
  padding-top: 4px; margin-bottom: 6px;
}
.factuur-extra {
  margin-top: 30px; font-size: 13px; line-height: 1.5;
  padding-top: 14px; border-top: 1px dashed var(--line);
}
.factuur-footer {
  position: absolute; bottom: 28px; left: 60px; right: 60px;
  text-align: center; font-size: 11px; color: #555; line-height: 1.5;
  padding-top: 10px;
}
.factuur-toprow { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 16px; }
.factuur-metasingle { font-size: 14px; line-height: 1.55; margin: 0 0 20px; }
.factuur-metasingle .factuur-prof { font-size: 12px; line-height: 1.4; color: #333; margin-top: 10px; }
.factuur-metasingle .factuur-prof > div { margin-top: 2px; }

/* Factuur: rich editor */
.fac-rich-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 10px;
  background: #f3eee8; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 0;
  max-width: 720px; margin-left: auto; margin-right: auto;
}
.fac-tb {
  min-width: 32px; padding: 4px 8px; font-size: 13px; font-weight: 600;
  border: 1px solid #c4b4a2; background: #fff; border-radius: 4px; cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.fac-tb:hover { background: #fff8f0; border-color: #c89a6f; }
.fac-tb-sep { width: 1px; height: 20px; background: #ccc; margin: 0 4px; }
.factuur-toolbar--edit { flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 8px; }
.fac-edit-hint { font-size: 12px; color: var(--muted); }
.factuur-paper--edit { outline: 1px solid #c89a6f; min-height: 60vh; }
.factuur-paper--edit:focus { outline: 2px solid #c89a6f; }
@media (max-width: 700px) {
  .factuur-paper { padding: 24px 20px 80px; }
  .factuur-meta { flex-direction: column; gap: 12px; }
  .factuur-nr { text-align: left; }
  .factuur-footer { position: static; margin-top: 40px; }
  .fac-edit-hint { display: none; }
}

