:root {
  --primary:       #2563EB;
  --primary-hover: #1D4ED8;
  --header-bg:     #0B1629;
  --radius:        10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.admin-header {
  background: var(--header-bg, var(--primary));
  color: #fff;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.admin-header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9375rem;
  font-weight: 600;
}

.admin-header-brand img {
  height: 24px;
  width: auto;
  filter: brightness(0) invert(1);
}

#header-app-name { font-weight: 700; }

.admin-header-sep { opacity: .5; }

.admin-header-title { opacity: .85; font-weight: 400; }

.header-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.header-user-name {
  color: rgba(255,255,255,.85);
  font-size: .875rem;
}

.btn-header {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  text-decoration: none;
  padding: .375rem .875rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  display: inline-block;
  transition: background .15s;
}
.btn-header:hover { background: rgba(255,255,255,.25); }

.btn-logout {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: .375rem .875rem;
  border-radius: var(--radius);
  font-size: .875rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

.back-to-forms {
  display: inline-block;
  margin-bottom: 16px;
  font-size: .85rem;
  color: #64748b;
  text-decoration: none;
}
.back-to-forms:hover { color: #334155; }

/* ─── Main ───────────────────────────────────────────────────────────────────── */
.admin-main {
  width: min(1200px, calc(100% - 4rem));
  margin: 2.5rem auto;
  padding: 0 0 4rem;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.admin-page-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.02em;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: .625rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: .7; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  color: #475569;
  border: 1.5px solid #e2e8f0;
  padding: .625rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

/* ─── New user panel ─────────────────────────────────────────────────────────── */
.new-user-panel {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 600px) {
  .form-row,
  .form-row-3 { grid-template-columns: 1fr; }
}

.field label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #475569;
  margin-bottom: .375rem;
}

.field input {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: calc(var(--radius) - 2px);
  font-size: .9375rem;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color .15s, background .15s, box-shadow .15s;
  outline: none;
}
.field input::placeholder { color: #cbd5e1; }
.field input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
.field input.is-invalid {
  border-color: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244,63,94,.12);
}

.form-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-top: .25rem;
}

/* ─── Messages ───────────────────────────────────────────────────────────────── */
.error-message {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #e11d48;
  border-radius: calc(var(--radius) - 2px);
  padding: .625rem 1rem;
  font-size: .875rem;
  margin-bottom: .75rem;
}

.success-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  border-radius: calc(var(--radius) - 2px);
  padding: .625rem 1rem;
  font-size: .875rem;
  margin-bottom: .75rem;
}

.loading-text, .empty-text {
  color: #64748b;
  font-size: .9375rem;
  padding: 1rem 0;
}

/* ─── Table wrapper (enables horizontal scroll on small screens) ─────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border: 1.5px solid #e2e8f0;
}

/* ─── Table ──────────────────────────────────────────────────────────────────── */
#users-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
  font-size: .9375rem;
}

#users-table thead tr {
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}

#users-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  white-space: nowrap;
}

#users-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

#users-table tbody tr:last-child td { border-bottom: none; }

#users-table tbody tr:hover { background: #fafbff; }

.email-cell {
  color: #475569;
  font-size: .875rem;
}

.muted {
  color: #94a3b8;
  font-size: .875rem;
  white-space: nowrap;
}

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .625rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

.badge-status {
  min-width: 4.5rem;
  text-align: center;
}

.badge-totp {
  min-width: 7.25rem;
  text-align: center;
}

.name-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

/* ─── Action buttons ─────────────────────────────────────────────────────────── */
.actions-cell { white-space: nowrap; }

/* kept for potential backward compat; table now uses .status-date inline */
.deactivated-date {
  font-size: .75rem;
  color: #94a3b8;
}

.btn-toggle-user-status,
.btn-toggle-form        { min-width: 7rem; text-align: center; }
.btn-send-magic-link    { min-width: 6rem; text-align: center; }

