/*
 * Huisstijl. Kleuren overgenomen van dgmr.nl (november 2026):
 *   - blauw #2668ad (hover #225d9b) en navy #001a36 uit de CSS van de site;
 *   - logoblauw #146cc9 en logogroen #13ad47 uit dgmr-logo.svg.
 * Logogroen is te licht voor witte tekst (contrast 2,96); het wordt alleen
 * gebruikt op de navy kopbalk (contrast 5,91). Waar groen een vlak met witte
 * tekst is, gebruiken we de donkerdere tint --color-green-dark (5,46, WCAG AA).
 * Lettertype en logo zijn nog niet overgenomen.
 */

:root {
  --color-bg: #ffffff;
  --color-surface: #f2f6fa; /* lichtblauwe vlakken, zoals op dgmr.nl */
  --color-border: #dbe3ec;
  --color-text: #001a36;
  --color-text-muted: #4f5f73;
  --color-primary: #001a36; /* navy: kopbalk */
  --color-accent: #2668ad; /* DGMR-blauw: knoppen */
  --color-accent-hover: #225d9b;
  --color-link: #146cc9; /* logoblauw */
  --color-green: #13ad47; /* logogroen: alleen op navy */
  --color-green-dark: #0b7a32;
  --color-accent-contrast: #ffffff;
  --font-sans: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --radius: 4px;
}

a {
  color: var(--color-link);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
}

