:root {
  --bs-primary: #2563eb;
  --bs-primary-dark: #1d4ed8;
  --bs-primary-light: #dbeafe;
  --bs-accent: #0ea5e9;
  --bs-dark: #0f172a;
  --bs-text: #334155;
  --bs-muted: #64748b;
  --bs-border: #e2e8f0;
  --bs-bg: #f8fafc;
  --bs-white: #ffffff;
  --bs-success: #059669;
  --bs-danger: #dc2626;
  --bs-warning: #ea580c;
  --bs-radius: 12px;
  --bs-radius-lg: 16px;
  --bs-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --bs-shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.08);
  --bs-font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --bs-page-width: 1120px;
  --bs-content-width: 920px;
}

* { box-sizing: border-box; }

body {
  font-family: var(--bs-font);
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.08), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(14, 165, 233, 0.07), transparent 28%),
    var(--bs-bg);
  color: var(--bs-text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--bs-primary); }
a:hover { color: var(--bs-primary-dark); }

/* Auth pages (login, wachtwoord) */
.auth-page {
  min-height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.12), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(14, 165, 233, 0.1), transparent 35%),
    var(--bs-bg);
}

.auth-card {
  max-width: 440px;
  margin: 6vh auto;
  background: var(--bs-white);
  padding: 2.5rem;
  border-radius: var(--bs-radius-lg);
  border: 1px solid var(--bs-border);
  box-shadow: var(--bs-shadow-lg);
}

/* Besasoft logo — zelfde als website */
.besasoft-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--bs-dark);
}

.besasoft-brand .logo-icon {
  border-radius: 10px;
  background: linear-gradient(135deg, var(--bs-primary), var(--bs-accent));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  flex-shrink: 0;
}

.besasoft-brand .logo-text {
  font-weight: 700;
  line-height: 1;
}

.besasoft-brand--nav .logo-icon {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}

.besasoft-brand--nav .logo-text {
  font-size: 1.35rem;
}

.auth-brand-wrap {
  text-align: center;
  margin-bottom: 2rem;
}

.besasoft-brand--auth .logo-icon {
  width: 56px;
  height: 56px;
  font-size: 1.5rem;
  border-radius: 14px;
}

.besasoft-brand--auth .logo-text {
  font-size: 2rem;
}

.auth-subtitle {
  margin: 0.35rem 0 0;
  color: var(--bs-muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 0 0 0.5rem;
  color: var(--bs-dark);
  text-align: center;
}

.auth-card p.lead {
  color: var(--bs-muted);
  font-size: 0.95rem;
  text-align: center;
  margin: 0 0 1.25rem;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--bs-dark);
  margin-bottom: 0.35rem;
}

.auth-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--bs-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}

.auth-actions a {
  font-size: 0.875rem;
  text-decoration: none;
}

.btn-auth {
  width: 100%;
  padding: 0.9rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--bs-primary);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.btn-auth:hover {
  background: var(--bs-primary-dark);
}

.btn-auth-success {
  background: var(--bs-success);
}

.msg-error { color: var(--bs-danger); font-weight: 600; text-align: center; }
.msg-success { color: var(--bs-success); font-weight: 600; text-align: center; }

