:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1b2130;
  --muted: #667085;
  --line: #e4e7ec;
  --soft: #f1f3f6;
  --accent: #2552c4;
  --accent-soft: #e9effc;
  --ok: #157f4b;
  --ok-soft: #e7f6ee;
  --warn: #9a5b00;
  --warn-soft: #fdf3e2;
  --err: #b42318;
  --err-soft: #fdecea;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --surface: #1a1f29; --ink: #e8ebf1; --muted: #98a2b3; --line: #2a303c; --soft: #222835;
    --accent: #7ea2ff; --accent-soft: #24304d; --ok: #6fd3a0; --ok-soft: #173327; --warn: #f2c26b; --warn-soft: #3a2d14;
    --err: #ff8f84; --err-soft: #3b1d1b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/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: 22px; margin: 0; letter-spacing: -0.01em; }
h1 small { font-size: 14px; font-weight: 400; margin-left: 6px; }
h2 { font-size: 15px; margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
small { display: block; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* Kop */
.top {
  display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.brand.big { font-size: 18px; margin-bottom: 20px; }
nav.main { display: flex; gap: 4px; }
nav.main a, .who > a { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; }
nav.main a.on, nav.main a:hover, .who > a:hover, .who > a.on { color: var(--ink); background: var(--soft); text-decoration: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who form { margin: 0; }
.client-name { color: var(--muted); font-size: 13px; }
.client-switch select { padding: 5px 8px; }

/* Pagina */
main.page { max-width: 1240px; margin: 0 auto; padding: 24px; }
main.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.narrow { width: 100%; max-width: 400px; }
.card h1 { margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 16px; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--muted); }

/* Formulieren */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 12.5px; }
label { display: block; font-weight: 500; font-size: 13px; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.stack { display: grid; gap: 12px; }
.stack p { margin: -6px 0 0; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 9px 14px; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--accent); }
button.link:hover { text-decoration: underline; }
form.inline { display: inline; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filters label { font-size: 12px; color: var(--muted); }
.filters select, .filters input[type=date] { width: auto; padding: 6px 8px; }
.filters .custom-range { display: inline-flex; gap: 8px; align-items: flex-end; }
.filters label.check { color: var(--ink); font-size: 13px; padding-bottom: 7px; }

/* Meldingen */
.flash { border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--err-soft); color: var(--err); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash code.block { display: block; margin-top: 8px; padding: 8px 10px; background: var(--surface); color: var(--ink); border-radius: 6px; word-break: break-all; cursor: copy; }

/* Kerncijfers */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpis .n { display: block; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpis .l { color: var(--muted); font-size: 12.5px; }

/* Bezoeken */
.visits { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.visit-head, .visit > summary {
  display: grid; grid-template-columns: 110px minmax(0, 1.3fr) minmax(0, 1fr) 70px 90px 80px; gap: 12px; align-items: center; padding: 10px 16px;
}
.visit-head { font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: var(--soft); }
.visit { border-bottom: 1px solid var(--line); }
.visit:last-child { border-bottom: 0; }
.visit > summary { cursor: pointer; list-style: none; }
.visit > summary::-webkit-details-marker { display: none; }
.visit > summary:hover { background: var(--soft); }
.visit[open] > summary { background: var(--accent-soft); }
.visit .when { font-variant-numeric: tabular-nums; }
.visit .net .mono { font-size: 12.5px; }
.visit .src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.meta-m { display: none; }
.trail { list-style: none; margin: 0; padding: 6px 16px 10px 16px; }
.trail li { display: grid; grid-template-columns: 70px minmax(0, 1fr) 130px; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--line); }
.trail li:first-child { border-top: 0; }
.trail .t, .trail .m { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.trail .m { text-align: right; }
.trail small { word-break: break-all; }
.visit > p { margin: 0; padding: 0 16px 12px 98px; }
.ev { display: inline-block; margin: 4px 6px 0 0; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--soft); color: var(--ink); }
.ev-download { background: var(--accent-soft); color: var(--accent); }
.ev-tel, .ev-mailto { background: var(--ok-soft); color: var(--ok); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge.off { background: var(--soft); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 4px 6px 4px 12px; background: var(--accent-soft); border-radius: 999px; font-size: 13px; }
.chip a { font-size: 16px; line-height: 1; padding: 0 6px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 14px; color: var(--muted); }

/* Tabellen */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; background: var(--soft); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
.card table.data th { background: transparent; padding-left: 0; }
.card table.data td { padding-left: 0; }
table.data tr.off td { opacity: .55; }
.page-cell { max-width: 520px; }
.page-cell small { word-break: break-all; }
td.wrap { word-break: break-all; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }

/* Beheer */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
dl.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 12px; margin: 0 0 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-all; }
[data-copy] { cursor: copy; padding: 2px 6px; border-radius: 4px; background: var(--soft); }
[data-copy].copied { background: var(--ok-soft); color: var(--ok); }

/* 2FA */
.qr { width: 200px; height: 200px; margin: 8px auto 12px; background: #fff; border-radius: 8px; padding: 4px; }
.qr svg { width: 100%; height: 100%; display: block; }
code.secret { display: inline-block; margin-top: 4px; letter-spacing: .04em; }

@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { gap: 12px; padding: 0 16px; overflow-x: auto; }
  .who .client-name, .who > a { display: none; }
  main.page { padding: 16px; }
  .visit-head { display: none; }
  .visit > summary { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .visit > summary .num { display: none; }
  .visit > summary .net { text-align: right; }
  .visit > summary .src { font-size: 13px; }
  .visit > summary .meta-m { display: block; grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
  .trail li { grid-template-columns: 1fr; gap: 2px; }
  .trail .m { text-align: left; }
  .visit > p { padding-left: 16px; }
}

/* Fase 2: bedrijven en dekking */
.crumb { margin: 0 0 6px; font-size: 13px; }
.sub { margin: 4px 0 0; }
h2.section { margin: 26px 0 10px; font-size: 16px; }
h3 { font-size: 13.5px; margin: 16px 0 6px; }
a.co, .visit .co { font-weight: 600; color: var(--ink); }
a.co:hover { color: var(--accent); }
.visit .nolabel { color: var(--muted); }
.visit-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 0 16px 12px 98px; }
.visit-foot .actions { margin-left: auto; font-size: 13px; }
.badge.err { background: var(--err-soft); color: var(--err); }
dl.kv.wide { grid-template-columns: 170px minmax(0, 1fr); }
.coverage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.coverage .bar { display: block; width: 100%; height: 14px; border-radius: 7px; overflow: hidden; background: var(--soft); }
.coverage .legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 10px 0 0; padding: 0; font-size: 12.5px; }
.coverage .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.c-company { fill: #2552c4; background: #2552c4; }
.c-business { fill: #7ea2ff; background: #7ea2ff; }
.c-isp { fill: #98a2b3; background: #98a2b3; }
.c-mobile { fill: #c0c6d1; background: #c0c6d1; }
.c-hosting { fill: #e4a663; background: #e4a663; }
.c-unknown { fill: #dde1e7; background: #dde1e7; }
.c-pending { fill: #eef0f3; background: #eef0f3; }
@media (prefers-color-scheme: dark) {
  .c-company { fill: #7ea2ff; background: #7ea2ff; }
  .c-business { fill: #3f5fae; background: #3f5fae; }
  .c-isp { fill: #667085; background: #667085; }
  .c-mobile { fill: #4b5262; background: #4b5262; }
  .c-unknown, .c-pending { fill: #333a48; background: #333a48; }
}
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row input { flex: 1; }
ul.results { list-style: none; margin: 8px 0 0; padding: 0; }
ul.results li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
ul.results form { margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row-actions form { margin: 0; }
details.new-company { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.new-company summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-bottom: 10px; }
table.companies td small { margin-top: 2px; }
@media (max-width: 900px) {
  .visit-foot { padding-left: 16px; }
}
table.data th.num { text-align: right; }
dl.kv { grid-template-columns: 170px minmax(0, 1fr); }
.c-proxy { fill: #b98ae0; background: #b98ae0; }
@media (prefers-color-scheme: dark) { .c-proxy { fill: #7d55a6; background: #7d55a6; } }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.flash a { color: inherit; font-weight: 600; text-decoration: underline; }
form.client-row { display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
form.client-row:first-of-type { border-top: 0; padding-top: 0; }
form.client-row button { justify-self: start; }
.client-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