header.site-header {
  background: var(--color-primary);
  color: var(--color-accent-contrast);
  border-bottom: 3px solid var(--color-green);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.site-header a {
  color: var(--color-accent-contrast);
  text-decoration: none;
  font-weight: 600;
}

header.site-header nav a {
  margin-left: 1rem;
  padding-bottom: 0.2rem;
  font-weight: 400;
  opacity: 0.9;
  border-bottom: 2px solid transparent;
}

header.site-header nav a:hover {
  opacity: 1;
  border-bottom-color: var(--color-green);
}

header.site-header nav a.active {
  opacity: 1;
  color: var(--color-green);
  border-bottom-color: var(--color-green);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.filter-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.filter-bar label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

select,
input,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.btn {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn:not(.btn-secondary):not(.btn-danger):hover {
  background: var(--color-accent-hover);
}

.btn-secondary:hover,
.btn-danger:hover {
  border-color: currentColor;
}

form.upload-form {
  display: grid;
  gap: 1rem;
  max-width: 640px;
}

/* Veldlabels; niet de categorieknoppen, die zijn ook <label>. */
form.upload-form label:not(.chip) {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.empty-state {
  color: var(--color-text-muted);
  padding: 2rem 0;
  text-align: center;
}

.filter-bar .grow {
  flex: 1;
  min-width: 240px;
}

.filter-bar .grow input {
  width: 100%;
}

.muted {
  color: var(--color-text-muted);
}

.small {
  font-size: 0.8rem;
}

.message.error {
  color: #a12a2a;
  margin-top: -0.75rem;
  margin-bottom: 1.5rem;
}

.badge-error {
  color: #a12a2a;
  border-color: #e2b4b4;
  background: #fbeeee;
}

.btn-small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

ul.feed-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.feed-items li {
  border-bottom: 1px solid var(--color-border);
  padding: 0.9rem 0;
}

ul.feed-items li.processed {
  opacity: 0.6;
}

.feed-item-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.feed-item-head a {
  color: var(--color-primary);
  text-decoration: none;
}

.feed-item-summary {
  margin: 0.4rem 0 0.6rem;
  font-size: 0.9rem;
}

.btn-danger {
  background: var(--color-surface);
  color: #a12a2a;
  border: 1px solid #e2b4b4;
}

.inline-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0;
}


.pager {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin: 1.25rem 0;
}

/*
 * Categoriekleuren. Elke categorie heeft een sleutel uit app.categories.COLORS;
 * de waarde hieronder is de bijbehorende kleur. Alle kleuren geven voldoende
 * contrast met witte tekst (WCAG AA, >= 4.5). Aanpassen aan de huisstijl kan
 * hier, zonder databasewijziging.
 */
.cat-groenblauw { --cat: #1f7a75; }
.cat-blauw { --cat: #2668ad; } /* DGMR-blauw */
.cat-paars { --cat: #6f4a9e; }
.cat-rood { --cat: #b03535; }
.cat-oranje { --cat: #a8531a; }
.cat-groen { --cat: #0b7a32; } /* donkere tint van DGMR-logogroen */
.cat-roze { --cat: #a63d72; }
.cat-grijs { --cat: #56616e; }
.cat-new { --cat: #56616e; }

/* Categorieknoppen: pil met gekleurd bolletje; aangevinkt = ingekleurd met vinkje. */
fieldset.chip-field {
  border: none;
  padding: 0;
  margin: 0;
}

fieldset.chip-field legend {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
  padding: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.chip:hover {
  border-color: var(--cat, var(--color-accent));
}

/* Het selectievakje is onzichtbaar maar blijft bereikbaar met toetsenbord en schermlezer. */
.chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.chip-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--cat, var(--color-accent));
  flex: none;
}

.chip-check {
  display: none;
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.chip:has(input:checked) {
  background: var(--cat);
  border-color: var(--cat);
  color: #ffffff;
}

.chip:has(input:checked) .chip-dot {
  display: none;
}

.chip:has(input:checked) .chip-check {
  display: block;
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--cat);
  outline-offset: 2px;
}

.chip.cat-new {
  border-style: dashed;
}

.chip-new {
  margin-top: 0.6rem;
}

.chip-new input {
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  width: 14rem;
}

/* Kleine, niet-klikbare variant voor overzichten (documentenlijst). */
.chip-small {
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  gap: 0.35rem;
}

.chip-small .chip-dot {
  width: 0.5rem;
  height: 0.5rem;
}

/* Kleurkeuze op de beheerpagina: rondjes in de categoriekleur. */
.swatches {
  display: flex;
  gap: 0.3rem;
  border: none;
  padding: 0;
  margin: 0;
}

.swatch {
  position: relative;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--cat);
  cursor: pointer;
}

.swatch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.swatch:has(input:checked) {
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--cat);
}

.swatch:has(input:focus-visible) {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
}

.inline-form select {
  max-width: 11rem;
}

/* Document: bestand uploaden óf link. Alleen het paneel van de gekozen optie is zichtbaar. */
fieldset.document-source {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

fieldset.document-source legend {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
  padding: 0;
}

.segmented {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem;
  background: var(--color-surface);
}

form.upload-form .segmented label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.segmented label:has(input:checked) {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.document-source:has(input[value="file"]:checked) .source-link,
.document-source:has(input[value="link"]:checked) .source-file {
  display: none;
}

.source-link input[type="url"] {
  width: 100%;
}

.source-link .small {
  margin: 0.3rem 0 0;
}

/* Voorstellen uit de documentanalyse (document-analysis.js). */
.analysis-status {
  margin: 0;
  min-height: 1.1em;
}

.analysis-status.busy::before {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.4rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  vertical-align: -0.1rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chip.chip-suggested .chip-label::after {
  content: " \2726"; /* ✦ = voorgesteld op basis van de inhoud */
}

/* Titels en bronnen zijn vaak lang. */
form.upload-form #title,
form.upload-form #source {
  width: 100%;
}

/* Ingebouwde lezer en documentpagina. */
.reader {
  max-width: 46rem;
}

.reader h1 {
  font-size: 1.7rem;
  line-height: 1.25;
  margin: 0.4rem 0 0.4rem;
}

.back-link {
  font-size: 0.9rem;
  text-decoration: none;
}

.reader-actions {
  margin: 0.8rem 0 1.4rem;
}

.reader-body {
  font-size: 1.05rem;
  line-height: 1.7;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.reader-body img {
  max-width: 100%;
  height: auto;
}

.reader-body figure {
  margin: 1.2rem 0;
}

.reader-body figcaption {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.reader-body table {
  display: block;
  overflow-x: auto;
}

.reader-body blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-border);
  color: var(--color-text-muted);
}

.reader-note {
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
}

.reader-source {
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.external-link {
  margin-left: 0.3rem;
  text-decoration: none;
  color: var(--color-text-muted);
}

.external-link:hover {
  color: var(--color-link);
}

a.document-title {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
}

a.document-title:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0.4rem 0;
}

.document-notes {
  background: var(--color-surface);
  padding: 0.2rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}

.pdf-viewer {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-top: 1rem;
}

/* Leesstatus: segmentknoppen op de documentpagina, keuzelijst in het overzicht. */
.status-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
}

.status-control button {
  border: none;
  background: transparent;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
}

.status-control button.active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.status-control button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.status-select {
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
}

.status-select.status-aan_het_lezen {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.status-select.status-gelezen {
  color: var(--color-text-muted);
}

/* Documentpagina met PDF: volle breedte, een PDF-pagina heeft meer ruimte nodig. */
.reader.reader-wide {
  max-width: none;
}

/* Meldingen na een actie (app/flash.py, toasts.js). */
.toasts {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: grid;
  gap: 0.5rem;
  z-index: 100;
  max-width: min(28rem, calc(100vw - 2.5rem));
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem 0.7rem 1rem;
  background: var(--color-primary);
  color: var(--color-accent-contrast);
  border-left: 4px solid var(--color-green);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 26, 54, 0.25);
  font-size: 0.9rem;
  animation: toast-in 0.18s ease-out;
}

.toast-text {
  flex: 1;
}

.toast a,
.toast-undo {
  color: var(--color-green);
  font-weight: 600;
  white-space: nowrap;
}

.toast form {
  margin: 0;
}

.toast-undo {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toast-in {
  from {
    transform: translateY(0.5rem);
    opacity: 0;
  }
}

.nowrap {
  white-space: nowrap;
}

form.upload-form #notes {
  width: 100%;
  resize: vertical;
}

.current-file {
  margin: 0 0 0.4rem;
}

.status-row {
  flex-wrap: wrap;
}

.status-row-actions {
  margin-left: auto;
}

/* --- Fase 1: kopbalk, dossierlijst en startpagina ------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

header.site-header {
  gap: 1.5rem;
}

header.site-header .brand {
  font-weight: 700;
  margin-right: 0.5rem;
}

header.site-header nav.main-nav {
  display: flex;
  gap: 0.25rem;
}

header.site-header nav.main-nav a {
  margin-left: 0;
  padding: 0.3rem 0.6rem 0.2rem;
}

.nav-count {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0 0.35rem;
  margin-left: 0.2rem;
  border-radius: 999px;
  background: var(--color-green);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4rem;
}

.header-search {
  margin-left: auto;
}

.header-search input {
  width: 16rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-accent-contrast);
  padding: 0.35rem 0.9rem;
}

.header-search input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.header-search input:focus {
  outline: 2px solid var(--color-green);
  background: rgba(255, 255, 255, 0.18);
}

header.site-header a.header-add {
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
}

header.site-header a.header-add.active {
  outline: 2px solid var(--color-green);
}

.admin-menu {
  position: relative;
}

.admin-menu summary {
  list-style: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius);
  opacity: 0.85;
}

.admin-menu summary::-webkit-details-marker {
  display: none;
}

.admin-menu summary:hover,
.admin-menu[open] summary,
.admin-menu summary.active {
  opacity: 1;
  color: var(--color-green);
}

.admin-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 11rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 26, 54, 0.18);
  padding: 0.3rem 0;
  z-index: 50;
}

header.site-header .admin-menu-panel a {
  display: block;
  margin: 0;
  padding: 0.5rem 1rem;
  color: var(--color-text);
  font-weight: 400;
  opacity: 1;
  border: none;
}

header.site-header .admin-menu-panel a:hover {
  background: var(--color-surface);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Dossier: compacte regels in plaats van een brede tabel. */
.document-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.document-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--color-border);
}

.document-row-main {
  flex: 1;
  min-width: 0;
}

.document-row-main .document-title {
  font-size: 1rem;
}

.document-row-meta {
  margin: 0.2rem 0 0;
}

.document-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.4rem 0 0;
}

.document-row-status {
  flex: none;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: -0.5rem 0 1rem;
}

.filter-chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  font-size: 0.85rem;
  text-decoration: none;
}

.filter-chip:hover {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

/* Startpagina "Vandaag". */
.home-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.home-search input {
  flex: 1;
  font-size: 1.05rem;
  padding: 0.6rem 0.9rem;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.home-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.home-block > header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.home-block h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.count-badge {
  margin-bottom: 0.5rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--color-green-dark);
  color: var(--color-accent-contrast);
  font-size: 0.8rem;
  font-weight: 600;
}

.home-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
}

.home-list li {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--color-border);
}

.home-list li:last-child {
  border-bottom: none;
}

.home-list a {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
}

.home-list a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

/* --- Fase 2: inbox met lijst en lezervak ---------------------------------- */

main.main-wide {
  max-width: 1440px;
}

.inbox {
  display: grid;
  grid-template-columns: minmax(20rem, 2fr) 3fr;
  gap: 1.5rem;
  align-items: start;
}

.inbox-filters {
  margin-bottom: 0.75rem;
}

.inbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.4rem;
}

.inbox-toolbar-actions {
  display: flex;
  gap: 0.4rem;
}

.inbox-toolbar button:disabled {
  opacity: 0.5;
  cursor: default;
}

.inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.inbox-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.6rem 0.6rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  border-left: 3px solid transparent;
}

.inbox-row:hover {
  background: var(--color-surface);
}

.inbox-row.selected {
  background: var(--color-surface);
  border-left-color: var(--color-accent);
}

.inbox-row.processed {
  opacity: 0.6;
}

.inbox-check {
  margin-top: 0.2rem;
  flex: none;
}

.inbox-row-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
  color: var(--color-text);
  text-decoration: none;
}

.inbox-row-title {
  font-weight: 400;
  line-height: 1.35;
}

/* Nieuw = nog niet geopend: vetgedrukt met een groen bolletje, zoals in een mailprogramma. */
.inbox-row.unseen .inbox-row-title {
  font-weight: 700;
}

.inbox-row.unseen .inbox-row-title::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--color-green-dark);
  vertical-align: 0.1rem;
}