.auth-back {
  display: block;
  text-align: center;
  margin-top: 1rem;
  color: var(--bs-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

/* App shell */
.top-nav {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bs-border);
  margin-bottom: 1.5rem;
  box-shadow: var(--bs-shadow);
}

.top-nav-inner {
  width: min(100% - 2rem, var(--bs-page-width));
  margin: 0 auto;
  padding: 0.85rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.top-nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.top-nav-logo:hover .logo-text {
  color: var(--bs-dark);
}

.top-nav-logo img {
  height: 40px;
  width: auto;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.mobile-menu-btn {
  display: none;
  background: var(--bs-primary);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-family: inherit;
  font-weight: 700;
  min-height: 44px;
  cursor: pointer;
}

.nav-btn {
  color: var(--bs-text);
  text-decoration: none;
  font-size: 0.875rem;
  background: var(--bs-white);
  border: 1px solid var(--bs-border);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s;
  font-weight: 600;
}

.nav-btn:hover {
  background: var(--bs-primary-light);
  border-color: #bfdbfe;
  color: var(--bs-primary-dark);
}

.nav-btn-primary {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  color: white;
}

.nav-btn-primary:hover {
  background: var(--bs-primary-dark);
  border-color: var(--bs-primary-dark);
  color: white;
}

.nav-btn-danger:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: var(--bs-danger);
}

.nav-btn.is-sort-active {
  background: var(--bs-warning);
  border-color: var(--bs-warning);
  color: #fff;
}

.nav-btn.is-sort-active:hover {
  background: #c2410c;
  border-color: #c2410c;
  color: #fff;
}

.nav-dashboard-tools {
  display: none;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-main {
  width: min(100% - 2rem, var(--bs-page-width));
  margin: 0 auto 2.5rem;
}

.container {
  background: var(--bs-white);
  padding: 2rem 2.25rem;
  border-radius: var(--bs-radius-lg);
  border: 1px solid var(--bs-border);
  box-shadow: var(--bs-shadow);
  max-width: var(--bs-content-width);
  margin: 0 auto;
}

.page-title {
  text-align: center;
  margin-bottom: 1.75rem;
}

.page-title--dashboard {
  margin-bottom: 1rem;
}

.page-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--bs-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title h1 {
  color: var(--bs-dark);
  font-size: 1.9rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.page-title p {
  color: var(--bs-muted);
  margin: 0 auto;
  font-weight: 500;
  font-size: 0.95rem;
  max-width: 36rem;
}

.page-toolbar,
.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 0 auto 1.25rem;
}

.section-title {
  margin-top: 0;
  color: var(--bs-primary);
  text-align: center;
}

.container > h1 {
  text-align: center;
  color: var(--bs-dark);
  margin: 0 0 1.25rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.container > h1 + p,
.container > .lead {
  text-align: center;
  color: var(--bs-muted);
  margin: -0.75rem auto 1.25rem;
  max-width: 36rem;
}

table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { border-bottom: 1px solid var(--bs-border); padding: 12px; text-align: left; }
th { color: var(--bs-dark); font-size: 0.875rem; }

input[type="text"], input[type="number"], input[type="email"], input[type="date"],
input[type="time"], input[type="password"], input[type="color"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--bs-border);
  border-radius: 8px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ts-control {
  padding: 8px;
  border: 1px solid var(--bs-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background-color: white;
}

input[type="checkbox"] {
  width: auto;
  margin-right: 10px;
  cursor: pointer;
  transform: scale(1.15);
  vertical-align: middle;
}

.btn {
  background: var(--bs-primary);
  color: white;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
  font-size: 0.9rem;
}

.btn:hover { background: var(--bs-primary-dark); color: white; }
.btn-green { background: var(--bs-success); }
.btn-green:hover { background: #047857; }
.btn-red { background: var(--bs-danger); }
.btn-red:hover { background: #b91c1c; }
.btn-orange { background: var(--bs-warning); }
.btn-orange:hover { background: #c2410c; }
.btn-gray { background: var(--bs-muted); }
.btn-gray:hover { background: #475569; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  max-width: 780px;
  margin: 0.5rem auto 0;
}

.dash-grid.is-sorting {
  border: 2px dashed #cbd5e1;
  padding: 1rem;
  border-radius: var(--bs-radius);
  background: #fcfdff;
}

.dashboard-panel {
  max-width: 860px;
  margin: 0 auto;
  padding-top: 0.25rem;
}

.dashboard-top-actions {
  display: none;
}

.dashboard-toolbar .dash-sort-btn,
.dashboard-toolbar .dash-trash-btn {
  font-size: 0.78rem;
  padding: 0.45rem 0.85rem;
  line-height: 1.2;
  border-radius: 999px;
}

.dashboard-panel .page-title h1 {
  padding-right: 0;
}

/* Tijdens homepage-screenshot: iets groter voor leesbaarheid op de website */
body.hero-capture .dash-btn {
  font-size: 17px;
  padding: 22px 12px;
}

body.hero-capture .page-title h1 {
  font-size: 2rem;
}

body.hero-capture .nav-btn {
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
}

body.hero-capture .top-nav-logo .logo-text {
  font-size: 1.15rem;
}

body.hero-capture .trial-bar {
  display: none !important;
}

.dash-btn {
  min-height: 92px;
  padding: 1.1rem 0.85rem;
  text-align: center;
  color: white;
  font-weight: 700;
  font-size: 0.98rem;
  border-radius: var(--bs-radius);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
  line-height: 1.25;
}

.dash-btn:active { cursor: grabbing; }
.dash-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  filter: brightness(1.03);
  color: white;
}

.dash-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  gap: 0.5rem;
  max-width: none;
  margin: 0.5rem 0 0;
  justify-content: start;
}

.dash-btn--compact {
  min-height: 0;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
  gap: 6px;
}

.dash-btn--compact:hover {
  transform: none;
  box-shadow: none;
}

.b-green { background: linear-gradient(145deg, #059669, #047857); }
.b-orange { background: linear-gradient(145deg, #ea580c, #c2410c); }
.b-blue { background: linear-gradient(145deg, #2563eb, #1d4ed8); }
.b-purple { background: linear-gradient(145deg, #7c3aed, #6d28d9); }
.b-teal { background: linear-gradient(145deg, #0d9488, #0f766e); }
.b-gray { background: linear-gradient(145deg, #64748b, #475569); }
.b-indigo { background: linear-gradient(145deg, #4f46e5, #4338ca); }
.b-mail { background: linear-gradient(145deg, #dc2626, #b91c1c); }
.b-pink { background: linear-gradient(145deg, #db2777, #be185d); }

.ghost-class { opacity: 0.4; }

.mod-box {
  background: var(--bs-bg);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--bs-border);
}

.sub-mod-box {
  margin-left: 25px;
  margin-top: 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 2px solid var(--bs-border);
  padding-left: 10px;
}

.product-ac-wrap { position: relative; min-width: 180px; }

.autocomplete-lijst {
  background: white;
  border: 1px solid var(--bs-border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: var(--bs-shadow);
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--bs-border);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: var(--bs-primary-light); }
.autocomplete-item small { color: var(--bs-muted); }

.tip-box {
  background: var(--bs-primary-light);
  border-left: 4px solid var(--bs-primary);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
}

body.has-trial-bar {
  padding-bottom: 2.5rem;
}

.trial-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  min-height: 2.25rem;
  padding: 0.35rem 1rem;
  background: #1e3a8a;
  color: #dbeafe;
  font-size: 0.78rem;
  line-height: 1.2;
  box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.15);
}

.trial-bar-label {
  font-weight: 600;
  color: #fff;
}

.trial-bar-sep {
  opacity: 0.45;
}

.trial-bar-countdown {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  color: #fff;
  font-size: 0.78rem;
}

.trial-bar-end {
  opacity: 0.85;
}

.trial-bar-link {
  color: #bfdbfe;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.trial-bar-link:hover {
  color: #fff;
}

/* Beheerdersportaal */
.admin-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  color: var(--bs-dark);
}

.admin-subtitle {
  margin: 0 0 1.5rem;
  color: var(--bs-muted);
  font-size: 0.95rem;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-kpi {
  border-radius: 10px;
  padding: 1rem;
  color: #fff;
  text-align: center;
}

.admin-kpi-num {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.admin-kpi-label {
  font-size: 0.75rem;
  opacity: 0.95;
  margin-top: 0.25rem;
}

.admin-kpi-blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.admin-kpi-green { background: linear-gradient(135deg, #16a34a, #15803d); }
.admin-kpi-red { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.admin-kpi-purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.admin-kpi-orange { background: linear-gradient(135deg, #ea580c, #c2410c); }
.admin-kpi-yellow { background: linear-gradient(135deg, #ca8a04, #a16207); }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-toolbar-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.admin-tab {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.admin-tab:hover {
  background: #e2e8f0;
}

.admin-tab.active {
  background: var(--bs-primary);
  color: #fff;
}

.admin-search {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--bs-border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bs-border);
  border-radius: 10px;
  background: #fff;
}

.admin-table {
  margin: 0;
}

.admin-table th {
  background: #f8fafc;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  white-space: nowrap;
}

.admin-table td {
  font-size: 0.9rem;
  vertical-align: middle;
}

.admin-row-hoofd td {
  background: #fff;
}

.admin-sub-row td {
  background: #f8fafc;
  padding: 0.75rem 1rem !important;
}

.admin-sub-wrap {
  padding-left: 1rem;
}

.admin-mini-table {
  width: 100%;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.admin-mini-table th,
.admin-mini-table td {
  padding: 0.4rem 0.6rem;
}

.admin-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-badge-green { background: #dcfce7; color: #166534; }
.admin-badge-blue { background: #dbeafe; color: #1e40af; }
.admin-badge-red { background: #fee2e2; color: #991b1b; }
.admin-badge-gray { background: #f1f5f9; color: #475569; }
.admin-badge-dark { background: #1e293b; color: #f8fafc; }

.admin-actions {
  white-space: nowrap;
}

.admin-panel {
  background: #fff;
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--bs-border);
  margin-bottom: 1rem;
}

.admin-panel-title {
  margin: 0 0 1rem;
  color: var(--bs-primary);
  font-size: 1rem;
}

.admin-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: #475569;
}

.admin-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.crm-form {
  width: 100%;
}

.crm-form-section {
  background: #f8fafc;
  padding: 1.35rem 1.5rem;
  border-radius: var(--bs-radius);
  margin-bottom: 1.25rem;
  border: 1px solid var(--bs-border);
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.crm-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
}

.crm-form-grid,
.doc-meta-grid {
  display: grid;
  gap: 12px;
}

.crm-form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.doc-meta-grid {
  grid-template-columns: minmax(260px, 2fr) minmax(150px, 1fr) minmax(170px, 1fr);
  align-items: start;
}

.doc-lines-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.doc-lines-table {
  min-width: 760px;
}

.doc-row-remove {
  width: 100%;
  min-width: 88px;
}

.crm-action-menu {
  margin-bottom: 15px;
}

.crm-action-menu summary {
  display: none;
  cursor: pointer;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bs-primary);
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 1rem;
  list-style: none;
}

.crm-action-menu summary::-webkit-details-marker {
  display: none;
}

.crm-action-menu-content {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.crm-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.crm-page-title {
  margin: 0;
}

.crm-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crm-simple-search {
  width: 100%;
  margin-bottom: 15px;
}

.crm-list-filter {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
  flex-wrap: wrap;
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
}

.crm-list-filter label {
  font-size: 12px;
  font-weight: bold;
}

.crm-list-filter input,
.crm-list-filter select {
  margin: 0;
}

.crm-table-wrap {
  overflow-x: auto;
}

.crm-table-panel {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--bs-border);
  border-radius: 8px;
  padding: 15px;
}

.crm-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

.btn-row {
  padding: 4px 8px !important;
  font-size: 12px !important;
  white-space: nowrap;
}

th.crm-col-actions,
td.crm-col-actions {
  text-align: right;
  white-space: nowrap;
}

.js-show-on-selection {
  display: none !important;
}

.js-show-on-selection.is-visible {
  display: inline-flex !important;
}

.crm-search-form input[type="text"] {
  min-height: 44px;
}

@media (max-width: 768px) {
  .admin-edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body { font-size: 15px; }
  .app-main { width: min(100% - 1rem, var(--bs-page-width)); }
  .container { padding: 1.15rem; max-width: none; }
  .top-nav-inner { padding: 0.75rem 0; text-align: center; align-items: stretch; }
  .top-nav-logo { justify-content: center; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; width: 100%; }
  .nav-actions {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 0.5rem;
    justify-content: stretch;
  }
  .nav-actions.is-open { display: flex; }
  .nav-actions .nav-btn { width: 100%; }
  .nav-btn,
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .auth-card { padding: 1.5rem; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; max-width: none; }
  .dash-btn { min-height: 78px; font-size: 0.92rem; }
  .dashboard-toolbar--desktop { display: none !important; }
  .nav-dashboard-tools {
    display: contents;
  }
  .crm-action-menu {
    background: #f8fafc;
    border: 1px solid var(--bs-border);
    border-radius: 10px;
    padding: 8px;
  }
  .crm-action-menu summary {
    display: flex;
  }
  .crm-action-menu:not([open]) .crm-action-menu-content {
    display: none;
  }
  .crm-action-menu-content {
    flex-direction: column;
    padding-top: 8px;
  }
  .crm-action-menu-content .btn {
    width: 100%;
  }
  .mobile-hide-relations-secondary,
  .mobile-hide-documents-secondary {
    display: none !important;
  }
  .selection-action-menu:not(.has-selection) {
    display: none;
  }
  .selection-action-menu.has-selection {
    background: transparent;
    border: 0;
    padding: 0;
  }
  .selection-action-menu.has-selection summary {
    display: none;
  }
  .selection-action-menu.has-selection .crm-action-menu-content {
    display: flex;
    padding-top: 0;
  }
  .relations-top-actions {
    width: 100%;
  }
  .relations-top-actions .btn {
    width: 100%;
  }
  .crm-search-form {
    width: 100%;
  }
  .crm-search-form input[type="text"] {
    min-width: 0 !important;
    width: 100%;
  }
  .crm-form-section { padding: 14px; margin-bottom: 14px; }
  .crm-form-grid.two-col,
  .doc-meta-grid {
    grid-template-columns: 1fr;
  }
  .crm-relation-form input,
  .crm-relation-form select,
  .crm-document-form input,
  .crm-document-form select,
  .crm-document-form textarea {
    min-height: 44px;
    font-size: 16px;
  }
  .doc-lines-wrap {
    overflow: visible;
  }
  .doc-lines-table {
    display: table;
    min-width: 0;
    white-space: normal;
    margin-top: 0;
  }
  .doc-lines-table thead {
    display: none;
  }
  .doc-lines-table,
  .doc-lines-table tbody,
  .doc-lines-table tr,
  .doc-lines-table td {
    display: block;
    width: 100%;
  }
  .doc-lines-table tr {
    background: #fff;
    border: 1px solid var(--bs-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  }
  .doc-lines-table td {
    border: 0;
    padding: 7px 0;
  }
  .doc-lines-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--bs-muted);
    margin-bottom: 4px;
  }
  .product-ac-wrap {
    min-width: 0;
  }
  .regel-totaal {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--bs-dark);
  }
}

@media (max-width: 480px) {
  .app-main { width: min(100% - 0.75rem, var(--bs-page-width)); }
  .container { padding: 0.95rem; border-radius: 12px; }
  .dash-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.45rem; line-height: 1.2; }
  h2 { font-size: 1.2rem; }
  .btn { width: 100%; margin: 4px 0; }
  input[type="checkbox"] { transform: scale(1.25); }
}

@media (min-width: 900px) {
  .dash-grid:has(.dash-btn:nth-child(7)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 980px;
  }
}

/* Kasboek spreadsheet grid */
.kasboek-filter-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.kasboek-filter-wrap--compact {
  padding: 10px 12px;
  margin-bottom: 10px;
}
.btn-compact {
  padding: 7px 14px;
  font-size: 13px;
  line-height: 1.2;
  margin: 0;
}
.kasboek-actiebalk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.kasboek-hidden-form {
  display: none;
}
.kasboek-download {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.kasboek-download-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #2563eb;
}
.kasboek-download-forms {
  display: flex;
  gap: 10px 24px;
  flex-wrap: wrap;
}
.kasboek-download-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
}
.kasboek-download-field {
  display: flex;
  align-items: center;
  gap: 4px;
}
.kasboek-download-field label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}
.kasboek-download-field input,
.kasboek-download-field select {
  box-sizing: border-box;
  height: 32px;
  padding: 4px 8px;
  margin: 0;
  font-size: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}
.kasboek-filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.kasboek-filter-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #2563eb;
}
.kasboek-filter-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 13px;
  font-weight: 600;
}
.kasboek-filter .kasboek-filter-badge {
  margin-left: auto;
  align-self: center;
}
.kasboek-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin: 0;
}
.kasboek-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.kasboek-filter-field label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin: 0;
  line-height: 1.2;
}
.kasboek-filter-input {
  box-sizing: border-box;
  height: 38px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  min-width: 150px;
}
.kasboek-filter-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.kasboek-filter-input--jaar {
  min-width: 96px;
  width: 96px;
}
.kasboek-filter-period {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.kasboek-filter-period[hidden],
.kasboek-filter-field[hidden] {
  display: none !important;
}
.kasboek-filter-actions {
  display: flex;
  align-items: flex-end;
  padding-bottom: 1px;
}
.kasboek-filter-actions .btn {
  height: 38px;
  padding: 0 18px;
  margin: 0;
}
.kasboek-bulk-form {
  margin: 0 0 14px;
}
.kasboek-toolbar--bulk {
  margin-bottom: 8px;
}
.kasboek-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.kasboek-toolbar-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.kasboek-grid-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
}
.kasboek-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.25;
}
.kasboek-grid thead th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}
.kasboek-grid thead th:nth-child(4),
.kasboek-grid thead th:nth-child(5) {
  text-align: right;
}
.kasboek-grid tbody td {
  padding: 2px 6px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.kasboek-grid tbody tr:nth-child(even):not(.kasboek-row--new) {
  background: #fafbfc;
}
.kasboek-row--edit td {
  padding: 2px 6px;
}
.kasboek-row--auto td {
  padding: 4px 8px;
}
.kasboek-grid .kasboek-cell,
.kasboek-grid input[type="date"],
.kasboek-grid input[type="text"],
.kasboek-grid input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 3px 6px;
  min-height: 26px;
  height: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.25;
  background: #fff;
}
.kasboek-grid .kasboek-cell:focus,
.kasboek-grid input[type="date"]:focus,
.kasboek-grid input[type="text"]:focus,
.kasboek-grid input[type="number"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.kasboek-cell--amount {
  text-align: right;
  min-width: 88px;
  max-width: 110px;
}
.kasboek-grid col.kasboek-col-datum { width: 118px; }
.kasboek-grid col.kasboek-col-amount { width: 100px; }
.kasboek-grid col.kasboek-col-cb { width: 32px; }
.kasboek-grid col.kasboek-col-type { width: 72px; }
.kasboek-cell--type {
  min-width: 4.5rem;
  padding: 4px 6px;
}
.kasboek-amount {
  text-align: right;
  font-weight: 700;
}
.kasboek-amount--in {
  color: #166534;
}
.kasboek-amount--out {
  color: #991b1b;
}
.kasboek-type {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  white-space: nowrap;
  color: #64748b;
  font-size: 11px;
}
.kasboek-type-label {
  font-size: 11px;
}
.kasboek-type-label--factuur {
  color: #2563eb;
}
.kasboek-type-label--inkoop {
  color: #b45309;
}
.kasboek-type-label--handmatig {
  color: #64748b;
}
.kasboek-row-insert {
  border: none;
  background: #e0f2fe;
  color: #0369a1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.kasboek-row-insert:hover {
  background: #bae6fd;
}
.kasboek-row-remove {
  border: none;
  background: #fee2e2;
  color: #991b1b;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.kasboek-row-remove:hover {
  background: #fecaca;
}
.kasboek-cb {
  width: 32px;
  text-align: center;
}
.kasboek-grid input[type="checkbox"] {
  transform: scale(0.95);
  margin: 0;
}
.kasboek-cb-placeholder {
  display: inline-block;
  width: 14px;
}
.kasboek-total-row td {
  padding: 5px 8px;
  font-weight: 700;
  font-size: 13px;
  border-top: 1px solid #e2e8f0;
}
.kasboek-total-row--beginsaldo td {
  background: #eef2ff;
}
.kasboek-total-row--saldo td {
  background: #ecfdf5;
}
.kasboek-row--new .kasboek-cell {
  background: #f8fafc;
}
.nummering-gear {
  padding: 8px 12px;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


.crm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.crm-modal[hidden] {
  display: none !important;
}
.crm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.crm-modal-box {
  position: relative;
  width: min(100%, 460px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 20px 22px;
}
.crm-modal-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: #0f172a;
}
.crm-modal-hint {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 14px;
}
.crm-modal-form {
  margin: 0;
}
.crm-modal-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.crm-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
  margin: 0;
}
.crm-modal-field span {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}
.crm-modal-field input {
  box-sizing: border-box;
  height: 36px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
}
.crm-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
