*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow: hidden; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}
body::-webkit-scrollbar { display: none; }

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ─── Header (identiek aan admin.css) ────────────────────────────────────── */
.admin-header {
    background: var(--header-bg, var(--primary, #0B1629));
    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: .75rem;
    font-size: .9375rem;
    font-weight: 600;
}
.header-logo {
    height: 28px;
    width: auto;
}
.admin-app-name { font-weight: 700; }
.admin-header-sep { opacity: .5; }
.admin-header-title { opacity: .85; font-weight: 400; }
.header-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.header-user-name {
    color: rgba(255,255,255,.85);
    font-size: .875rem;
    white-space: nowrap;
}
.btn-header {
    background: rgba(255,255,255,.15);
    color: #fff;
    text-decoration: none;
    font-size: .875rem;
    font-family: inherit;
    padding: .375rem .875rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.3);
    white-space: nowrap;
    cursor: pointer;
    display: inline-block;
    transition: background .15s;
}
.btn-header:hover { background: rgba(255,255,255,.25); }

/* ─── Container ──────────────────────────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    width: 100%;
}
.container::-webkit-scrollbar { display: none; }
.back-to-forms {
    display: inline-block;
    margin-bottom: 16px;
    font-size: .85rem;
    color: #64748b;
    text-decoration: none;
}
.back-to-forms:hover { color: #334155; }

/* ─── Home view: flex column zodat submissions altijd zichtbaar zijn ─────── */
.home-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ─── Form list ──────────────────────────────────────────────────────────── */
.forms-section { flex: 1; margin-bottom: 10px; }
.forms-wrap {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
}
.form-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.form-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 8px;
    padding: 18px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.form-card-item h2 { font-size: 1.05rem; color: #1e293b; cursor: default; }
.btn-new-melding {
    background: var(--primary, #cc1111);
    color: #fff;
    text-decoration: none;
    font-size: .875rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    white-space: nowrap;
    transition: background .15s;
}
.btn-new-melding:hover { background: var(--hover, #aa0d0d); }

/* ─── Form ───────────────────────────────────────────────────────────────── */
.form-card {
    background: #fff;
    border-radius: 8px;
    padding: 28px 32px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.form-card h2 { font-size: 1.3rem; margin-bottom: 20px; }

.field { margin-bottom: 20px; }
.field label { display: block; font-weight: bold; font-size: 0.9rem; margin-bottom: 6px; }
.field .hint  { font-size: 0.8rem; color: #888; margin-top: 4px; }
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary, #cc1111);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #cc1111) 20%, transparent);
}
.field textarea { min-height: 100px; resize: vertical; }
.required-star { color: var(--primary, #cc1111); margin-left: 3px; }

.btn-submit {
    background: var(--primary, #cc1111);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 11px 28px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background .15s;
}
.btn-submit:hover  { background: var(--hover, #aa0d0d); }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Back link ─────────────────────────────────────────────────────────── */
.back-to-forms {
    display: inline-block;
    margin-bottom: 16px;
    font-size: .85rem;
    color: #64748b;
    text-decoration: none;
}
.back-to-forms:hover { color: #334155; }

/* ─── Form pills ─────────────────────────────────────────────────────────── */
.form-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.form-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #1e293b;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.form-pill:hover {
    background: color-mix(in srgb, var(--primary, #cc1111) 8%, white);
    border-color: var(--primary, #cc1111);
    color: var(--primary, #cc1111);
}
.form-pill-icon { font-size: 1.1em; font-weight: 300; line-height: 1; }

/* ─── Submissions section ────────────────────────────────────────────────── */
.submissions-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding-top: 12px;
}
.section-title {
    font-size: .8rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.sub-search-row {
    margin-bottom: 12px;
}
.sub-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: .875rem;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}
.sub-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.sub-search-info {
    height: 20px;
    line-height: 20px;
    overflow: hidden;
    font-size: .8125rem;
    color: #94a3b8;
}
.sub-table-wrap {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    flex-shrink: 0;
}
.sub-row-empty td { border-bottom: 1px solid #f1f5f9; }
.sub-table { width: 100%; border-collapse: collapse; }
.sub-table th, .sub-table td { padding: 11px 16px; text-align: left; font-size: .875rem; }
.sub-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.sub-table td { border-bottom: 1px solid #f1f5f9; color: #1e293b; height: 44px; }
.sub-table tr:last-child td { border-bottom: none; }
.sub-row { cursor: pointer; }
.sub-row:hover td { background: #f8fafc; }
.col-actions { width: 60px; text-align: right; white-space: nowrap; }
.col-arrow { color: #94a3b8; }
.btn-sub-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #cbd5e1;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color .15s, background .15s;
    vertical-align: middle;
}
.btn-sub-delete:hover { color: #dc2626; background: #fef2f2; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.badge-open { background: #eff6ff; color: #2563eb; }
.badge-done { background: #f0fdf4; color: #16a34a; }
.empty-text { color: #94a3b8; font-size: .875rem; }

/* ─── Submission detail ──────────────────────────────────────────────────── */
.sub-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.sub-meta { font-size: .875rem; color: #64748b; }
.sub-nr-badge {
    font-size: .8rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
}
.col-nr { width: 70px; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.sub-nr-hover { cursor: default; }
.form-desc { color: #666; margin-bottom: 20px; font-size: .9rem; }
.sub-actions-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.btn-afgehandeld {
    background: none;
    border: 1px solid var(--primary, #2563EB);
    color: var(--primary, #2563EB);
    padding: 11px 20px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background .15s;
}
.btn-afgehandeld:hover { background: rgba(0,0,0,.04); }
.btn-afgehandeld:disabled { opacity: .5; cursor: not-allowed; }
.readonly-notice {
    font-size: .875rem;
    color: #64748b;
    align-self: center;
}
.btn-release {
    background: none;
    border: 1px solid #94a3b8;
    color: #475569;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: .9rem;
    cursor: pointer;
    transition: background .15s;
}
.btn-release:hover { background: #f1f5f9; }
.btn-release:disabled { opacity: .5; cursor: not-allowed; }
.field input:disabled,
.field textarea:disabled,
.field select:disabled {
    background: #f8fafc;
    color: #64748b;
    cursor: default;
}

/* ─── Messages ───────────────────────────────────────────────────────────── */
.msg-success, .msg-error {
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}
.msg-success { background: #f8fafc; color: #334155; border: 1px solid #e2e8f0; }
.msg-error   { background: #fdecea; color: #8b1a1a; border: 1px solid #f5a9a9; }

/* ─── Loading ────────────────────────────────────────────────────────────── */
.loading { text-align: center; color: #888; padding: 40px; }

@media (max-width: 520px) {
    .form-card { padding: 20px 16px; }
    .container { margin: 16px auto; }
}

/* ─── Form preview (hover) ──────────────────────────────────────────────────── */
.form-preview {
    background: #fff;
    border-radius: 0 0 8px 8px;
    padding: 14px 24px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    border: 1px solid #e2e8f0;
    border-top: none;
    margin-top: -4px;
}
.form-preview-heading {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    margin-bottom: 10px;
}
.form-preview-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.form-preview-field {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .9rem;
    color: #334155;
}
.form-preview-required {
    font-size: .7rem;
    font-weight: 600;
    color: var(--primary, #cc1111);
    background: color-mix(in srgb, var(--primary, #cc1111) 10%, white);
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

/* ─── Submission hover preview ───────────────────────────────────────────────── */
.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;
}

/* ─── 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, #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; }

/* ─── Groepsfilter tabs ──────────────────────────────────────────────────────── */
.group-filter-tabs {
    display: flex;
    column-gap: 6px;
    row-gap: 8px;
    flex-wrap: wrap;
    align-content: flex-start;
    min-height: 80px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 2px solid #cbd5e1;
}
.group-filter-tab {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    padding: .275rem .875rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s, border-color .12s, color .12s;
}
.group-filter-tab:hover { background: #f8fafc; border-color: #94a3b8; }
.group-filter-tab.is-active {
    background: var(--primary, #2563EB);
    color: #fff;
    border-color: var(--primary, #2563EB);
}

/* ─── MIB print-knop ─────────────────────────────────────────────────────────── */
.btn-print-pdf {
    display: inline-block;
    background: none;
    border: 1.5px solid var(--primary, #2563EB);
    color: var(--primary, #2563EB);
    padding: 10px 20px;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-print-pdf:hover { background: rgba(0,0,0,.04); }

/* ─── Formulier kop- en voetafbeeldingen ─────────────────────────────────── */
.form-header-img {
    display: block;
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    margin-bottom: 16px;
    border-radius: 6px 6px 0 0;
}
.form-footer-img {
    display: block;
    width: 100%;
    max-height: 120px;
    object-fit: contain;
    margin-top: 20px;
    border-radius: 0 0 6px 6px;
}

/* ─── App-brede header-afbeelding (vervangt navigatiebalk) ──────────────────── */
.app-header-img-wrap {
    flex-shrink: 0;
    width: 100%;
    height: 200px;
    line-height: 0;
    overflow: hidden;
    position: relative;
}
.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, 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-brede voetbanner ───────────────────────────────────────────────────── */
.app-banner-bottom {
    display: block;
    width: 100%;
    height: 50px;
    object-fit: cover;
    object-position: center center;
    background: #fff;
    flex-shrink: 0;
}

/* ─── Paginering ─────────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 10px 0 8px;
    flex-wrap: wrap;
}
.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: .875rem;
    font-family: inherit;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.page-btn:hover:not(:disabled) { background: #f1f5f9; }
.page-btn.is-active { background: var(--primary, #2563EB); color: #fff; border-color: var(--primary, #2563EB); font-weight: 700; }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ─── Submitted thank-you state ─────────────────────────────────────────────── */
.submitted-thanks {
  text-align: center;
  padding: 48px 24px;
}
.submitted-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 2rem;
  margin-bottom: 20px;
}
.submitted-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 10px;
}
.submitted-msg {
  font-size: 1rem;
  color: #475569;
  margin: 0 0 24px;
}
.submitted-back {
  display: inline-block;
  font-size: .875rem;
  color: var(--primary, #2563EB);
  text-decoration: none;
}
.submitted-back:hover { text-decoration: underline; }

.submitted-promo {
  margin-top: 24px;
  font-size: .8rem;
  color: #94a3b8;
}
.submitted-promo a { color: #64748b; }
.submitted-promo a:hover { color: #2563EB; }