.inbox-row-meta .badge {
  margin-left: 0.3rem;
}

.inbox-pane {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  background: var(--color-bg);
}

.pane-empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: 4rem 1rem;
}

.pane-title {
  font-size: 1.4rem;
  line-height: 1.25;
  margin: 0 0 0.3rem;
}

.pane-original {
  margin-left: auto;
  font-size: 0.9rem;
}

.badge-saved {
  color: var(--color-green-dark);
  border-color: var(--color-green-dark);
}

/* Smal scherm: alleen de lijst; berichten openen als losse pagina. */
@media (max-width: 899px) {
  .inbox {
    grid-template-columns: 1fr;
  }

  .inbox-pane {
    display: none;
  }
}

kbd {
  display: inline-block;
  min-width: 1.3rem;
  padding: 0 0.3rem;
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--color-surface);
  font-family: inherit;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.4;
}

.shortcut-help {
  border: none;
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: 0 12px 40px rgba(0, 26, 54, 0.3);
  max-width: 28rem;
}

.shortcut-help::backdrop {
  background: rgba(0, 26, 54, 0.4);
}

.shortcut-help h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

.shortcut-help dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0 0 1.25rem;
}

.shortcut-help dt {
  white-space: nowrap;
}

.shortcut-help dd {
  margin: 0;
}

