/* CursAd Control Center */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --ink: #1c2330;
    --muted: #5d6778;
    --line: #dfe3ea;
    --brand: #14365c;
    --brand-ink: #ffffff;
    --accent: #1f6fd0;
    --ok-bg: #e4f4e9; --ok-ink: #17592e;
    --warn-bg: #fdf1d8; --warn-ink: #7a5200;
    --err-bg: #fbe5e3; --err-ink: #8f1d15;
    --off-bg: #e9ecf1; --off-ink: #4a5361;
    --radius: 6px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12161d; --surface: #1b212b; --ink: #e7ebf1; --muted: #9ba6b6; --line: #2e3745;
        --brand: #0e2440; --accent: #6cabf5;
        --ok-bg: #173524; --ok-ink: #9fdcb3;
        --warn-bg: #3d2f0d; --warn-ink: #f0cd7c;
        --err-bg: #431a17; --err-ink: #f5aaa3;
        --off-bg: #2a313d; --off-ink: #b3bcc9;
    }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 0.9375rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; line-height: 1.25; }
h2 { font-size: 1.125rem; margin: 2rem 0 0.75rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.875rem; }
.small { font-size: 0.75rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Kop */
.topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
    background: var(--brand); color: var(--brand-ink); padding: 0.625rem 1.25rem;
}
.topbar a { color: inherit; }
.brand { font-weight: 600; white-space: nowrap; }
.brand-mark {
    display: inline-block; background: #fff; color: #14365c; border-radius: 4px;
    padding: 0 0.375rem; margin-right: 0.375rem; font-weight: 700; letter-spacing: 0.04em;
}
.mainnav { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }
.mainnav a { padding: 0.25rem 0.625rem; border-radius: var(--radius); opacity: 0.85; }
.mainnav a:hover, .mainnav a.current { background: rgba(255, 255, 255, 0.16); opacity: 1; text-decoration: none; }
.usermenu { display: flex; align-items: center; gap: 0.625rem; }
.usermenu .tag { background: rgba(255, 255, 255, 0.16); color: inherit; }
.usermenu .btn-quiet { background: transparent; color: inherit; border-color: rgba(255, 255, 255, 0.4); }
.usermenu { margin-left: auto; }
@media (max-width: 760px) { .mainnav { order: 3; flex-basis: 100%; } }

.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.pagehead h1, .pagehead h2 { margin: 0; }
.crumbs { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.875rem; }

