:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --primary: #2563eb; --primary-dark: #1d4ed8; --danger: #dc2626; --good: #16a34a;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; word-break: break-all; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code { background: #eef1f5; padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* kop */
header { display: flex; align-items: center; gap: 1.5rem; padding: 0 1.5rem; height: 56px; background: #111827; color: #fff; }
header .brand { color: #fff; font-weight: 700; }
header nav { display: flex; gap: .25rem; flex: 1; }
header nav a { color: #cbd5e1; padding: .4rem .75rem; border-radius: 6px; }
header nav a:hover { color: #fff; background: #1f2937; text-decoration: none; }
header nav a.active { color: #fff; background: #374151; }
header .logout { display: flex; align-items: center; gap: .75rem; color: #9ca3af; }
header .logout button { color: #cbd5e1; }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

/* blokken */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.columns .card { margin-bottom: 1.25rem; }
.columns .card h2:not(:first-child) { margin-top: 1.5rem; }
@media (max-width: 800px) { .columns { grid-template-columns: 1fr; } header nav { overflow-x: auto; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--muted); }
.stat b { display: block; font-size: 1.8rem; color: var(--text); }
a.stat:hover { border-color: var(--primary); text-decoration: none; }

/* tabellen */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.card table { border: 0; margin: 0; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
tr.unread td { font-weight: 600; }
td.actions { text-align: right; white-space: nowrap; }

/* formulieren */
input, select, textarea { font: inherit; padding: .5rem .65rem; border: 1px solid #cfd4dc; border-radius: 6px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
label { display: block; margin-bottom: .75rem; font-weight: 500; }
label input, label select, label textarea { margin-top: .25rem; font-weight: 400; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; margin: 0; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 6px; padding: .5rem 1rem; background: var(--primary); color: #fff; font-weight: 500; }
button:hover { background: var(--primary-dark); }
button.secondary { background: #e5e7eb; color: var(--text); }
button.danger { background: var(--danger); }
button.small { padding: .3rem .7rem; font-size: .85rem; }
button.link { background: none; color: var(--primary); padding: 0; }
form.inline { display: inline-flex; gap: .5rem; align-items: center; }
form.inline input { width: 280px; }
form.grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 1rem; align-items: end; }
form.grid label { margin: 0; }
@media (max-width: 800px) { form.grid { grid-template-columns: 1fr; } }
.split { display: flex; align-items: center; gap: .35rem; }
.split input, .split select { margin-top: .25rem; }
.filters { display: flex; gap: .5rem; margin-bottom: 1rem; }
.filters select { max-width: 220px; }
.filters input { max-width: 300px; }
.filters button { flex: none; }

form.hook { display: grid; grid-template-columns: 50px 2fr 1fr auto auto; gap: .5rem; align-items: center; margin-bottom: .5rem; }
form.hook.new { grid-template-columns: 50px 2fr 1fr auto; padding-top: .5rem; border-top: 1px dashed var(--line); margin-top: .75rem; }

/* meldingen */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash .token { display: block; margin-top: .5rem; padding: .5rem; background: #fff; user-select: all; word-break: break-all; }
.badge { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: #eef1f5; margin: 0 .25rem .25rem 0; }
.badge.good, b.good { color: var(--good); }
.badge.good { background: #dcfce7; }
.badge.bad, b.bad { color: var(--danger); }
.badge.bad { background: #fee2e2; }

.tabs, .toolbar { display: flex; gap: .25rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap; }
.tabs a, .toolbar a { padding: .35rem .75rem; border-radius: 6px; }
.tabs a.active, .toolbar a.active { background: #e0e7ff; text-decoration: none; }
.toolbar form { margin-left: auto; }
.pager { display: flex; justify-content: space-between; margin-top: .75rem; }
.danger-zone { border-color: #fecaca; }

/* bericht */
dl.headers { display: grid; grid-template-columns: 100px 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
dl.headers dt { color: var(--muted); }
dl.headers dd { margin: 0; word-break: break-word; }
pre.mail-text { white-space: pre-wrap; word-break: break-word; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; padding: 1rem; margin: 0; font: 14px/1.5 ui-monospace, Menlo, monospace; }
iframe.mail-html { width: 100%; height: 600px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* inloggen */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; }
.login-card button { width: 100%; margin-top: .5rem; }

/* knoppen als link */
a.button { display: inline-block; background: var(--primary); color: #fff; padding: .5rem 1rem; border-radius: 6px; font-weight: 500; }
a.button:hover { background: var(--primary-dark); text-decoration: none; }
a.button.secondary { background: #e5e7eb; color: var(--text); }
a.button.small { padding: .3rem .7rem; font-size: .85rem; }
.hidden { display: none !important; }

/* bulk import */
form.stack { display: grid; gap: .25rem; max-width: 640px; }
form.stack button { justify-self: start; }
form.grid.gen { grid-template-columns: repeat(3, 1fr); }
form.grid.gen button { justify-self: start; }
@media (max-width: 800px) { form.grid.gen { grid-template-columns: 1fr; } }
ol.steps { padding-left: 1.25rem; margin: 0 0 1rem; }
ol.steps li { margin-bottom: .35rem; }
.card h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
.result { border-color: #bbf7d0; }
code.small { font-size: .75em; }

/* statistieken */
.filters { flex-wrap: wrap; align-items: center; }
.filters label.check { margin: 0; white-space: nowrap; }
.filters input[type=date] { width: auto; }
.custom-range { display: inline-flex; align-items: center; gap: .35rem; }
p.period { margin: -.25rem 0 1rem; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.chart-head h2 { margin: 0; }
.legend { display: flex; gap: 1rem; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: #e1e4e9; stroke-width: 1; }
svg.chart .baseline { stroke: #c9ced6; stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; }
.sw.inbox, svg.chart .inbox { background: #2a78d6; fill: #2a78d6; }
.sw.spam, svg.chart .spam { background: #eb6834; fill: #eb6834; }
svg.chart .hit { fill: transparent; }
svg.chart:hover .seg { opacity: .55; }
svg.chart .day:hover .seg { opacity: 1; }
.tooltip { position: absolute; pointer-events: none; background: #111827; color: #fff; font-size: .8rem; padding: .35rem .6rem; border-radius: 6px; white-space: nowrap; z-index: 2; }
details { margin-top: .75rem; }
details summary { cursor: pointer; color: var(--primary); font-size: .9rem; }
table.compact th, table.compact td { padding: .3rem .8rem; }
th.num, td.num { text-align: right; }
th a { color: inherit; }
th.sorted a { color: var(--text); }
.meter { display: inline-block; width: 60px; height: 6px; background: #eef1f5; border-radius: 3px; margin-right: .5rem; vertical-align: middle; overflow: hidden; }
.meter i { display: block; height: 100%; background: #2a78d6; border-radius: 3px; }
.small-print { font-size: .85rem; }

/* leeslinks */
td.link-url { font: 12px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; min-width: 180px; }
form.link-new { margin-top: 1rem; }
form.link-new label { display: inline-flex; align-items: center; gap: .5rem; margin: 0; font-weight: 400; }
form.link-new select { width: auto; margin: 0; }
h2 small { font-weight: 400; font-size: .85rem; }