/* --- Fase 3: categoriekeuze bij veel categorieën, groepen, uitleg ----------- */

/* Minder gebruikte categorieën achter "Meer" (alleen met JavaScript; zonder
   JavaScript is alles zichtbaar). Tijdens zoeken worden ze wel doorzocht. */
.js .chip-field:not(.chips-filtering) .chip-extra,
.chip-filtered-out {
  display: none;
}

.chip-more {
  border-style: dashed;
  color: var(--color-text-muted);
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
}

.chip-filter {
  width: 16rem;
  margin-bottom: 0.6rem;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
}

.chip-group {
  margin-bottom: 0.6rem;
}

.chip-group-name {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.chips-new:empty {
  display: none;
}

.chips-new {
  margin-top: 0.5rem;
}

.chip-reasons {
  margin: 0.5rem 0 0;
}

.chip-reasons:empty {
  display: none;
}

/* Beheerpagina: één blok per categorie. */
.category-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.category-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.category-card-form {
  display: grid;
  gap: 0.6rem;
  flex: 1 1 36rem;
}

.category-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}

.category-name {
  font-weight: 600;
  width: 16rem;
}

.category-field {
  display: grid;
  gap: 0.2rem;
}

.category-field.grow {
  flex: 1 1 14rem;
}

.category-field input {
  width: 100%;
}

.category-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  font-size: 0.9rem;
}

/* Prullenbak */
.trash-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid #a12a2a;
  background: #fbeeee;
  border-radius: var(--radius);
}

.trash-banner p {
  margin: 0;
}

/* --- Fase 4: toegankelijkheid, klikvlakken, bevestigingsvenster, mobiel ------ */

