/* Plaatsbeschrijving — Topo4D design system. Source of truth: DESIGN.md */

:root {
  /* Color */
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #000000;
  --ink-secondary: #1a1a1a;
  --muted: #6b6b6b;
  --icon: #aaaaaa;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --brand-orange: #f76304;
  --brand-orange-tint: rgba(247, 99, 4, 0.08);
  --ok: #059669;
  --wait: #d97706;
  --danger: #c8392e;

  /* Radius (DESIGN.md §Layout) */
  --radius-sm: 4px;
  --radius-md: 6px;

  /* Type families */
  --display: "Cabinet Grotesk", system-ui, sans-serif;
  --body: "General Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Offline / upload-queue indicator banner */
.offline-banner {
  position: sticky;
  top: 52px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  font-size: 13px;
  color: #92400e;
}
.offline-banner[hidden] { display: none; }
.offline-banner.queued {
  background: #fef3c7;
  border-bottom-color: #fcd34d;
  color: #92400e;
}
.offline-banner.synced {
  background: #d1fae5;
  border-bottom-color: #6ee7b7;
  color: #065f46;
}
.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wait);
  animation: pulse-soft 1.6s ease-in-out infinite;
}
.offline-banner.synced .offline-dot { background: var(--ok); animation: none; }
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Insecure-context warning banner (kept from before) */
.banner-insecure {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 14px;
  font-size: 14px;
  border-bottom: 1px solid #fcd34d;
}
.banner-insecure a { color: var(--ink); font-weight: 600; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand {
  flex: 0 0 auto;
  color: #fff;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
/* Breadcrumb chain in the topbar (right side). Horizontally scrollable when
   the chain doesn't fit — keeps the full path visible on long project titles
   without truncating ancestors. */
.crumbs {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumb {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  flex: 0 0 auto;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb:hover { color: #fff; }
.crumb-current {
  color: #fff;
  font-weight: 600;
  cursor: default;
}
.crumb-sep {
  color: rgba(255, 255, 255, 0.4);
  flex: 0 0 auto;
  font-size: 12px;
}
@media (max-width: 480px) {
  .brand { font-size: 13px; }
  .crumbs { font-size: 12px; gap: 4px; }
  .crumb { max-width: 14ch; }
}

/* ---------- Page shell ---------- */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.page.has-cta { padding-bottom: calc(72px + max(16px, env(safe-area-inset-bottom))); }

/* ---------- Headings ---------- */
h1 {
  margin: 8px 0 4px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
h2 {
  margin: 24px 0 12px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
}
h3 {
  margin: 20px 0 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.005em;
}
.section-title {
  font-family: var(--body);
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
}
.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.hint b { color: var(--ink); font-weight: 600; }
.muted-id {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0;
}

/* ---------- Panels (legacy structural marker) ---------- */
.panel {
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn-primary,
.btn-secondary,
.btn-danger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  cursor: pointer;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: filter 80ms ease-out, transform 80ms ease-out, background 80ms ease-out;
}
.btn-primary { background: var(--brand-orange); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: scale(0.99); filter: brightness(0.95); }
.btn-primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn-primary.big { font-size: 16px; padding: 16px 20px; width: 100%; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover { border-color: var(--ink); }
.btn-secondary:active { background: #f5f5f5; }
.btn-secondary.big { font-size: 16px; padding: 16px 20px; width: 100%; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }

.btn-ghost {
  appearance: none;
  height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 80ms ease-out, border-color 80ms ease-out;
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-ghost:active { background: #f5f5f5; }
.btn-ghost svg { width: 16px; height: 16px; stroke: var(--ink); }

/* Icon-only knop, identiek aan .btn-ghost maar vierkant en zonder tekst.
   Wordt gebruikt voor de per-categorie microfoonknop op het ruimte-scherm. */
.btn-icon {
  appearance: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 80ms ease-out, border-color 80ms ease-out;
}
.btn-icon:hover { border-color: var(--ink); }
.btn-icon:active { background: #f5f5f5; }
.btn-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--ink);
  fill: none;
}
/* Subtiele indicator dat er al audio is opgenomen voor deze categorie. */
.btn-icon.has-audio {
  border-color: var(--ink);
  position: relative;
}
.btn-icon.has-audio::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

/* Sticky bottom CTA bar */
.cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  z-index: 9;
}
.cta-bar > .btn-primary {
  width: 100%;
  max-width: 608px;
  height: 52px;
}

/* ---------- Multi-take recordings ---------- */
.rec-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.recordings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recordings-list:empty { display: none; }
.recording-row {
  display: grid;
  grid-template-columns: minmax(0, 220px) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafafa;
}
.recording-row audio {
  width: 100%;
  height: 36px;
}
.recording-transcript {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  word-break: break-word;
}
.recording-transcript em {
  color: var(--muted);
  font-style: italic;
}
.recording-delete {
  width: 36px;
  height: 36px;
  font-size: 16px;
  color: var(--danger);
}
.recording-delete:hover { border-color: var(--danger); }
.recording-merged {
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--brand-orange-tint);
  border-left: 3px solid var(--brand-orange);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
}
@media (max-width: 600px) {
  .recording-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "audio   delete"
      "transc  transc";
    row-gap: 6px;
  }
  .recording-row audio { grid-area: audio; }
  .recording-delete { grid-area: delete; }
  .recording-transcript { grid-area: transc; }
}

/* Verberg de room-level "Tekst opslaan" zodra de operator in een foto/audio
   capture-flow zit. Bij een open cat-capture <details> óf actief opname-button
   stuurt de capture-flow zijn eigen acties (Annuleren / Foto opslaan); de
   room-form CTA daaronder zou een onbedoelde submit veroorzaken en het werk
   weggooien. Page-padding blijft via .page.has-cta dus geen layout-jump. */
body:has(details.cat-capture[open]) .cta-bar,
body:has(.btn-record.recording) .cta-bar {
  display: none;
}

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form legend { padding: 0 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.form input[type="text"],
.form input:not([type]),
.form input[type="date"],
.form input[type="email"],
.form input[type="url"],
.form textarea {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--body);
  font-size: 15px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
.form input:focus,
.form textarea:focus { outline: 2px solid var(--ink); outline-offset: -2px; border-color: var(--ink); }
.form textarea { resize: vertical; min-height: 60px; }

.row { display: flex; gap: 8px; align-items: center; }
.row.gap { gap: 12px; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.row > .narrow { flex: 0 0 32%; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
}
.check input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.check input[type="checkbox"]:checked { background: var(--ink); }
.check input[type="checkbox"]:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* Algemene-info pair (project page) */
.alg-pair { padding: 10px 0; border-bottom: 1px dashed var(--line); display: flex; flex-direction: column; gap: 6px; }
.alg-pair:last-child { border-bottom: 0; }
.alg-label { font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.alg-staat, .alg-oms { font-size: 14px; }
.alg-oms { min-height: 44px; resize: vertical; }
/* Mobile: inputs en textareas niet té groot zodat tekst niet afgekapt wordt */
@media (max-width: 480px) {
  input[type=text], input:not([type]), input[type=date], select, textarea { font-size: 14px; padding: 8px 10px; }
}

/* ---------- List rows (projects, rooms) ---------- */
.projects, .rooms { list-style: none; margin: 0; padding: 0; }
.project-row, .room-row { border-top: 1px solid var(--line); }
.project-row:first-child, .room-row:first-child { border-top: 0; }
.project-link, .room-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 4px;
  text-decoration: none;
  color: var(--ink);
}
.project-link { flex-direction: row; align-items: center; gap: 12px; }
.project-link:hover, .room-link:hover { background: #fafafa; }
.project-title, .room-name { font-weight: 600; font-size: 15px; }
.project-sub, .room-sub { color: var(--muted); font-size: 13px; }

.project-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.project-thumb {
  width: 64px; height: 64px; flex: 0 0 64px;
  border-radius: 8px; overflow: hidden;
  background: #f1f1f1; display: flex; align-items: center; justify-content: center;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-thumb-empty { font-size: 28px; color: #bbb; }

/* ---------- Cover photo block (project gegevens tab) ---------- */
.cover-block {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cover-preview img {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  display: block;
}
.cover-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cover-upload input[type=file] { flex: 1; min-width: 200px; }
form.inline { display: inline; }

/* ---------- Project parties (form repeater) ---------- */
.party-form {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

/* ---------- Per-category capture group (room screen, design system §Room) ---------- */
.findings {
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.cat {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  grid-template-areas:
    "label input actions"
    ".     capture capture"
    ".     photos  photos";
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cat-label   { grid-area: label; font-family: var(--body); font-weight: 600; font-size: 14px; color: var(--ink); }
.cat-input   { grid-area: input; }
.cat-actions { grid-area: actions; display: flex; gap: 8px; align-items: center; }
.cat-capture { grid-area: capture; }
.cat-photos  { grid-area: photos; }

.cat input[type="text"] {
  height: 40px;
  padding: 0 10px;
  font-size: 14px;
}

/* Inline capture disclosure per category */
.cat-capture {
  margin: 0;
}
.cat-capture[open] {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
  background: #fafafa;
}
.cat-capture > summary {
  list-style: none;
  cursor: pointer;
  display: none; /* trigger lives in .cat-actions; details opens via JS click on the action button */
}
.cat-capture > summary::-webkit-details-marker { display: none; }

.cat-capture-form { display: flex; flex-direction: column; gap: 10px; }
.cat-capture-form .photo-pick { padding: 16px; }
.cat-capture-form .photo-preview img { max-height: 220px; }
.cat-capture-form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Photo strip per category */
.cat-photos {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-photos:empty { display: none; }
.cat-photos::-webkit-scrollbar { display: none; }

/* Photo thumbnail (per-category strip) */
.thumb {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--line);
  text-decoration: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .num {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
}
.thumb .dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px #fff;
}
.thumb .dot.ok    { background: var(--ok); }
.thumb .dot.wait  { background: var(--wait); }

/* ---------- Photo capture (full picker — used inside per-category disclosure or photo edit) ---------- */
.photo-pick {
  display: block;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 80ms ease-out, background 80ms ease-out;
}
.photo-pick:hover { border-color: var(--ink); background: #fafafa; }
.photo-pick input { display: none; }
.big-cta {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.photo-preview img {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-md);
  margin-top: 10px;
}

/* ---------- Audio recorder ---------- */
.audio-recorder {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.audio-recorder.inline-audio { background: #fafafa; }

.btn-record {
  appearance: none;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: transform 80ms ease-out, background 80ms ease-out, color 80ms ease-out;
}
.btn-record:active { transform: scale(0.99); }
.btn-record.recording {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #fff;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(247, 99, 4, 0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(247, 99, 4, 0); }
  100% { box-shadow: 0 0 0 0 rgba(247, 99, 4, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-record.recording { animation: none; }
  .btn-record:active { transform: none; }
}

.rec-status { color: var(--muted); font-size: 13px; }
.audio-recorder audio { display: none; width: 100%; }
.audio-recorder audio.has-data { display: block; }

/* ---------- Photo edit page ---------- */
.photo-large {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.cat-pill input { display: none; }
.cat-pill span {
  display: block;
  text-align: center;
  padding: 12px 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 80ms ease-out, background 80ms ease-out, color 80ms ease-out;
}
.cat-pill:hover span { border-color: var(--ink); }
.cat-pill input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.cat-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.cat-field .cat-label { width: 110px; font-weight: 600; color: var(--ink); font-size: 14px; }
.cat-field input { flex: 1; }

/* ---------- Room screen header (room name + exterieur) ---------- */
.head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 12px;
}
.head-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.room-name-input {
  appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 4px 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  background: transparent;
}
.room-name-input:hover { border-bottom-color: var(--line); }
.room-name-input:focus { outline: none; border-bottom-color: var(--brand-orange); }

/* ---------- Categories management (project page) ---------- */
.cats-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.cat-edit-row {
  display: grid;
  /* label flex | exterieur fixed | code fixed | opslaan fixed | delete/spacer fixed */
  grid-template-columns: 1fr 110px 84px 96px 40px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.cat-edit-row .check { font-size: 13px; justify-self: start; }
.cat-edit-label {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--body);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  min-width: 0;
  width: 100%;
}
.cat-edit-label:focus { outline: 2px solid var(--ink); outline-offset: -2px; border-color: var(--ink); }
.cat-code {
  display: inline-block;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  background: #f5f5f5;
  border-radius: 3px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-edit-row > button {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  width: 100%;
  justify-self: stretch;
}
.cat-edit-delete {
  color: var(--danger);
  border-color: var(--line-strong);
  font-size: 14px;
  padding: 0;
}
.cat-edit-delete:hover { border-color: var(--danger); }
.cat-edit-spacer {
  /* Fills the delete column on rows that can't be deleted (Algemeen) so the
     grid stays uniform. */
  display: block;
  width: 40px;
  height: 36px;
  visibility: hidden;
}

@media (max-width: 600px) {
  .cat-edit-row {
    grid-template-columns: 1fr 84px;
    grid-template-areas:
      "label   code"
      "ext     actions";
    row-gap: 6px;
  }
  .cat-edit-row .cat-edit-label { grid-area: label; }
  .cat-edit-row .cat-code { grid-area: code; }
  .cat-edit-row .check { grid-area: ext; }
  .cat-edit-row > button,
  .cat-edit-row > .cat-edit-spacer {
    grid-area: actions;
    justify-self: end;
    width: auto;
  }
  .cat-edit-row > button + button { margin-left: 6px; }
}

/* Screen-reader-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Larger viewports ---------- */
@media (min-width: 720px) {
  .cat { grid-template-columns: 120px 1fr auto; }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Narrow viewports (phone): wrap actions to second row ---------- */
@media (max-width: 600px) {
  .cat {
    grid-template-columns: 80px 1fr;
    grid-template-areas:
      "label input"
      ".     actions"
      ".     capture"
      ".     photos";
    row-gap: 6px;
  }
  .cat-actions { justify-content: flex-end; }
  h1 { font-size: 24px; }
}

/* ---------- Project subnav (tabs onder de topbar) ---------- */
/* Breidt uit tot de paginarand zodat de hairline doorloopt; tabs zelf
   houden de leesbreedte. Horizontale scroll wanneer 5 labels niet passen. */
.subnav {
  display: flex;
  gap: 0;
  margin: -8px -16px 16px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 12px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 80ms ease-out, border-color 80ms ease-out;
}
.subnav-tab:hover { color: var(--ink); }
.subnav-tab.is-active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

/* Tweede laag (alleen onder Parameters). Hiërarchisch lichter dan de hoofdtabs. */
.subsubnav {
  display: flex;
  gap: 6px;
  margin: -8px 0 16px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.subsubnav::-webkit-scrollbar { display: none; }
.subsubnav-tab {
  display: inline-flex;
  padding: 6px 10px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius-sm);
}
.subsubnav-tab:hover { color: var(--ink); background: #fafafa; }
.subsubnav-tab.is-active {
  color: var(--ink);
  background: #f2f2f2;
  font-weight: 600;
}

/* Danger zone — visueel afgescheiden onderaan een tab. */
.danger-zone {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ---------- Verslag preview ---------- */
/* Sober leesblok dat de inhoud van het verslag weerspiegelt zonder de legalese
   (cover, TOC, bepalingen, addendum, handtekeningen). */
.preview {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.preview h2 {
  margin: 16px 0 10px;
  font-size: 18px;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
}
.kv dt {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
}
.kv dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.45;
}
.kv dd b { font-weight: 600; }
.kv-tight { gap: 2px 12px; margin-top: 6px; }

.party-preview {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.party-preview li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.party-preview li:last-child { border-bottom: 0; }
.party-pos {
  grid-column: 1;
  grid-row: 1 / span 3;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
}
.party-naam { grid-column: 2; font-weight: 600; }
.party-meta { grid-column: 2; color: var(--muted); font-size: 13px; }

.room-preview {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.room-preview:first-of-type { border-top: 0; padding-top: 4px; }
.room-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.room-preview-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.room-preview-title:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.room-preview-meta {
  font-size: 12px;
  color: var(--muted);
}
.room-preview-intro {
  margin: 6px 0 4px;
}

/* ---------- Login ---------- */
/* Industrial-minimal: zelfde panel + buttons als de rest, geen extra
   versiering. Eén veld per regel, sticky 48px tap-targets, primary CTA
   in brand-orange volgens DESIGN.md regel 1. */
.page.page-login {
  max-width: 360px;
}
.login-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  background: var(--surface);
}
.login-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 16px;
  color: var(--ink);
}
.login-form {
  display: grid;
  gap: 16px;
}
.login-field {
  display: grid;
  gap: 6px;
}
.login-field > span {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.login-field > input {
  padding: 12px 12px;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--body);
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
.login-field > input:focus {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  border-color: var(--ink);
}
.login-error {
  margin: 0 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}
.login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.login-meta b { color: var(--ink); font-weight: 600; }
.logout-form { display: inline-flex; }
.logout-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--body);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
}
.logout-btn:hover { color: var(--ink); text-decoration: underline; }
