:root {
  --blauw: #2E5B8A;
  --blauw-donker: #1e3f61;
  --rood: #b3261e;
  --groen: #2e7d32;
  --grijs: #6b7280;
  --achtergrond: #f4f6f9;
}

* { box-sizing: border-box; }

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  background: var(--achtergrond);
  color: #1f2937;
}

.topbar {
  background: var(--blauw);
  color: white;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.topbar h1 {
  margin: 0 0 10px 0;
  font-size: 20px;
}

#tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.tab-btn {
  background: var(--blauw-donker);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.tab-btn.active { background: white; color: var(--blauw); font-weight: bold; }

main { max-width: 1400px; margin: 0 auto; padding: 16px 32px; }

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.dash-item {
  background: white;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dash-item .getal { font-size: 28px; font-weight: bold; color: var(--blauw); }
.dash-item.achterstallig .getal { color: var(--rood); }
.dash-item .label { font-size: 12px; color: var(--grijs); }

.tab-content { display: none; }
.tab-content.active { display: block; }

.card {
  background: white;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h2 { margin-top: 0; font-size: 16px; color: var(--blauw-donker); }

input, select, button {
  font-size: 15px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

#scan-barcode {
  width: 100%;
  font-size: 20px;
  padding: 16px;
  border: 2px solid var(--blauw);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-row input { flex: 1; min-width: 180px; }

.zoek-veld-wrap { position: relative; flex: 1; min-width: 180px; }
.zoek-veld-wrap input { width: 100%; }

.zoek-suggesties {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
}

.zoek-suggestie {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
}
.zoek-suggestie:last-child { border-bottom: none; }
.zoek-suggestie:hover, .zoek-suggestie.gemarkeerd { background: #eef2f7; }

.zoek-suggestie-label {
  display: inline-block;
  background: var(--blauw);
  color: white;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: 6px;
}

button {
  background: var(--blauw);
  color: white;
  border: none;
  cursor: pointer;
}

button:hover { background: var(--blauw-donker); }

button.secundair { background: var(--grijs); }
button.gevaar { background: var(--rood); }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #e5e7eb;
}

th { color: var(--grijs); font-weight: 600; font-size: 12px; text-transform: uppercase; }

th.sorteerbaar { cursor: pointer; user-select: none; }
th.sorteerbaar:hover { color: var(--blauw-donker); }
th.sorteer-actief { color: var(--blauw); }

tr.achterstallig { background: #fdecea; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
}

.badge.beschikbaar { background: #e6f4ea; color: var(--groen); }
.badge.uitgeleend { background: #fdecea; color: var(--rood); }

.melding { padding: 10px; border-radius: 6px; margin-top: 10px; font-size: 14px; }
.melding.ok { background: #e6f4ea; color: var(--groen); }
.melding.fout { background: #fdecea; color: var(--rood); }

.boek-kaart {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
}

.boek-kaart h3 { margin: 0 0 4px 0; }
.boek-kaart .meta { color: var(--grijs); font-size: 13px; margin-bottom: 10px; }

.leerling-lijst {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-top: 8px;
}

.leerling-item {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.leerling-item:hover { background: #f4f6f9; }

.titel-link {
  background: none;
  border: none;
  color: var(--blauw);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  text-align: left;
}
.titel-link:hover { color: var(--blauw-donker); }

#boekdetail-terug { margin-bottom: 16px; }

.boek-detail h2 { margin: 0 0 4px 0; color: var(--blauw-donker); font-size: 24px; }
.boek-detail .meta { color: var(--grijs); font-size: 14px; margin-bottom: 8px; }

.boek-detail .info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
  margin: 16px 0;
  padding: 16px 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}
.boek-detail .info-grid .label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--grijs);
  font-weight: 600;
  margin-bottom: 2px;
}
.boek-detail .info-grid .waarde { font-size: 15px; }
.boek-detail .info-grid .waarde.kastlocatie { font-weight: bold; color: var(--blauw-donker); }

.boek-detail h3 { margin: 20px 0 8px 0; color: var(--blauw-donker); font-size: 15px; }
.boek-detail .trefwoord-lijst { margin: 4px 0 16px 0; }

.trefwoord-badge {
  display: inline-block;
  background: #eef2f7;
  color: var(--blauw-donker);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  margin: 0 6px 6px 0;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.trefwoord-badge:hover { background: var(--blauw); color: white; }

.kb-auteurs-lijst { margin: 4px 0 16px 0; display: flex; flex-wrap: wrap; gap: 10px; }

.kb-auteur-kaart {
  background: #eef2f7;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
}

.kb-auteur-naam { font-weight: bold; color: var(--blauw-donker); }

.kb-auteur-links { margin-top: 2px; }
.kb-auteur-links a {
  color: var(--blauw);
  text-decoration: underline;
  font-size: 12px;
  margin-right: 10px;
}
.kb-auteur-links a:hover { color: var(--blauw-donker); }

.boek-detail .bol-link {
  display: inline-block;
  margin-top: 12px;
  background: var(--blauw);
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
}
.boek-detail .bol-link:hover { background: var(--blauw-donker); }
