:root {
    /* Relight-huisstijl: wit, donker navy/antraciet, felle cyaan accentkleur */
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #e2e7ec;
    --ink: #16202e;
    --ink-muted: #5b6672;
    --accent: #00a7e1;
    --accent-ink: #ffffff;
    --accent-hover: #0090c4;
    --danger: #d5342a;
    --danger-soft: #fdecea;
    --success: #1f9d55;
    --success-soft: #e7f6ee;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

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

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(22, 32, 46, 0.04);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.75rem;
}
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--ink); }
.brand span { color: var(--accent); }
.mainnav { display: flex; align-items: center; gap: 1.15rem; flex: 1; flex-wrap: wrap; }
.mainnav a {
    color: var(--ink-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.mainnav a:hover { color: var(--accent); text-decoration: none; }

/* Uitklapmenu (details/summary, werkt zonder JS) */
.navdrop { position: relative; }
.navdrop summary {
    list-style: none;
    cursor: pointer;
    color: var(--ink-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.navdrop summary::-webkit-details-marker { display: none; }
.navdrop summary::after { content: "▾"; font-size: 0.7em; }
.navdrop[open] summary,
.navdrop summary:hover { color: var(--accent); }
.navdrop-menu {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    min-width: 10rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(22, 32, 46, 0.12);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    z-index: 20;
}
.navdrop-menu a {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
}
.navdrop-menu a:hover { background: var(--bg); color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; }

.content {
    max-width: 72rem;
    margin: 0 auto;
    padding: 2rem 1.75rem 4rem;
}

h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 7px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--ink-muted); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b52b22; }
.btn-small { padding: 0.32rem 0.65rem; font-size: 0.8rem; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.9rem;
}
th, td {
    text-align: left;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--bg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
td.actions { white-space: nowrap; text-align: right; }
td.actions a, td.actions button { margin-left: 0.5rem; }

.empty-row td { text-align: center; color: var(--ink-muted); padding: 2rem; }

form.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    max-width: 34rem;
}
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--ink-muted); }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--ink);
    font-size: 0.9rem;
    font-family: inherit;
}
.field textarea { min-height: 5rem; resize: vertical; }
.field-checkbox { display: flex; align-items: center; gap: 0.5rem; }
.field-checkbox label { margin: 0; }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }

.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.5rem 1rem;
    margin-top: 0.5rem;
}
.field-hint { font-size: 0.78rem; color: var(--ink-muted); margin-top: 0.25rem; }

.form-actions { display: flex; gap: 0.6rem; margin-top: 1.25rem; }

.flash {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
}
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem 2.25rem;
    width: 22rem;
}
.login-card h1 { text-align: center; margin-bottom: 1.5rem; }
.login-card h1 span { color: var(--accent); }
.login-logo { display: block; max-width: 12rem; height: auto; margin: 0 auto 1.25rem; }

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-beheerder { background: var(--accent); color: #fff; }
.badge-gebruiker { background: var(--border); color: var(--ink-muted); }

/* --- Testresultaat-veld in het formulier --- */
.testresultaat-veld {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 0 1rem;
}
.testresultaat-veld legend { font-size: 0.82rem; font-weight: 700; color: var(--ink-muted); padding: 0 0.4rem; }
.testresultaat-huidig { margin-bottom: 1rem; }
.testresultaat-huidig img {
    display: block;
    max-width: 100%;
    max-height: 12rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

/* --- Certificaat-weergave (print) --- */
.cert-actions { display: flex; gap: 0.6rem; margin-bottom: 1.25rem; }

.certificate {
    background: #fff;
    color: #000;
    max-width: 50rem;
    margin: 0 auto;
    padding: 2.5rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.cert-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #000;
    padding-bottom: 0.6rem;
    margin-bottom: 1.25rem;
}
.cert-brand { font-weight: 800; font-size: 1.4rem; letter-spacing: 0.02em; }
.cert-nummer { font-size: 0.9rem; }
.cert-title { font-size: 1.5rem; text-align: center; margin: 0 0 1.5rem; }

.cert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.5rem; }
.cert-field {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}
.cert-field span { color: #555; }
.cert-field b { text-align: right; }
.cert-field-block { flex-direction: column; align-items: flex-start; }
.cert-field-block b { text-align: left; }

.cert-remarks {
    border: 1px solid #000;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 1.5rem 0 0;
    font-size: 0.9rem;
}
.cert-remarks div { margin-top: 0.35rem; }
.cert-validity { font-weight: 700; font-size: 0.9rem; margin: 1.25rem 0; }

.cert-image { margin: 1.5rem 0 0; text-align: center; }
.cert-image img { max-width: 100%; border: 1px solid var(--border); border-radius: 4px; }
.cert-image figcaption { font-size: 0.8rem; color: #555; margin-top: 0.4rem; }

.cert-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
    font-size: 0.9rem;
}
.cert-footer span { color: #555; }

.cert-copyright {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: 0.8rem;
    color: #555;
}
.cert-copyright img { height: 30px; width: auto; }

/* --- Sitebrede footer --- */
.sitefooter {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid var(--border);
    color: var(--ink-muted);
    font-size: 0.85rem;
}
.sitefooter-logo { height: 34px; width: auto; }
@media print { .sitefooter { display: none !important; } }

@media print {
    @page { margin: 1.4cm; }
    html, body { background: #fff; }
    .topbar, .cert-actions, .flash, .no-print { display: none !important; }
    .content { max-width: none; padding: 0; margin: 0; }
    .certificate {
        max-width: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }
    .cert-image { break-inside: avoid; }
}