/* Knoppen */
.btn {
    display: inline-block; padding: 0.4375rem 0.875rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: #1f5fb4; border-color: #1f5fb4; color: #fff; }
.btn-primary:hover { background: #184f98; }
.btn-danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn-quiet { background: transparent; }
.btn-primary:hover, .btn-danger:hover { border-color: transparent; }
.btn-wide { width: 100%; margin-top: 1rem; }
.linkbutton { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkbutton:hover { text-decoration: underline; }
form.inline { display: inline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Meldingen */
.notice { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.notice ul { margin: 0; padding-left: 1.25rem; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice-error { background: var(--err-bg); color: var(--err-ink); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; color: var(--muted); }

/* Tabellen */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5625rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: 0.8125rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
th.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * + * { margin-left: 0.75rem; }

/* Labels */
.tag, .status { display: inline-block; padding: 0.0625rem 0.5rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.tag { background: var(--off-bg); color: var(--off-ink); }
.tag-p { background: var(--err-bg); color: var(--err-ink); }
.tag-ota { background: var(--warn-bg); color: var(--warn-ink); }
.status-actief { background: var(--ok-bg); color: var(--ok-ink); }
.status-in_aanbouw, .status-opgeschort { background: var(--warn-bg); color: var(--warn-ink); }
.status-vervallen { background: var(--off-bg); color: var(--off-ink); }

/* Kerncijfers en filters */
.stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1.25rem; min-width: 9rem; }
.stat-value { display: block; font-size: 1.75rem; font-weight: 600; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 0.875rem; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: 0.1875rem; font-size: 0.8125rem; color: var(--muted); }

/* Formulieren */
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
    width: 100%; padding: 0.4375rem 0.625rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); font: inherit;
}
.filters input, .filters select { width: auto; min-width: 10rem; }
.form { max-width: 34rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.form label, .authcard label { display: block; font-weight: 500; margin: 0.875rem 0 0.25rem; }
.form > input[type=hidden]:first-child + label, .form > input[type=hidden]:first-child + .fieldrow label, .form > input[type=hidden]:first-child + h2 { margin-top: 0; }
.form label.check, .authcard label.check { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; }
.hint { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--muted); }
.formactions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1.25rem; }
.pagehead .formactions { margin-top: 0; }
.danger { max-width: 34rem; margin-top: 2rem; padding: 1.25rem; border: 1px solid var(--err-ink); border-radius: var(--radius); }
.danger h2 { margin-top: 0; }
.details { display: grid; grid-template-columns: 11rem 1fr; gap: 0.375rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 0 0 1.5rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
@media (max-width: 560px) { .details { grid-template-columns: 1fr; } .details dd { margin-bottom: 0.5rem; } }

/* Inloggen */
.authpage { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.authcard { width: 100%; max-width: 24rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.75rem; }
.authbrand { font-weight: 600; margin-bottom: 1.25rem; }
.authbrand .brand-mark { background: #14365c; color: #fff; }
.authcard .code { font-size: 1.5rem; letter-spacing: 0.3em; text-align: center; }
.steps { padding-left: 1.25rem; }
.qr { display: block; margin: 1rem auto 0.5rem; background: #fff; padding: 0.5rem; border-radius: var(--radius); }
.secret { text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 0.875rem; overflow-wrap: anywhere; }

/* Bladeren */
.pagination { display: flex; gap: 0.25rem; list-style: none; padding: 0; margin: 1rem 0 0; }
.pagination a, .pagination span { display: block; padding: 0.25rem 0.625rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pagination .active a { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Klantkaart */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin: 0 0 1.25rem; }
.tabs a { padding: 0.5rem 1rem; border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; color: var(--muted); font-weight: 500; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.current { background: var(--surface); border-color: var(--line); color: var(--ink); }
.fieldrow { display: flex; flex-wrap: wrap; gap: 0 0.75rem; }
.fieldrow > div { flex: 0 0 9rem; }
.fieldrow > .grow { flex: 1 1 12rem; }
.form .fieldrow label { margin-top: 0.875rem; }
.envcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.envcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.envcard header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.envcard header .status { margin-left: auto; }
.envcard dl { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.25rem 0.75rem; margin: 0; }
.envcard dt { color: var(--muted); }
.envcard dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.envcard h3 { font-size: 0.9375rem; margin: 1rem 0 0.375rem; }
.envcard ul { margin: 0; padding-left: 1.125rem; }
.envcard footer { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.875rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.contactnote { color: var(--muted); font-size: 0.8125rem; margin-top: 0.125rem; }

.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }
.linkbox { margin: 0.5rem 0 0; overflow-wrap: anywhere; user-select: all; }
.authlink { margin: 1rem 0 0; text-align: center; }
.form h2 { margin-top: 1.75rem; }
.form-wide { max-width: 44rem; }
textarea.tall { min-height: 20rem; font-family: ui-monospace, Consolas, monospace; font-size: 0.875rem; }

/* Controlelijst bij importeren */
.edittable td { vertical-align: middle; padding: 0.3125rem 0.5rem; }
.edittable input[type=text] { min-width: 9rem; padding: 0.3125rem 0.5rem; }
.edittable input.short { min-width: 4rem; width: 4rem; }
.edittable select { width: auto; padding: 0.3125rem 0.5rem; }
.rowerror td { background: var(--err-bg); }
.rowmessage { color: var(--err-ink); font-size: 0.8125rem; }
input[type=file] { font: inherit; }