/* Zichtbare focus voor toetsenbordgebruikers (niet bij klikken met de muis). */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

header.site-header :focus-visible {
  outline-color: var(--color-green);
}

main:focus {
  outline: none; /* doel van "Naar de inhoud"; geen rand om de hele pagina */
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--color-bg);
  color: var(--color-link);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 26, 54, 0.25);
}

.skip-link:focus {
  top: 0.75rem;
}

/* Grotere klikvlakken (minstens ~32 px hoog). */
.btn {
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-small {
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

select,
input[type="text"],
input[type="search"],
input[type="url"],
input[type="date"] {
  min-height: 2.25rem;
}

.status-select {
  min-height: 2rem;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}

.chip {
  min-height: 2.1rem;
}

.chip-small {
  min-height: 1.6rem;
}

.inbox-check,
.inbox-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
}

/* Bevestigingsvenster (confirm.js). */
.confirm-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem 1.25rem;
  max-width: min(30rem, calc(100vw - 2rem));
  box-shadow: 0 12px 40px rgba(0, 26, 54, 0.3);
  color: var(--color-text);
}

.confirm-dialog::backdrop {
  background: rgba(0, 26, 54, 0.45);
}

.confirm-dialog p {
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn.btn-danger-solid,
.btn.btn-danger-solid:not(.btn-secondary):not(.btn-danger):hover {
  background: #a12a2a;
  color: #ffffff;
}

.table-scroll {
  overflow-x: auto;
}

/* --- Smalle schermen ------------------------------------------------------ */

@media (max-width: 820px) {
  main {
    padding: 1rem;
  }

  h1 {
    font-size: 1.35rem;
  }

  /* Kopbalk over twee regels: merk, toevoegen en beheer boven; menu en zoeken eronder. */
  header.site-header {
    flex-wrap: wrap;
    gap: 0.6rem 0.75rem;
    padding: 0.6rem 1rem;
  }

  header.site-header .brand {
    margin-right: auto;
  }

  header.site-header nav.main-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .header-search {
    order: 4;
    width: 100%;
    margin-left: 0;
  }

  .header-search input {
    width: 100%;
  }

  /* Filters en formulieren over de volle breedte. */
  .filter-bar > div,
  .filter-bar .grow {
    flex: 1 1 100%;
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
  }

  form.upload-form {
    max-width: none;
  }

  form.upload-form input,
  form.upload-form select,
  form.upload-form textarea {
    width: 100%;
  }

  /* Dossierregel: status onder de titel in plaats van ernaast. */
  .document-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .status-row-actions {
    margin-left: 0;
  }

  .page-header {
    flex-wrap: wrap;
  }

  .home-search {
    flex-direction: column;
  }

  .category-name {
    width: 100%;
  }

  .category-card-side {
    align-items: flex-start;
  }

  .pdf-viewer {
    height: 60vh;
  }

  .toasts {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }

  /* Geen toetsenbord op een telefoon: sneltoetsen-knop is dan zinloos. */
  [data-show-shortcuts] {
    display: none;
  }
}

/* --- Inloggen, account en gebruikersbeheer ------------------------------------- */

.auth-card {
  max-width: 28rem;
  margin: 3rem auto;
  padding: 2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 26, 54, 0.08);
}

.auth-card h1 {
  margin-top: 0;
}

.auth-card form {
  display: grid;
  gap: 0.5rem;
  margin: 1.25rem 0 0.5rem;
}

.auth-card label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.auth-card input[type="email"] {
  width: 100%;
}

.auth-card .message.error {
  margin: 0.5rem 0;
}

.auth-card .message.error:empty {
  display: none;
}

.code-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.admin-menu-panel hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.3rem 0;
}

.admin-menu-user {
  margin: 0;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  color: var(--color-text);
}

.admin-menu-panel form {
  margin: 0;
}

.admin-menu-logout {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  font: inherit;
  color: #a12a2a;
  cursor: pointer;
}

.admin-menu-logout:hover {
  background: var(--color-surface);
}

.passkey-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  border-top: 1px solid var(--color-border);
}

.passkey-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--color-border);
}

.invite-link {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--color-green-dark);
  background: var(--color-surface);
  border-radius: var(--radius);
}

.invite-link p {
  margin: 0 0 0.5rem;
}

.invite-link-row {
  display: flex;
  gap: 0.5rem;
}

.invite-link-row input {
  flex: 1;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
}
