:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #14181f;
  --muted: #626c7a;
  --line: #dfe3e9;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --red: #c0392b;
  --orange: #d97706;
  --yellow: #b59000;
  --green: #2c7a4b;
  --grey: #97a1af;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

h1 { font-size: 1.7rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
section { margin-bottom: 32px; }
a { color: var(--accent); }

.lede { color: var(--muted); margin-top: 0; }
.muted, .hint { color: var(--muted); font-size: 0.85rem; }
.hint { margin: 4px 0 0; }
.empty { color: var(--muted); font-style: italic; }
.right { text-align: right; }
code { font-size: 0.85em; background: #eef1f5; padding: 1px 5px; border-radius: 4px; }

/* --- topbar --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.topbar nav { display: flex; align-items: center; gap: 16px; }

footer {
  max-width: 1080px; margin: 0 auto; padding: 0 20px 40px;
  color: var(--muted); font-size: 0.8rem;
}

/* --- buttons --- */
.button {
  display: inline-block; padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  text-decoration: none; font: inherit; font-size: 0.95rem; cursor: pointer;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.danger { border-color: var(--red); color: var(--red); }
.button:hover { filter: brightness(0.97); }

/* --- cards & panels --- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.panel { margin-bottom: 24px; }
.panel-warning { border-left: 4px solid var(--orange); }

.two-column { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .two-column { grid-template-columns: 1fr; } }

/* --- totals --- */
.totals {
  display: flex; flex-wrap: wrap; gap: 32px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.totals-label { display: block; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.totals-amount, .totals-count { font-size: 1.5rem; }
.totals-warning { color: var(--orange); font-size: 0.85rem; width: 100%; }

/* --- attention list --- */
.attention { list-style: none; margin: 0; padding: 0; }
.attention li {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.attention li:last-child { border-bottom: 0; }
.event-label { color: var(--muted); }
.event-date { margin-left: auto; font-variant-numeric: tabular-nums; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-past   { background: var(--grey); }
.dot-red    { background: var(--red); }
.dot-orange { background: var(--orange); }
.dot-yellow { background: var(--yellow); }
.dot-green  { background: var(--green); }

/* --- tables --- */
table.contracts { width: 100%; border-collapse: collapse; background: var(--surface); }
table.contracts th, table.contracts td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
table.contracts th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
table.contracts td.right, table.contracts th.right { text-align: right; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #eef1f5; color: var(--muted); font-size: 0.8rem;
}

.section-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: baseline; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; }
.filters a { text-decoration: none; padding: 3px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.filters a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* --- forms --- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 5px; }
.field input[type=text], .field input[type=password], .field input[type=date], .field select, .field textarea {
  width: 100%; padding: 8px 10px; font: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; }
.field-missing input, .field-missing select { border-color: var(--orange); background: #fffaf2; }

.money { display: flex; align-items: stretch; }
.money .prefix {
  display: flex; align-items: center; padding: 0 10px;
  border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px;
  background: #eef1f5; color: var(--muted);
}
.money input { border-radius: 0 8px 8px 0 !important; }

.badge {
  font-weight: 400; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px;
  margin-left: 6px; vertical-align: middle;
}
.badge-extracted { background: #e7f0f6; color: #1f5f8b; }
.badge-uncertain { background: #fdf1dc; color: #96690b; }
.badge-user      { background: #e8f3ec; color: #2c7a4b; }
.badge-missing   { background: #fbe6e3; color: #a5322a; }

.actions { display: flex; gap: 10px; margin-top: 20px; }
.or { text-align: center; color: var(--muted); margin: 8px 0; }
.danger-zone { margin-top: 32px; }
.danger-zone h2 { color: var(--red); }
.checkbox-field label { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
.checkbox-field input { margin-top: 3px; }

/* --- banners --- */
.banner { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; }
.banner .code { font-size: 0.75rem; opacity: 0.7; margin-left: 8px; }
.banner p { margin: 6px 0 0; font-size: 0.9rem; }
.banner-error   { background: #fbe6e3; border-left: 4px solid var(--red); }
.banner-warning { background: #fdf3e2; border-left: 4px solid var(--orange); }
.banner-ok      { background: #e8f3ec; border-left: 4px solid var(--green); }

.sidebar .source {
  max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-size: 0.8rem; line-height: 1.5;
}

.missing { margin: 8px 0 0; padding-left: 20px; }

/* --- inlogscherm --- */
.login-wrap { max-width: 420px; margin: 40px auto; }
.login-wrap h1 { margin-bottom: 4px; }
.topbar .who { color: var(--muted); font-size: 0.85rem; }
.topbar form { display: inline; }
.topbar .linkbutton {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent); cursor: pointer; text-decoration: underline;
}

/* --- beheer --- */
.tiles {
  display: grid; gap: 12px; margin: 20px 0 32px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.tile-getal { font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--muted); font-size: 0.85rem; }
.tile-let-op .tile-getal { color: var(--red); }
.pil {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 600;
}
.tabel-scroll { overflow-x: auto; margin-bottom: 28px; }