.btn-action {
  background: none;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  padding: .3rem .75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  margin-right: .5rem;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-action:last-child { margin-right: 0; }
.btn-action:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.btn-action-disabled,
.btn-action:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn-toggle-admin,
.btn-toggle-form {
  display: inline-block;
  width: 7.5rem;
  text-align: center;
  white-space: nowrap;
}

/* ─── Edit panel ─────────────────────────────────────────────────────────────── */
.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.panel-header-row .panel-title {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.btn-panel-close {
  flex-shrink: 0;
}

.btn-panel-close {
  background: none;
  border: none;
  font-size: 1.125rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: .25rem .5rem;
  border-radius: calc(var(--radius) - 2px);
  transition: color .12s, background .12s;
}
.btn-panel-close:hover { color: #475569; background: #f1f5f9; }

.panel-divider {
  border: none;
  border-top: 1.5px solid #f1f5f9;
  margin: 1.5rem 0;
}

.edit-actions {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.edit-action-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.edit-action-label {
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #475569;
  min-width: 9rem;
  flex-shrink: 0;
}

.edit-action-state {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
}

.status-date-inline {
  font-size: .8125rem;
  color: #94a3b8;
}

/* Inline date in table status cell */
.status-date {
  font-size: .8125rem;
  color: #94a3b8;
  margin-left: .375rem;
}


/* ─── Auth method button group ───────────────────────────────────────────────── */
.auth-method-group {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1.5px solid #e2e8f0;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: #f8fafc;
}

.auth-method-btn {
  min-width: 7.5rem;
  padding: .35rem .875rem;
  border: none;
  border-right: 1.5px solid #e2e8f0;
  background: transparent;
  color: #64748b;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
  line-height: 1.4;
  text-align: center;
}
.auth-method-btn:last-child { border-right: none; }
.auth-method-btn:hover:not(.is-active) { background: #fff; color: #334155; }
.auth-method-btn.is-active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.auth-method-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ─── Auth section grouping ──────────────────────────────────────────────────── */
.edit-action-section {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* ─── System page ────────────────────────────────────────────────────────────── */
.system-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.system-card .field {
  margin-bottom: 1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ─── Tab navigation ─────────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: .625rem 1.375rem;
  font-size: .9rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s;
}

.admin-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-tab:hover:not(.is-active) { color: #334155; }

/* ─── Forms management table ─────────────────────────────────────────────────── */
#forms-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .9375rem;
}

#forms-table thead tr {
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}

#forms-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #64748b;
  white-space: nowrap;
}

#forms-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

#forms-table tr:last-child td { border-bottom: none; }

/* ─── Verzonden links table ──────────────────────────────────────────────────── */
#sends-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
  font-size: .9375rem;
}
#sends-table thead tr {
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}
#sends-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #64748b;
  white-space: nowrap;
}
#sends-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
#sends-table tr:last-child td { border-bottom: none; }
#sends-table tbody tr:hover   { background: #fafbff; }

/* ─── Template cards ─────────────────────────────────────────────────────────── */
.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.template-card {
  border: 1.5px solid #e2e8f0;
  border-radius: calc(var(--radius) - 2px);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.template-card:hover,
.template-card.is-selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, white);
}

.template-card-name {
  font-weight: 700;
  font-size: .9rem;
  color: #0f172a;
}

.template-card-meta {
  font-size: .75rem;
  color: #94a3b8;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.template-card-desc {
  font-size: .82rem;
  color: #64748b;
  margin-top: 5px;
}

.install-subtitle {
  font-size: .875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 1rem;
}

.hint {
  font-size: .8rem;
  color: #94a3b8;
  margin-top: 4px;
}

.btn-link {
  background: none;
  border: none;
  color: rgba(255,255,255,.85);
  font-size: .875rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.btn-link:hover { color: #fff; }

/* ─── Desktop: tabel vult container exact, geen scrollbar ───────────────────── */
@media (min-width: 900px) {
  .table-wrapper {
    overflow-x: hidden;
  }
  #users-table {
    min-width: unset;
    width: 100%;
  }
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .admin-main {
    padding: 0 1.25rem 3rem;
    margin-top: 1.75rem;
  }

  .admin-header {
    padding: 0 1.25rem;
  }

  .new-user-panel {
    padding: 1.25rem;
  }
}

@media (max-width: 600px) {
  .admin-header-title { display: none; }
  .admin-header-sep   { display: none; }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: .875rem;
  }

  .admin-page-title { font-size: 1.125rem; }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .form-actions {
    flex-direction: column;
  }

  #users-table {
    font-size: .875rem;
  }

  #users-table th,
  #users-table td {
    padding: .625rem .75rem;
  }

  .btn-action {
    font-size: .75rem;
    padding: .25rem .5rem;
  }

  /* ─── Edit panel acties ──────────────────────────────────────────────────────── */
  .edit-action-row {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }
  .edit-action-label { min-width: unset; }
  #edit-row-authenticator .edit-action-label { display: none; }

  .edit-action-state {
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
  }

  .auth-method-group { display: flex; }
  .auth-method-btn   { flex: 1; min-width: 0; padding: .35rem .5rem; }

  #edit-auth-method-group { display: flex; flex-direction: column; }
  #edit-auth-method-group .auth-method-btn {
    border-right: none;
    border-bottom: 1.5px solid #e2e8f0;
  }
  #edit-auth-method-group .auth-method-btn:last-child { border-bottom: none; }

}

/* ─── Confirm dialog ─────────────────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.confirm-dialog {
  background: #fff;
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.confirm-message {
  font-size: .9375rem;
  color: #1e293b;
  line-height: 1.5;
  margin-bottom: 20px;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.confirm-btn-ok {
  background: var(--primary, #cc1111);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .5rem 1.25rem;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.confirm-btn-ok:hover { background: var(--hover, var(--primary-hover, #aa0d0d)); }
.confirm-btn-cancel {
  background: none;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: .5rem 1.25rem;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.confirm-btn-cancel:hover { background: #f8fafc; color: #334155; }

/* ─── Delete form button ─────────────────────────────────────────────────────── */
.btn-delete-form {
  background: none;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
  font-size: .8125rem;
  font-weight: 600;
  font-family: inherit;
  padding: .3rem .75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.btn-delete-form:hover { background: #fef2f2; }
.btn-delete-form:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Settings group title ───────────────────────────────────────────────────── */
.settings-group-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  margin: 1.75rem 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid #e2e8f0;
}

/* ─── Standaard-preview in instellingen ──────────────────────────────────── */
.img-is-default {
  opacity: .8;
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  display: block;
}

.preview-default-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

.preview-default-panel {
  width: 100%;
  height: 100%;
  min-height: 80px;
  background: #0B1629;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.preview-default-logo {
  max-width: 55%;
  filter: brightness(0) invert(1);
  opacity: .75;
}

/* ─── App-instellingen editor (overschrijft flex van .form-images-editor) ─── */
#app-settings-editor {
  display: block;
  background: transparent;
  padding: 0;
  max-width: none;
}

#app-settings-editor .settings-group-title:first-of-type { margin-top: 1.5rem; }

.settings-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto 1fr;
  column-gap: 1.5rem;
  row-gap: 0;
  margin-bottom: 1rem;
}

.settings-pair .image-section {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  min-width: 0;
  flex: none;
}

.image-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 10px;
}

#app-settings-editor .image-preview-wrap {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .settings-pair {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .settings-pair .image-section {
    grid-row: span 1;
    grid-template-rows: auto auto 1fr;
    margin-bottom: 1rem;
  }
}

/* ─── Verwijderde formulieren tabel ─────────────────────────────────────────── */
#forms-trash-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .9375rem;
}

#forms-trash-table thead tr {
  background: #fef9f9;
  border-bottom: 1.5px solid #fee2e2;
}

#forms-trash-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #94a3b8;
  white-space: nowrap;
}

#forms-trash-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid #fef2f2;
  vertical-align: middle;
}

#forms-trash-table tr:last-child td { border-bottom: none; }

/* ─── Prullenbak ─────────────────────────────────────────────────────────────── */
.admin-section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #94a3b8;
  margin: 2rem 0 .75rem;
}

#trash-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .9375rem;
}

#trash-table thead tr {
  background: #fef9f9;
  border-bottom: 1.5px solid #fee2e2;
}

#trash-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #94a3b8;
  white-space: nowrap;
}

#trash-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid #fef2f2;
  vertical-align: middle;
}

#trash-table tr:last-child td { border-bottom: none; }

.trash-detail-row td { padding: 0; }
.trash-detail-cell {
  padding: 12px 20px 16px !important;
  background: #fafafa;
  border-bottom: 1px solid #f1f5f9 !important;
}

.trash-sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.trash-sub-table th {
  padding: .4rem .75rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  border-bottom: 1px solid #e2e8f0;
}

.trash-sub-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.trash-sub-table tr:last-child td { border-bottom: none; }

/* ─── Groepen beheer ─────────────────────────────────────────────────────────── */
.groups-section { margin-bottom: 1.75rem; }

.groups-panel {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 20px 20px;
}

.groups-create-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: 0;
}

.groups-input {
  flex: 1;
  max-width: 320px;
  padding: .4375rem .75rem;
  border: 1.5px solid #e2e8f0;
  border-radius: calc(var(--radius) - 2px);
  font-size: .875rem;
  color: #0f172a;
  font-family: inherit;
  background: #f8fafc;
  outline: none;
  transition: border-color .15s;
}
.groups-input:focus { border-color: var(--primary); background: #fff; }

.groups-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}

.groups-empty-msg {
  font-size: .8125rem;
  color: #94a3b8;
  margin: 12px 0 0;
}

.group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: #f8fafc;
  border: 1px solid #e8edf3;
  border-radius: 7px;
  padding: .5rem .75rem;
}

.group-item-title {
  font-size: .875rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  min-width: 0;
}

.group-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.nr-cell {
  white-space: nowrap;
  vertical-align: middle;
}
.nr-cell-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.form-prefix-val {
  display: inline-block;
  min-width: 42px;
}
.form-next-nr {
  font-size: .875rem;
  font-weight: 600;
  color: #1e293b;
  min-width: 54px;
  font-variant-numeric: tabular-nums;
}
.savepath-cell {
  max-width: 220px;
}
.form-savepath-val {
  font-size: .8rem;
  color: #475569;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}
.nr-edit-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.trash-sub-nr {
  font-size: .8rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  cursor: default;
}

.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  padding: 0;
  line-height: 1;
}
.btn-icon-action:hover { background: #f1f5f9; color: #1e293b; border-color: #cbd5e1; }
.btn-icon-action.btn-icon-delete { color: #dc2626; border-color: #fecaca; background: #fff5f5; }
.btn-icon-action.btn-icon-delete:hover { background: #fee2e2; border-color: #fca5a5; }

/* ─── Groep select in formulierentabel ───────────────────────────────────────── */
.group-select {
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  padding: .25rem .5rem;
  font-size: .8125rem;
  color: #334155;
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  max-width: 180px;
  outline: none;
  transition: border-color .15s;
}
.group-select:focus { border-color: var(--primary); }
.group-select:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Formulier-afbeeldingen editor ──────────────────────────────────────────── */
.form-images-cell { padding: 0 !important; border-bottom: 2px solid #e2e8f0 !important; }

.form-images-editor {
  padding: 16px 20px 20px;
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.image-section {
  flex: 1;
  min-width: 260px;
}

.image-section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  margin-bottom: 8px;
}

.image-preview-wrap {
  width: 100%;
  min-height: 80px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
}

.image-preview-wrap img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  display: block;
}

.image-preview-placeholder {
  font-size: .8rem;
  color: #94a3b8;
  padding: 16px;
  text-align: center;
}

.image-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin-right: 6px;
}

.image-save-row {
  display: flex;
  gap: 8px;
  align-items: center;
  align-self: flex-end;
  padding-bottom: 2px;
}

.btn-danger {
  background: none;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
  padding: .3rem .75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.btn-danger:hover { background: #fef2f2; }
.btn-danger:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Instellingen sectie ─────────────────────────────────────────────────── */
.section-desc { font-size: .875rem; color: #64748b; margin-top: 4px; }
.image-dim-hint { font-size: .75rem; color: #94a3b8; white-space: nowrap; align-self: center; }

/* ─── App-brede header-afbeelding (gedeeld met frontend) ─────────────────── */
.app-header-img-wrap { position: sticky; top: 0; z-index: 10; width: 100%; height: 200px; line-height: 0; overflow: hidden; flex-shrink: 0; }
.app-header-img { display: block; width: 100%; height: 200px; object-fit: cover; object-position: center center; }
.app-header-overlay {
  position: absolute; top: 12px; right: 16px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.45); padding: 6px 14px; border-radius: 24px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.app-header-overlay-name {
  color: #fff; font-size: .8rem; font-weight: 500;
  white-space: nowrap; margin-right: 2px;
}
.btn-overlay {
  box-sizing: border-box; display: inline-flex; align-items: center;
  justify-content: center; height: 28px; padding: 0 14px;
  background: #fff; color: #1e293b; border: none; border-radius: 5px;
  font-size: .78rem; font-weight: 600; font-family: inherit; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s;
}
.btn-overlay:hover { background: #e2e8f0; }
.app-banner-bottom {
  display: block; width: 100%; height: 50px;
  object-fit: cover; object-position: center center;
  background: #fff; position: sticky; bottom: 0; flex-shrink: 0;
}

/* ─── Submission hover preview (trash panel) ────────────────────────────── */
.sub-preview-tooltip {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 14px 16px 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,.10);
  pointer-events: none;
  overflow-y: auto;
}
.sub-preview-tooltip::-webkit-scrollbar { width: 5px; }
.sub-preview-tooltip::-webkit-scrollbar-track { background: transparent; }
.sub-preview-tooltip::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.sub-preview-fields { display: flex; flex-direction: column; gap: 10px; }
.sub-preview-field  { display: block; }
.sub-preview-label  { display: block; font-weight: 600; color: #64748b; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; word-break: break-word; }
.sub-preview-value  { display: block; color: #1e293b; font-size: .85rem; word-break: break-word; overflow-wrap: anywhere; }
.sub-preview-empty { font-size: .875rem; color: #94a3b8; }
.form-preview-heading {
  font-weight: 700; font-size: .8125rem; color: #94a3b8;
  letter-spacing: .06em; text-transform: uppercase; margin: 0 0 10px;
}
.trash-sub-name { cursor: default; user-select: none; }

/* ─── Kleurpicker instellingen ───────────────────────────────────────────────── */
.settings-color-section {
  width: 100%;
}

.color-setting-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 16px;
}

.color-setting-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker-input {
  width: 48px;
  height: 36px;
  padding: 2px 3px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
}

.color-btn-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-preview-swatch {
  display: inline-block;
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
}

/* ─── Formulier bewerken paneel ──────────────────────────────────────────────── */
.form-edit-detail-row td { padding: 0; }

.form-edit-cell {
  padding: 0 0 20px !important;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0 !important;
}

.form-edit-panel-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px 12px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  margin-bottom: 16px;
}

.form-edit-panel-title {
  font-size: .95rem;
  font-weight: 700;
  color: #f1f5f9;
}

.form-edit-panel-slug {
  font-size: .78rem;
  color: #94a3b8;
  font-family: monospace;
  flex: 1;
}

.form-edit-panel-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: .7;
}
.form-edit-panel-close:hover { opacity: 1; }

.form-edit-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 20px;
}

.form-edit-block {
  background: #fff;
  border: 1.5px solid #e8edf3;
  border-radius: 8px;
  padding: 14px 16px 16px;
}

.form-edit-block-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #64748b;
  margin-bottom: 10px;
}

.form-edit-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-edit-lbl {
  font-size: .8125rem;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.form-edit-saved-msg {
  font-size: .8rem;
  color: #16a34a;
  font-weight: 500;
  min-width: 80px;
}

.form-edit-footer {
  margin-top: 16px;
  padding: 12px 20px 0;
  border-top: 1px solid #e2e8f0;
}

.form-edit-block .form-images-editor {
  background: transparent;
  padding: 0;
}

.form-edit-block .image-save-row {
  align-self: center;
  padding-bottom: 0;
}


/* ─── Magic link modal ─────────────────────────────────────────────────────────── */
.ml-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.ml-modal {
  background: #fff; border-radius: 14px;
  width: 92%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 12px 56px rgba(0,0,0,.28);
}
.ml-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 0;
}
.ml-modal-header h2 {
  margin: 0; font-size: 1.0625rem; font-weight: 700; color: #0f172a;
}
.ml-close-btn {
  background: none; border: none; font-size: 1.4rem; color: #64748b;
  cursor: pointer; padding: 2px 8px; border-radius: 6px; line-height: 1;
}
.ml-close-btn:hover { background: #f1f5f9; color: #1e293b; }

/* ─── Toast notificaties ─────────────────────────────────────────────────────── */
.admin-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px; border-radius: 8px;
  font-size: .875rem; font-weight: 500; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.admin-toast--visible { opacity: 1; transform: translateY(0); }
.admin-toast--error   { background: #dc2626; }
.admin-toast--success { background: #16a34a; }
.admin-toast--info    { background: #2563eb; }

.ml-tabs {
  display: flex; padding: 14px 24px 0;
  border-bottom: 2px solid #e2e8f0;
}
.ml-tab {
  background: none; border: none;
  padding: 7px 14px; font-size: .875rem; font-weight: 600;
  color: #64748b; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -2px;
  font-family: inherit;
}
.ml-tab.active { color: var(--primary,#2563EB); border-bottom-color: var(--primary,#2563EB); }

.ml-tab-panel { padding: 20px 24px 24px; }
.ml-desc { font-size: .875rem; color: #475569; margin: 0 0 16px; line-height: 1.5; }
.ml-template-btn { font-size: .8rem; margin-top: 6px; display: inline-block; }

.ml-field { margin-bottom: 12px; }
.ml-label { display: block; font-size: .875rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.ml-optional { font-weight: 400; color: #9ca3af; }
.ml-input {
  width: 100%; box-sizing: border-box;
  padding: .5rem .75rem; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: .875rem; color: #1e293b; background: #fff; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.ml-input:focus { border-color: var(--primary,#2563EB); }
.ml-input.is-invalid { border-color: #ef4444; }
.ml-paste { resize: vertical; min-height: 80px; font-family: monospace; font-size: .8rem; }

.ml-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.ml-btn-primary {
  background: var(--primary,#2563EB); color: #fff; border: none;
  border-radius: 8px; padding: .5rem 1.25rem;
  font-size: .875rem; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background .15s;
}
.ml-btn-primary:hover { background: var(--primary-hover,#1D4ED8); }
.ml-btn-primary:disabled { opacity: .6; cursor: default; }
.ml-btn-secondary {
  background: none; color: #64748b; border: 1.5px solid #e2e8f0;
  border-radius: 8px; padding: .5rem 1.25rem;
  font-size: .875rem; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s;
}
.ml-btn-secondary:hover { background: #f8fafc; color: #334155; }
.ml-btn-full { width: 100%; margin-top: 10px; }
.ml-btn-link {
  background: none; border: none; padding: 0;
  color: var(--primary,#2563EB); font-size: .875rem; font-family: inherit; cursor: pointer;
}
.ml-btn-link:hover { text-decoration: underline; }

.ml-drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 2px dashed #cbd5e1; border-radius: 10px; padding: 22px 16px;
  text-align: center; cursor: pointer; font-size: .875rem; color: #64748b;
  transition: border-color .15s, background .15s;
}
.ml-drop-zone:hover, .ml-drop-zone.dragover {
  border-color: var(--primary,#2563EB); background: #eff6ff; color: #2563EB;
}
.ml-drop-icon { font-size: 2rem; }

.ml-separator {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0; color: #94a3b8; font-size: .8rem;
}
.ml-separator::before, .ml-separator::after {
  content: ""; flex: 1; height: 1px; background: #e2e8f0;
}

.ml-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.ml-preview-count { font-size: .875rem; font-weight: 600; color: #374151; }
.ml-table-wrapper {
  max-height: 220px; overflow-y: auto;
  border: 1.5px solid #e2e8f0; border-radius: 8px; margin-bottom: 4px;
}
.ml-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ml-table th {
  background: #f8fafc; padding: 7px 10px; text-align: left;
  font-weight: 600; color: #475569; border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0;
}
.ml-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; color: #1e293b; }
.ml-table tr:last-child td { border-bottom: none; }
.ml-status-pending { color: #94a3b8; }
.ml-status-ok { color: #16a34a; font-weight: 600; }
.ml-status-error { color: #dc2626; font-size: .8rem; }

/* ─── Badge blauw (extern) ────────────────────────────────────────────────────── */
.badge-blue { background: #dbeafe; color: #1d4ed8; }

/* ─── Nieuw formulier modal ────────────────────────────────────────────────────── */
.nf-fieldset {
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  padding: 12px 14px 10px; margin: 0 0 14px;
}
.nf-fieldset legend { padding: 0 4px; }
.nf-radio-label {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .875rem; cursor: pointer; padding: 4px 0;
}
.nf-radio-label input[type="radio"] { margin-top: 2px; accent-color: var(--primary, #2563EB); }

/* toolbar met knop naast titel */
.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
