/* Utility helpers */
.hidden{ display:none !important; }

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

/* FUGA Admin (Carbon Steel-ish) */
/* Aileron (Light) – standaard UI-font */
@font-face {
  font-family: "Aileron";
  src: url("/assets/fonts/aileron/Aileron-Light.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg0:#0a0d11;
  --bg1:#11161d;
  --card:#151c24;
  --card2:#121820;
  --ink:rgba(240,244,248,0.94);
  --muted:rgba(240,244,248,0.60);
  --line:rgba(240,244,248,0.12);
  --line2:rgba(240,244,248,0.18);
  --accent:rgba(240,244,248,0.88);
  --danger:#b23a3a;
  --danger2:#d25151;
  --shadow: 0 12px 40px rgba(0,0,0,0.42);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: "Aileron", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";}

*{ box-sizing:border-box; }

/* Fix: voorkom zwarte “unpainted” vlakken onderaan bij lange pagina’s */
html, body{ height:100%; }

html{
  /* fallback: als body om wat voor reden dan ook niet tot scrollHeight “mee verft” */
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(255,255,255,0.06), transparent 55%),
    radial-gradient(900px 700px at 90% 20%, rgba(255,255,255,0.05), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

body.bg{
  min-height:100%;
  margin:0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(255,255,255,0.06), transparent 55%),
    radial-gradient(900px 700px at 90% 20%, rgba(255,255,255,0.05), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

/* Forceer consistente Schriftart voor form-controls (Chrome/Safari UA defaults omzeilen) */
button, input, select, textarea{
  font: inherit;
}

/* Technisch: command/structure velden mogen mono blijven */
#structureChatIn,
#structureCmd{
  font-family: var(--mono);
  font-size: 12px;
}

a{ color: inherit; }
.muted{ color: var(--muted); }
.mono{ font-family: var(--mono); }
.small{ font-size: 12px; }

.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(240,244,248,0.08);
  background:
    linear-gradient(180deg, rgba(8,12,16,0.96), rgba(8,12,16,0.88));
  backdrop-filter: blur(10px);
}

.topbarLeft,
.topLeft,
.topbarCenter,
.brandCenter,
.topbarRight,
.actions{
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbarLeft,
.topLeft{
  justify-content: flex-start;
  gap: 14px;
}

.topLeft > .brand{
  order: 1;
}

.topLeft > .btn.mini{
  order: 2;
}

.topbarCenter,
.brandCenter{
  justify-content: center;
}

.topbarRight,
.actions{
  justify-content: flex-end;
  gap: 8px;
}

.topnav,
.topbarNav{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topnavLink,
.topbarNavBtn,
.topbarAction,
.topLeft > .btn.mini{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(240,244,248,0.16);
  background: transparent;
  color: rgba(240,244,248,0.92);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    transform 80ms ease,
    box-shadow 120ms ease;
}

.topnavLink:hover,
.topbarNavBtn:hover,
.topbarAction:hover,
.topLeft > .btn.mini:hover{
  background: rgba(46,230,163,.22);
  border-color: #245645;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(46,230,163,.08);
}

.topnavLink:active,
.topbarNavBtn:active,
.topbarAction:active,
.topLeft > .btn.mini:active{
  transform: translateY(1px);
}

.topnavLink:focus-visible,
.topbarNavBtn:focus-visible,
.topbarAction:focus-visible,
.topLeft > .btn.mini:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(46,230,163,.12);
}.brand,
.brandBlock{
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand{
  gap: 8px;
  align-items: baseline;
}

.brandBlock{
  gap: 10px;
  padding: 4px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(240,244,248,0.08);
}

.brandMark{
  width: 34px;
  height: 34px;
  display: block;
  flex: 0 0 auto;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  opacity: 0.96;
}

.brandText{
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.logo{
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.05;
  white-space: nowrap;
  font-size: 18px;
  color: #79e3bc;
  text-transform: uppercase;
}

.brandSub,
.brand .muted{
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(240,244,248,0.72);
  line-height: 1.1;
}

.topbarBtn{
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
}

.wrap{
  max-width: 1344px;
  margin: 0 auto;
  padding: 14px 16px 28px;
}

@media (max-width: 820px){
  .topbar{
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 12px;
  }

  .topbarLeft,
  .topLeft,
  .topbarCenter,
  .brandCenter,
  .topbarRight,
  .actions{
    justify-content: center;
  }

  .topLeft,
  .topbarNav,
  .topbarRight,
  .actions{
    flex-wrap: wrap;
  }

  .topLeft{
    gap: 10px;
  }

  .topLeft > .brand{
    width: 100%;
    justify-content: center;
  }

  .brandBlock{
    width: 100%;
    justify-content: center;
  }
}
html, body{
  overflow-x: hidden;
  overscroll-behavior: none;
}
pre, code, .mono{ max-width: 100%; overflow-x: auto; }
.tablewrap, table{ max-width:100%; overflow-x:auto; }


.grid{
  display:grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;

  grid-template-areas:
    "client client"
    "map map"
    "project project"
    "upload upload"
    "explorer explorer"
    "tests tests";
}

#secClient{ grid-area: client; }
#secMap{ grid-area: map; }
#secProject{ grid-area: project; }
#secUpload{ grid-area: upload; }
#secExplorer{ grid-area: explorer; }
#secTests{ grid-area: tests; }

@media (max-width: 980px){
  .grid{
    grid-template-columns: 1fr;
    grid-template-areas:
      "client"
      "map"
      "project"
      "upload"
      "explorer"
      "tests";
  }
}

/* Client/evidence bestanden: turquoise achtergrond in de project-files tabel */
.filesTable tr.fileRowClient td{
  background: rgba(64, 224, 208, 0.12);
}
.filesTable tr.fileRowClient:hover td{
  background: rgba(64, 224, 208, 0.18);
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 40%), var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.25);
}

.card.compact{
  padding-top: 10px;
  padding-bottom: 10px;
}
.card.compact .row{
  margin: 8px 0;
}

.card h2{
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(240,244,248,0.80);
}
.span2{ grid-column: 1 / span 2; }

.row{
  display:flex;
  gap: 10px;
  align-items:center;
  margin: 10px 0;
}
.row.right{ justify-content:flex-end; }

.row.between{ justify-content: space-between; }

.wraprow{ flex-wrap: wrap; }

.lbl{
  display:block;
  font-size: 12px;
  color: rgba(240,244,248,0.62);
  margin-top: 10px;
  margin-bottom: 6px;
}
.hint{
  font-size: 12px;
  line-height: 1.35;
  margin-top: 6px;
}

.inp, .sel, .file, textarea{
  width: 100%;
  background: rgba(0,0,0,0.20);
  color: var(--ink);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 10px 10px;
  outline: none;
}
textarea{ resize: vertical; }
.sel{ padding: 10px; }

.btn{
  border: 1px solid rgba(240,244,248,0.16);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  white-space:nowrap;
}
.btn:hover{ background: rgba(255,255,255,0.09); }
.btn:active{ transform: translateY(1px); }
.btn.secondary{
  background: rgba(0,0,0,0.22);
}
.btn.secondary.expandHint{
  border-color: rgba(64, 224, 208, 0.38);
  background: rgba(64, 224, 208, 0.16);
  color: rgba(230, 255, 250, 0.92);
}
.btn.secondary.expandHint:hover{
  background: rgba(64, 224, 208, 0.22);
}
.btn.danger{
  border-color: rgba(210,81,81,0.38);
  background: rgba(210,81,81,0.14);
}
.btn.danger:hover{
  background: rgba(210,81,81,0.20);
}

.chk{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 13px;
  color: rgba(240,244,248,0.82);
  user-select:none;
}
.chk input{ transform: translateY(1px); }

.box{
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(240,244,248,0.14);
  border-radius: 12px;
  padding: 10px;
  overflow:auto;
  max-height: 260px;
}

.box.warn{
  border-color: rgba(255, 200, 80, 0.32);
  background: rgba(255, 200, 80, 0.06);
}

.box.small{ max-height: 210px; }

#mapLegend{
  white-space: pre-wrap;
  line-height: 1.35;
}

.elementsWrap{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.elCard{
  border: 1px solid rgba(240,244,248,0.12);
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 10px;
}
.elTop{
  display:flex;
  justify-content:space-between;
  gap: 10px;
}
.elKind{
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(240,244,248,0.70);
}
.elMeta{
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(240,244,248,0.50);
}
.elText{
  margin-top: 8px;
  line-height: 1.36;
  font-size: 13px;
  color: rgba(240,244,248,0.90);
}

/* Ingest bar */
.bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(240,244,248,0.08);
  border: 1px solid rgba(240,244,248,0.12);
  overflow:hidden;
  margin-top: 8px;
}
.barFill{
  height: 100%;
  width: 0%;
  background: rgba(240,244,248,0.55);
  transition: width 120ms linear;
}
.note{
  font-size: 12px;
  line-height: 1.3;
}

.bar.pulsing .barFill{
  background: linear-gradient(
    90deg,
    rgba(240,244,248,0.22) 0%,
    rgba(240,244,248,0.70) 50%,
    rgba(240,244,248,0.22) 100%
  );
  background-size: 200% 100%;
  animation: ingestPulse 900ms linear infinite;
}

@keyframes ingestPulse{
  0%   { background-position: 200% 0; }
  100% { background-position:   0% 0; }
}

/* Segmented control */
.seg{
  display:flex;
  border: 1px solid rgba(240,244,248,0.14);
  border-radius: 12px;
  overflow:hidden;
  background: rgba(0,0,0,0.20);
}
.segItem{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 9px 10px;
  cursor:pointer;
  user-select:none;
  font-size: 13px;
  color: rgba(240,244,248,0.82);
}
.segItem input{ margin:0; }
.segItem:hover{ background: rgba(255,255,255,0.06); }
/* Map */
.mapStack{
  display:flex;
  flex-direction:column;
  gap: 10px;

  /* Genoeg hoogte zodat mapFrame niet “platgedrukt” wordt door simHist/legend/details */
  height: min(92vh, 1100px);
  min-height: 760px;
}

@media (min-width: 1200px){
  .mapStack{
    height: min(86vh, 1200px);
    min-height: 820px;
  }
}

@media (max-width: 980px){
  .mapStack{
    height: min(78vh, 980px);
    min-height: 620px;
  }
}

.mapFrame{
  position: relative;
  width: 100%;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(240,244,248,0.14);
  border-radius: 16px;
  overflow:hidden;
  flex: 1 1 auto;

  /* Belangrijk: canvas krijgt pas “body” als dit niet te laag is */
  min-height: 520px;
}

@media (max-width: 980px){
  .mapFrame{ min-height: 420px; }
}

#clusterCanvas{
  display:block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#clusterCanvas:active{ cursor: grabbing; }

.pill{
  padding: 8px 10px;
  border: 1px solid rgba(240,244,248,0.14);
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--mono);
  color: rgba(240,244,248,0.70);
}
.hoverTip{
  position:absolute;
  pointer-events:none;
  z-index: 3;
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(240,244,248,0.14);
  background: rgba(0,0,0,0.76);
  color: rgba(240,244,248,0.92);
  max-width: min(520px, 72vw);
  box-shadow: var(--shadow);
}

.details{
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.35;
  overflow: auto;
  max-height: none;
  height: var(--mapDetailsH, 220px);
}

/* Details: minimalistische 2-koloms layout (als JS HTML rendert) */
.details .dTitle{
  font-size: 12px;
  letter-spacing: 0.02em;
  color: rgba(240,244,248,0.86);
  margin: 0 0 10px;
}

.details .dSub{
  font-size: 11px;
  color: rgba(240,244,248,0.60);
  margin: -6px 0 10px;
}

.details .dGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.details .dRow{
  display: contents; /* label/value als “cells” */
}

.details .dK{
  color: rgba(240,244,248,0.60);
}

.details .dV{
  color: rgba(240,244,248,0.86);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.details .dSep{
  height: 1px;
  background: rgba(240,244,248,0.10);
  margin: 10px 0 12px;
}

.hsplit{
  height: 10px;
  border-radius: 10px;
  cursor: ns-resize;
  background: rgba(240,244,248,0.06);
  border: 1px solid rgba(240,244,248,0.10);
  touch-action: none;
}
.hsplit:hover{
  background: rgba(240,244,248,0.10);
}
body.dragging{ cursor: ns-resize; }

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  z-index: 50;
}
.modalBackdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
}
.modalCard{
  position: relative;
  max-width: 520px;
  margin: 12vh auto 0;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 50%), rgba(10,14,20,0.96);
  border: 1px solid rgba(240,244,248,0.14);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.modalTitle{
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.modalText{
  color: rgba(240,244,248,0.72);
  font-size: 13px;
  line-height: 1.4;
}
.err{
  margin-top: 10px;
  color: rgba(210,81,81,0.94);
  background: rgba(210,81,81,0.12);
  border: 1px solid rgba(210,81,81,0.24);
  padding: 10px;
  border-radius: 12px;
}

.foot{
  margin-top: 16px;
  font-size: 12px;
  padding: 10px 4px;
}

@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; }
  .span2{ grid-column: 1; }
  .row{ flex-wrap: wrap; }
}


/* --- Additions: files list + responsive --- */
.filesList{ width:100%; overflow-x:auto; }
#filesList{ height: var(--filesListH, 260px); overflow: auto; }
.filesTable{ width:100%; border-collapse: collapse; }
.filesTable th, .filesTable td{
  padding:10px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.filesTable th{
  text-align:left;
  font-weight:600;
  font-size:12px;
  letter-spacing:0.03em;
  color: rgba(240,244,248,0.70);
}
.filesTable td{
  font-size:13px;
  color: rgba(240,244,248,0.88);
}
.filesActions{ display:flex; gap:8px; flex-wrap:wrap; }
.preBox{
  max-height:65vh;
  overflow:auto;
  white-space:pre-wrap;
  word-break:break-word;
  background: rgba(0,0,0,0.35);
  padding:12px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.modalCard.wide{
  width: min(980px, calc(100vw - 26px));
}
body{ overflow-x:hidden; }

/* Fix: lange LLM/JSON regels mogen nooit de layout oprekken */
pre.box,
pre.mono.box{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

/* Chat (structuur-assistent) */
.chatLog{
  max-height: 36vh;
  overflow: auto;
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatMsg{
  border: 1px solid rgba(240,244,248,0.12);
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 8px 10px;
}

.chatMsg.user{
  background: rgba(255,255,255,0.04);
}

.chatMsg .role{
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(240,244,248,0.60);
  margin-bottom: 4px;
}

.chatMsg .txt{
  font-size: 13px;
  line-height: 1.35;
  color: rgba(240,244,248,0.92);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chatMsg .cmd{
  margin-top: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(240,244,248,0.12);
  background: rgba(0,0,0,0.25);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Structure chat: focus + advanced */
.structureChatTop{
  margin-top: 6px;
  margin-bottom: 6px;
}

#structureFocusBadge{
  padding: 5px 10px;
  border: 1px solid rgba(240,244,248,0.16);
  background: rgba(0,0,0,0.22);
}

.structureAdvanced{
  margin-top: 10px;
}

.structureAdvanced > summary,
.segInspector > summary{
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.structureAdvanced > summary::-webkit-details-marker,
.segInspector > summary::-webkit-details-marker{
  display: none;
}

.structureAdvanced > summary{
  font-weight: 650;
  color: rgba(240,244,248,0.86);
}

.structureAdvanced > summary:before{
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: rgba(240,244,248,0.55);
  transform: translateY(-1px);
}

.structureAdvanced[open] > summary:before{
  content: "▾";
}

.structureAdvanced[open] > summary{
  margin-bottom: 10px;
}

.segInspector{
  margin-top: 10px;
}

.segInspector > summary{
  color: rgba(240,244,248,0.82);
}

.segInspector > summary:before{
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: rgba(240,244,248,0.55);
  transform: translateY(-1px);
}

.segInspector[open] > summary:before{
  content: "▾";
}

.segGrid{
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  margin-top: 10px;
}

.segOut{
  max-height: 30vh;
  overflow: auto;
}

@media (max-width: 980px){
  .segGrid{ grid-template-columns: 1fr; }
  .segControls{ order: -1; }
}

/* Chat meta (questions/notes) as collapsible details */
.chatMsg details.chatMeta{
  margin-top: 8px;
  border: 1px solid rgba(240,244,248,0.10);
  border-radius: 10px;
  background: rgba(0,0,0,0.22);
}

.chatMsg details.chatMeta > summary{
  cursor: pointer;
  user-select: none;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(240,244,248,0.62);
  list-style: none;
}

.chatMsg details.chatMeta > summary::-webkit-details-marker{
  display: none;
}

.chatMsg details.chatMeta > summary:before{
  content: "▸";
  display: inline-block;
  width: 14px;
  color: rgba(240,244,248,0.55);
}

.chatMsg details.chatMeta[open] > summary:before{
  content: "▾";
}

.chatMsg .metaBody{
  padding: 0 10px 10px 24px;
  font-size: 12.5px;
  line-height: 1.35;
  color: rgba(240,244,248,0.88);
  white-space: pre-wrap;
}

.chatMsg.tool{
  border-style: dashed;
  background: rgba(0,0,0,0.12);
}

@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; }
  .span2{ grid-column:auto; }
  .row{ flex-wrap:wrap; }
  .sel,.inp{ width:100%; min-width:0; }
  canvas{ max-width:100%; }
}

.fileLink{
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Structure tree ---- */
.structureTree{
  max-height: 52vh;
  overflow: auto;
  white-space: normal;
}

.structureOut{
  max-height: 42vh;

  /* Voorkom dat lange regels de layout oprekken */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

/* Prevent long LLM output from expanding the page width (chat + debug boxes) */
pre.mono.box,
.structureChatLog{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

/* Flex children should be allowed to shrink */
#structurePanelBody{ min-width: 0; }

/* Ook het “FUGA heeft hulp nodig” commando kan lange regels bevatten */
#structHelpCmd{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.structRoot{ display:flex; flex-direction:column; gap:10px; }

.structNode{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,0.18);
}

.structNode.child{ margin-left: 14px; }
.structNode.child2{ margin-left: 28px; }

.structHead{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.structTitle{ font-weight:650; font-size:13px; }
.structMeta{ font-size:12px; color: var(--muted); }

.fileRow{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }

.fileChip{
  --chip: #9bb7ff;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(240,244,248,0.18);
  background: color-mix(in oklab, var(--chip) 24%, rgba(0,0,0,0.35));
  color: rgba(240,244,248,0.92);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.fileChip:hover{
  border-color: rgba(240,244,248,0.32);
  background: color-mix(in oklab, var(--chip) 34%, rgba(0,0,0,0.35));
}

.fileChip{
  padding-right: 8px;
}

.fileChip .chipName{
  font-weight: 650;
}

.fileChip .chipBtns{
  display:inline-flex;
  gap:6px;
  margin-left: 8px;
}

.fileChip .chipBtn{
  border: 1px solid rgba(240,244,248,0.18);
  background: rgba(0,0,0,0.22);
  color: rgba(240,244,248,0.86);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

.fileChip .chipBtn:hover{
  background: rgba(255,255,255,0.06);
}

.fileChip .chipBtn.danger{
  border-color: rgba(210,81,81,0.38);
  background: rgba(210,81,81,0.14);
}

.fileChip .chipBtn.danger:hover{
  background: rgba(210,81,81,0.20);
}

/* ---- Structure tree ---- */
.structureTree{
  max-height: 52vh;
  overflow: auto;
  white-space: normal;
}

.structRoot{ display:flex; flex-direction:column; gap:10px; }

.structNode{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,0.18);
}

.structNode.child{ margin-left: 14px; }
.structNode.child2{ margin-left: 28px; }

.structHead{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.structTitle{ font-weight:650; font-size:13px; }
.structMeta{ font-size:12px; color: var(--muted); }

.fileRow{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }

.fileChip{
  --chip: #9bb7ff;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(240,244,248,0.18);
  background: color-mix(in oklab, var(--chip) 24%, rgba(0,0,0,0.35));
  color: rgba(240,244,248,0.92);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.fileChip:hover{
  border-color: rgba(240,244,248,0.32);
  background: color-mix(in oklab, var(--chip) 34%, rgba(0,0,0,0.35));
}

body.structureCollapsed .structureTree{
  max-height: 160px;
}
body.structureCollapsed #structurePanelBody{
  display: none;
}
body.structureCollapsed #structureCmd,
body.structureCollapsed #structureOut{
  display: none;
}

/* Chip knoppen (voor scope/delete zonder ALT/SHIFT) */
.fileChip{
  padding-right: 6px;
}
.fileChip .chipBtns{
  display: inline-flex;
  gap: 6px;
  margin-left: 10px;
}
.fileChip .chipBtn{
  border: 1px solid rgba(240,244,248,0.18);
  background: rgba(0,0,0,0.25);
  color: rgba(240,244,248,0.9);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}
.fileChip .chipBtn:hover{
  border-color: rgba(240,244,248,0.32);
}
.fileChip .chipBtn.danger{
  border-color: rgba(255,120,120,0.28);
}

/* ---- Experimenteerpaneel (grafiek parameters) ---- */
.expPanelBody{
  margin-top: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(240,244,248,0.12);
  background: rgba(0,0,0,0.16);
}

.expGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.expSubTitle{
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(240,244,248,0.72);
  margin: 0 0 8px;
}

.expField{
  border: 1px solid rgba(240,244,248,0.10);
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 8px;
}

.expLabelRow{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: rgba(240,244,248,0.78);
}

.rangeRow{
  display: flex;
  gap: 8px;
  align-items: center;
}

.range{ width: 100%; }
.expNum{ max-width: 120px; }
.expField .sel{ width: 100%; }

body.expCollapsed #expPanelBody{ display: none; }

@media (max-width: 980px){
  .expGrid{ grid-template-columns: 1fr; }
  .expPreset{ width: 100%; min-width: 0; }
}

/* Extra: experiment info + sim histogram */
.expInfo{
  margin-top: 10px;
  border: 1px solid rgba(240,244,248,0.10);
  background: rgba(0,0,0,0.14);
  border-radius: 12px;
  padding: 10px;
}
.expInfo > summary{
  cursor: pointer;
  user-select: none;
  color: rgba(240,244,248,0.82);
  font-size: 13px;
  list-style: none;
}
.expInfo > summary::-webkit-details-marker{ display:none; }
.expInfoBody{
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.expInfoBody .spacer{ height: 4px; }

.expHist{
  margin-top: 10px;
  padding-top: 8px;
}
.simHistCanvas{
  width: 100%;
  height: 120px;
  display: block;
  border: 1px solid rgba(240,244,248,0.10);
  background: rgba(0,0,0,0.10);
  border-radius: 12px;
}

#simHistMeta{ display:none; }

/* Upload/analyse panel tweaks */
.row.wraprow{
  flex-wrap: wrap;
}

.fileName{
  flex: 1 1 320px;
  min-width: 220px;
  max-width: min(560px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ingestStats{
  margin-top: 10px;
    margin-bottom: 10px; /* extra ruimte onder status/files/courses/units/elements, vóór Project */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ingestStatsRow{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.statChip{
  padding: 7px 10px;
  border: 1px solid rgba(240,244,248,0.14);
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--mono);
  color: rgba(240,244,248,0.72);
}

.statChip.flash{
  animation: statFlash 720ms ease-out 1;
}

@keyframes statFlash{
  0%   { background: rgba(240,244,248,0.22); box-shadow: 0 0 0 0 rgba(240,244,248,0.00); }
  45%  { background: rgba(240,244,248,0.14); box-shadow: 0 0 0 8px rgba(240,244,248,0.06); }
  100% { background: rgba(0,0,0,0.18); box-shadow: 0 0 0 0 rgba(240,244,248,0.00); }
}

/* Extra shimmer overlay while pulsing (subtle, modern) */
.bar{
  position: relative;
}
.bar.pulsing::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg,
    rgba(240,244,248,0.00) 0%,
    rgba(240,244,248,0.10) 45%,
    rgba(240,244,248,0.00) 100%
  );
  background-size: 220% 100%;
  animation: ingestShine 1100ms linear infinite;
  pointer-events: none;
}

@keyframes ingestShine{
  0%   { background-position: 220% 0; }
  100% { background-position:   0% 0; }
}

/* Client/evidence files highlight (turquoise) */
#filesList table.filesTable tbody tr.fileRowClient td{
  background: rgba(0, 210, 200, 0.10);
}
#filesList table.filesTable tbody tr.fileRowClient:hover td{
  background: rgba(0, 210, 200, 0.16);
}
#filesList table.filesTable tbody tr.fileRowClient td:first-child{
  box-shadow: inset 3px 0 0 rgba(0, 210, 200, 0.55);
}

/* Compact card variant (minder verticale padding) */
.card.compact{
  padding-top: 10px;
  padding-bottom: 10px;
}
.card.compact .row{ margin: 8px 0; }

/* Upload layout: main + side (right column narrower) */
.uploadGrid{
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  align-items: stretch;
}
.uploadMain, .uploadSide{
  min-width: 0;
}
.uploadSide{
  border-left: 1px solid rgba(240,244,248,0.10);
  padding-left: 14px;
}
.uploadSideTitle{
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(240,244,248,0.70);
  margin-bottom: 8px;
}

/* Responsive: stack columns */
@media (max-width: 980px){
  .uploadGrid{ grid-template-columns: 1fr; }
  .uploadSide{ border-left: none; padding-left: 0; border-top: 1px solid rgba(240,244,248,0.10); padding-top: 12px; }
}

/* Client/evidence files highlight (turquoise) */
#filesList table.filesTable tbody tr.fileRowClient td{
  background: rgba(0, 210, 200, 0.10);
}
#filesList table.filesTable tbody tr.fileRowClient:hover td{
  background: rgba(0, 210, 200, 0.16);
}
#filesList table.filesTable tbody tr.fileRowClient td:first-child{
  box-shadow: inset 3px 0 0 rgba(0, 210, 200, 0.55);
}

/* Experimenteerpaneel: als ingeklapt, alleen body weg; simHist staat nu buiten body */
body.expCollapsed #expPanelBody{ display: none; }


.mapCtlGrid{
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  align-items: start;
  margin-top: 8px;
}
@media (max-width: 980px){
  .mapCtlGrid{ grid-template-columns: 1fr; }
}

.kvRow{
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: center;
  margin: 14px 0;}

.kvLabel{
  font-size: 12px;
  color: rgba(240,244,248,0.62);
}
.chk.inline{
  margin: 0;
  gap: 10px;
}

/* Alleen voor de chronologie-toggle (mooier, stabieler) */
#mapChronoOn{
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(240,244,248,0.22);
  background: rgba(0,0,0,0.22);
  position: relative;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

#mapChronoOn::after{
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(240,244,248,0.72);
  transition: transform 160ms ease, background 160ms ease;
}

#mapChronoOn:checked{
  border-color: rgba(64, 224, 208, 0.45);
  background: rgba(64, 224, 208, 0.18);
  box-shadow: 0 0 0 3px rgba(64, 224, 208, 0.10);
}

#mapChronoOn:checked::after{
  transform: translateX(16px);
  background: rgba(230, 255, 250, 0.92);
}

/* Label spacing: geen kunstmatige margin-left meer */
.chk.inline span{ margin-left: 0; }

.mapCtlRight .expPreset{ width: 100%; margin-top: 10px; }
.mapCtlRight .expBtnRow{ margin-top: 8px; }

.clientGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 980px){
  .clientGrid{ grid-template-columns: 1fr; }
}

.userSearch{
  min-width: 220px;
  max-width: 320px;
}

.selSm{
  max-width: 320px;
}

.clientGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 980px){
  .clientGrid{ grid-template-columns: 1fr; }
}

.userSearch{
  min-width: 220px;
  max-width: 320px;
}

.selSm{
  max-width: 320px;
}

/* --- Files list: stable columns + client highlighting --- */
.filesList { overflow-x: auto; }

.filesTable {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.filesTable th, .filesTable td {
  padding: 8px 10px;
  vertical-align: top;
}

.filesTable th:nth-child(1), .filesTable td:nth-child(1) { width: 135px; } /* Toegevoegd */
.filesTable th:nth-child(2), .filesTable td:nth-child(2) { width: 420px; } /* Bestand */
.filesTable th:nth-child(3), .filesTable td:nth-child(3) { width: 260px; } /* Acties */
.filesTable th:nth-child(4), .filesTable td:nth-child(4) { width: 95px; }  /* Bytes */
.filesTable th:nth-child(5), .filesTable td:nth-child(5) { width: 95px; }  /* Tekst */

/* Data is kolom 6: maak 'm smal (Breite) */
.filesTable th:nth-child(6), .filesTable td:nth-child(6) { width: 95px; } /* Data */

/* Scope / Door / Locked zijn 7/8/9 */
.filesTable th:nth-child(7), .filesTable td:nth-child(7) { width: 240px; } /* Scope */
.filesTable th:nth-child(8), .filesTable td:nth-child(8) { width: 70px; }  /* Door */
.filesTable th:nth-child(9), .filesTable td:nth-child(9) { width: 70px; }  /* Locked */

.filesTable .fileCell {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.filesTable td.filesActions { white-space: nowrap; }

.filesTable tr.fileRowClient td {
  background: rgba(0, 210, 200, 0.14);
}

.filesTable tr.fileRowClient:hover td {
  background: rgba(0, 210, 200, 0.20);
}

/* --- Files list: fouten (ev:0 / el:0) duidelijk markeren --- */
.filesTable tr.fileRowBad td{
  /* “rode lijn onderstreept” over de hele rij */
  border-bottom: 1px solid rgba(255, 70, 70, 0.75);
}

.filesTable td.fileDataBad{
  /* Data-cel extra opvallend */
  background: rgba(255, 70, 70, 0.22) !important;
  color: rgba(255, 210, 210, 0.95);
  font-weight: 700;
}

/* --- Collapse: structuur & documenten --- */
body.structureCollapsed #filesList,
body.structureCollapsed #structureChatLog,
body.structureCollapsed #structureChatIn,
body.structureCollapsed #structureOut,
body.structureCollapsed #structureCmd,
body.structureCollapsed #btnApplyStructureCmd {
  display: none !important;
}

/* --- FilesList: strak kader + sticky header + nette actions --- */
#filesList.filesList.box{
  padding: 0;              /* geen rare “inspringing” rondom de tabel */
  overflow: auto;          /* beide assen */
}

#filesList.filesList.box.small{
  max-height: 320px;       /* iets ruimer dan 210, minder gepropt */
}

#filesList table.filesTable{
  width: 100%;
  border-collapse: collapse; /* voorkom “losse” cell-look */
  border-spacing: 0;
  table-layout: fixed;
}

#filesList table.filesTable thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(10,12,14,0.98);
  backdrop-filter: none;
}

#filesList table.filesTable th,
#filesList table.filesTable td{
  padding: 10px 10px;
}

/* Belangrijk: géén display:flex op een <td> (kan tabel-layout breken in Chrome) */
#filesList .filesActions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;       /* zodat de laatste knop niet uit de cel wordt weggeknipt */
  align-items: center;
}

#filesList .filesActions .btn{
  padding: 6px 10px;     /* iets compacter, helpt bij 4 knoppen */
}

@media (max-width: 980px){
  #filesList .filesActions{ flex-wrap: wrap; }
}

#filesList td.filesActions .btn{
  padding: 6px 10px;     /* iets compacter, helpt bij 4 knoppen */
}

@media (max-width: 980px){
  #filesList td.filesActions{ flex-wrap: wrap; }
}

#filesList:empty{ padding: 10px; }

/* --- Map time slider --- */
.mapTimeCtl{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mapTimeLbl{
  min-width: 96px;
  text-align: right;
  color: rgba(240,244,248,0.72);
}
#mapTime:disabled{ opacity: 0.45; }
#mapRecentGlowRow{ grid-template-columns: 96px auto; }
#mapRecentGlowRow .btn{ width: auto; justify-self: start; max-width: 100%; }

/* --- Map gate (geen cliënt geselecteerd) --- */
.mapFrame { position: relative; }

.mapGate{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 6;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.mapGateInner{
  max-width: 520px;
  margin: 0 18px;
  padding: 16px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(10,12,14,0.78);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
}

.mapGateTitle{
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}

.mapGateText{
  color: rgba(240,244,248,0.78);
  line-height: 1.45;
}

/* --- Client selector glow wanneer kaart gated is --- */
@keyframes clientPulseGlow{
  0%   { box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 0 18px rgba(240,140,90,0.18); }
  50%  { box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 0 26px rgba(240,140,90,0.28); }
  100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 0 18px rgba(240,140,90,0.18); }
}

body.needsClientPick #secClient{
  border-color: rgba(255,255,255,0.14);
  animation: clientPulseGlow 1.6s ease-in-out infinite;
}

body.needsClientPick #userSelect{
  border-color: rgba(240,140,90,0.55);
  box-shadow: 0 0 0 1px rgba(240,140,90,0.18), 0 0 22px rgba(240,140,90,0.18);
}

/* --- Dossier view (niet-mono; raw JSON blijft mono in <pre>) --- */
.dossierView{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

.dossierCard{
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.14);
  border-radius: 14px;
  padding: 12px 12px;
}

.dossierCardTitle{
  font-weight: 700;
  margin-bottom: 8px;
}

.dossierKV{
  display:flex;
  justify-content:space-between;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dossierKV:last-child{ border-bottom: none; }

.dossierK{ color: rgba(240,244,248,0.70); }
.dossierV{ color: rgba(240,244,248,0.92); text-align:right; }

.dossierList{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 10px;
}

.dossierItem{
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: rgba(0,0,0,0.10);
  padding: 10px 10px;
}

.dossierItemTop{
  display:flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.dossierItemTitle{
  font-weight: 650;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dossierItemMeta{
  color: rgba(240,244,248,0.62);
  font-size: 12px;
  white-space: nowrap;
}

.dossierItemBody{
  margin-top: 8px;
  color: rgba(240,244,248,0.80);
  line-height: 1.45;
}

/* --- Dossier (client) --- */
.dossierView{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dossierCard{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.10);
}

.dossierCardTitle{
  font-weight: 650;
  margin-bottom: 8px;
}

.dossierKV{
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dossierKV:last-child{ border-bottom: none; }

.dossierK{ color: rgba(255,255,255,0.60); font-size: 12px; font-family: var(--mono); }
.dossierV{ font-size: 13px; overflow-wrap: anywhere; }

.dossierList{ display: flex; flex-direction: column; gap: 8px; }

.dossierItem{
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.08);
}

.dossierItemTop{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: baseline;
}

.dossierItemTitle{ font-weight: 600; font-size: 13px; }
.dossierItemMeta{ font-family: var(--mono); font-size: 12px; color: rgba(255,255,255,0.55); }
.dossierItemBody{ margin-top: 6px; font-size: 13px; color: rgba(255,255,255,0.78); white-space: pre-wrap; }

.dossierDetails{ padding: 0; }
.dossierDetails > summary{
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
}
.dossierDetails > summary::-webkit-details-marker{ display:none; }
.dossierDetails[open] > summary{ border-bottom: 1px solid rgba(255,255,255,0.07); }
.dossierDetailsBody{ padding: 10px 12px; }

.dossierDebug{ margin-top: 10px; }
.dossierDebug > summary{ list-style:none; }
.dossierDebug > summary::-webkit-details-marker{ display:none; }

.userProjectsBox{
  margin: 10px 0 0;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.08);
}
.userProjectsBox summary{
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.userProjectsList{
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.userProjectsList .projRow{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.08);
}
.userProjectsList .projRow .projMeta{
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

/* Dossier-only view (print/tab) */
body.dossierOnly #secMap,
body.dossierOnly #secProject,
body.dossierOnly #secUpload,
body.dossierOnly #secExplorer,
body.dossierOnly #secTests{
  display: none !important;
}

body.dossierOnly #secClient .clientLeft{
  display: none !important;
}

body.dossierOnly #secClient .clientGrid{
  grid-template-columns: 1fr !important;
}

/* In dossier-only: geen dubbele "Dossier" label + geen raw debug */
body.dossierOnly #secClient .clientHeaderRight .sectionTitle{
  display: none !important; /* PDF knop blijft zichtbaar */
}
body.dossierOnly #secClient .dossierDebug{
  display: none !important;
}
body.dossierOnly #btnLoadDossier{
  display: none !important;
}

/* Pulse helper (in-page dossier refresh) */
@keyframes dossierPulseOnce{
  0%   { box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 0 0 rgba(0,210,200,0.00); }
  60%  { box-shadow: 0 0 0 1px rgba(0,210,200,0.22), 0 18px 52px rgba(0,210,200,0.10); }
  100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 0 0 rgba(0,210,200,0.00); }
}
.dossierView.pulseOnce{
  animation: dossierPulseOnce 0.65s ease-out 1;
}

/* Print: PDF knop moet alleen dossier printen (ook als je per ongeluk in normale view print) */
@media print{
  .topbar,
  #secMap, #secProject, #secUpload, #secExplorer, #secTests{
    display: none !important;
  }
  #secClient .clientLeft{ display: none !important; }
  #secClient .dossierDebug{ display: none !important; }
  #btnLoadDossier{ display: none !important; }

  #secClient{
    border: 0 !important;
    box-shadow: none !important;
  }
}

/* Upload & analyse: 2-koloms layout met rechter zijpaneel */
#secUpload .uploadGrid{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

#secUpload .uploadMain{
  min-width: 0;
}

#secUpload .uploadSide{
  border-left: 1px solid var(--line);
}

/* We gebruiken class="card uploadSide" voor JS-compatibiliteit,
   maar visueel moet het géén losse card-in-card worden. */
#secUpload .uploadSide.card{
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0 0 0 14px; /* alleen links padding, naast de divider */
}

#secUpload .uploadSideTitle{
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(240,244,248,0.80);
}

@media (max-width: 980px){
  #secUpload .uploadGrid{
    grid-template-columns: 1fr;
  }
  #secUpload .uploadSide{
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  #secUpload .uploadSide.card{
    padding: 14px 0 0 0; /* boven padding na divider */
  }
}

/* ---------------------------------------------------------------------------
   UI tweaks (2026-03) — compact layout + better controls
--------------------------------------------------------------------------- */

/* Experimenteerpaneel label: iets meer lucht boven selector */
#secMap .mapCtlRight > .muted.small{
  display:block;
  margin-bottom: 10px;
}

/* Uitklap-knoppen: soft lichtgroen-turkois wanneer ingeklapt */
#btnToggleExperiments[aria-expanded="false"],
#btnToggleStructure[aria-expanded="false"]{
  border-color: rgba(0, 210, 200, 0.55);
  color: rgba(190, 255, 246, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 210, 200, 0.10), 0 12px 28px rgba(0, 210, 200, 0.06);
}

/* Resizable panels: mapDetails + inventaris */
#mapDetails.details{
  overflow: auto;
  resize: vertical;
  min-height: 140px;
  max-height: 70vh;
}

#filesList.filesList{
  overflow: auto;
  resize: vertical;
  min-height: 180px;
  max-height: 70vh;
}

/* Inventaris kolombreedtes (Acties tussen Bestand en Bytes) */
#filesList table.filesTable th:nth-child(1),
#filesList table.filesTable td:nth-child(1){ width: 135px; } /* Toegevoegd ~20% smaller */

#filesList table.filesTable th:nth-child(2),
#filesList table.filesTable td:nth-child(2){ width: 420px; } /* Bestand */

#filesList table.filesTable th:nth-child(3),
#filesList table.filesTable td:nth-child(3){ width: 190px; } /* Acties */

#filesList table.filesTable th:nth-child(4),
#filesList table.filesTable td:nth-child(4){ width: 95px; }  /* Bytes */

#filesList table.filesTable th:nth-child(5),
#filesList table.filesTable td:nth-child(5){ width: 95px; }  /* Tekst */

#filesList table.filesTable th:nth-child(6),
#filesList table.filesTable td:nth-child(6){ width: 260px; } /* Scope */

#filesList table.filesTable th:nth-child(7),
#filesList table.filesTable td:nth-child(7){ width: 70px; }  /* Door */

#filesList table.filesTable th:nth-child(8),
#filesList table.filesTable td:nth-child(8){ width: 70px; }  /* Locked */

/* Recent glow knop in tijd-row iets compacter */
#btnRecentGlow.btnGlow{
  padding: 6px 10px;
  white-space: nowrap;
}

@media print{
  #btnDossierPdf,
  #btnRecentGlow{ display:none !important; }
}

/* Tijd-UI: range + label netjes op één regel */
.mapTimeCtl{
  display:flex;
  align-items:center;
  gap: 10px;
  width: 100%;
}

.mapTimeCtl .range{
  flex: 1 1 auto;
  min-width: 140px;
}

.mapTimeLbl{
  min-width: 44px;
  text-align: right;
}

/* Section titles (Dossier / Structuur / Experimenteerpaneel) */
.sectionTitle{
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(240,244,248,0.88);
}

.sectionTitle.subtle{
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  color: rgba(240,244,248,0.78);
}

/* Client grid: dossier column higher / tighter */
.clientGrid{
  align-items: start;
}

.clientRight{
  align-self: start;
}

.clientRight .row.between{
  margin-top: 0 !important;
}

/* Allow filesList to grow much larger; height is controlled via --filesListH */
#filesList.filesList.box.small{
  max-height: none !important;
}
#filesList{
  max-height: none !important; /* override older 70vh clamps */
}
/* Resizable structure tree */
#structureTree.structureTree.box{
  height: var(--structureTreeH, 340px);
  overflow: auto;
}
.mapTimeMeta{
  margin-top: 8px;
  color: rgba(240,244,248,0.72);
  text-align: left;
}

/* We show the exact cutoff time in the right column instead */
#mapTimeLbl{
  display: none;
}
.clientRight .row.between{
  margin-top: 0 !important;
}
.dossierSummaryCard .dossierToggle{
  cursor: pointer;
  user-select: none;
}
.dossierSummaryCard .dossierExtra{
  display: none;
  margin-top: 10px;
}
.dossierSummaryCard.expanded .dossierExtra{
  display: block;
}

.clientHeader{
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px; /* vergelijkbaar met h2 margin-bottom */
}

.clientHeaderRight{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

/* omdat h2 nu binnen .clientHeader zit */
.clientHeader h2{
  margin: 0;
}

#mapTimeMeta{
  display: block;
}
#mapTimeLbl{
  display: none;
}

/* Tijd rechts: optisch uitlijnen met de tijdbalk zonder de slider te beïnvloeden */
.mapTimeMeta{
  display: flex;
  align-items: center;   /* baseline/center geeft stabiele uitlijning */
  min-height: 28px;      /* voorkomt “springen” bij wisselende teksthoogte */
  padding-top: 10px;     /* <-- hoofdcorrectie: lager zetten */
  line-height: 1.1;
}

/* als je #mapTimeMeta al styling heeft, maar je wilt alleen de offset: */
#mapTimeMeta{
  margin-top: 0;
}

/* Collapsible cards (Tests paneel) */
.card details.collapsible{
  margin: 0;
}

.card details.collapsible > summary{
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(240,244,248,0.80);

  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

.card details.collapsible > summary::-webkit-details-marker{
  display: none;
}

.card details.collapsible > summary::after{
  content: "▸";
  opacity: 0.7;
  transform: translateY(-1px);
}

.card details.collapsible[open] > summary::after{
  content: "▾";
}

.testsHelp{
  margin: 2px 0 12px;
  line-height: 1.45;
}

/* -------------------- Structuur-assistent UI (één chatkader) -------------------- */

.structureComposer{
  margin-top: 10px;
}

.structureToolbar{
  margin-top: 8px;
  gap: 8px;
  align-items: center;
}

.pill.small{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  opacity: 0.95;
}

.inp.small{
  max-width: 180px;
  padding: 8px 10px;
  font-size: 12px;
}

.advDetails{
  margin-top: 12px;
}

.advDetails > summary{
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Compact chat rendering */
.structureChatLog{
  padding: 10px 12px;
}

.chatMsg{
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 9px 10px;
  margin: 8px 0;
  background: rgba(0,0,0,0.18);
}

.chatMsg.user{
  background: rgba(255,255,255,0.03);
}

.chatMeta{
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
  opacity: 0.85;
  font-size: 12px;
}

.chatRole{
  font-weight: 700;
  letter-spacing: 0.01em;
}

.chatTs{
  opacity: 0.65;
}

.chatBody{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.42;
}

.msgDetails{
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 6px;
}

.msgDetails > summary{
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  opacity: 0.85;
}

.msgDetails pre{
  margin: 8px 0 0;
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.06);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* --- Organisatie-assistent: tijdelijke melding (toast) --- */
.structureToast{
  position: sticky;
  top: 10px;
  z-index: 6;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 210, 200, 0.40);
  background: rgba(0, 210, 200, 0.18);
  color: rgba(230, 255, 252, 0.95);
  font-size: 12.5px;
  line-height: 1.3;
  box-shadow: 0 8px 26px rgba(0,0,0,0.25);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 420ms ease, transform 420ms ease;
}

.structureToast.fadeOut{
  opacity: 0;
  transform: translateY(-4px);
}

/* --- Organisatie-assistent: highlight van "extracted units" regels in details --- */
.msgDetails pre .lineExtractedUnits{
  display: block;
  margin: 2px 0;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(0, 210, 200, 0.18);
  border: 1px solid rgba(0, 210, 200, 0.22);
  color: rgba(230, 255, 252, 0.95);
}

@media (max-width: 980px) {
  .inp.small{
    max-width: 140px;
  }
}

/* Chronologische focus panel */
.focusBox{
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.focusBox .kvRow{
  margin-top: 8px;
}

#focusHint{
  margin-top: 6px;
}

    /* ---------------------------------------------------------
       Compacte UI: Focuspunt + Experimenteerpaneel
       --------------------------------------------------------- */

    /* Focuspunt instellen (details/summary) */
    #focusBox > summary{
      list-style: none;
      cursor: pointer;
      user-select: none;
    }
    #focusBox > summary::-webkit-details-marker{ display:none; }
    #focusBox[open] > summary{ margin-bottom: 10px; }

    /* Experimenteerpaneel compacter + 1-regel layout */
    :root{
      --expLabelW: 190px;  /* <- gelijke linkergrens/labelbreedte */
      --expNumW: 92px;
      --expRowGap: 6px;
    }

    #expPanelBody .expField{
      margin: 0 0 var(--expRowGap) 0;
      padding: 0;
      display: grid;
      grid-template-columns: var(--expLabelW) 1fr;
      align-items: center;
      column-gap: 12px;
    }

    /* Label links; hide de “dubbele” waarde (…Val) rechts in labelrow */
    #expPanelBody .expField .expLabelRow{
      margin: 0;
      padding: 0;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    #expPanelBody .expField .expLabelRow > span:last-child{
      display: none; /* verberg expSimKVal / expSimMinVal / etc. -> geen dubbele waarde */
    }

    /* Range + nummer in dezelfde regel rechts */
    #expPanelBody .expField .rangeRow{
      margin: 0;
      padding: 0;
      display: grid;
      grid-template-columns: 1fr var(--expNumW);
      align-items: center;
      gap: 10px;
    }

    /* Sliders op 1 regel; voorkom extra verticale ruimte */
    #expPanelBody .expField input.range{
      margin: 0;
    }
    #expPanelBody .expField .inp.expNum{
      width: var(--expNumW);
      margin: 0;
    }

    /* Ook dropdownvelden (zoals "Weergave") netjes 1-regelig naast label */
    #expPanelBody .expField > select.sel{
      margin: 0;
      width: 100%;
    }

    /* Subtitels/preset/knoppen iets compacter */
    #expPanelBody .expSubTitle{ margin: 0 0 8px 0; }
    .mapCtlRight .expBtnRow{ margin-top: 6px; }

    :root{
  --fuga-bg: var(--bg0, #0b0d10);
  --fuga-surface: rgba(255,255,255,0.035);
  --fuga-surface2: rgba(255,255,255,0.022);
  --fuga-border: rgba(255,255,255,0.085);
  --fuga-border2: rgba(255,255,255,0.06);
  --fuga-text: var(--fg0, rgba(255,255,255,0.92));
  --fuga-muted: rgba(255,255,255,0.62);
  --fuga-muted2: rgba(255,255,255,0.48);
  --fuga-accent: rgba(120, 210, 210, 0.95); /* subtiel turkoois */
  --fuga-radius: 16px;
}

.fugaMetaGrid{
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 12px;
  align-items: start;
}

@media (max-width: 920px){
  .fugaMetaGrid{ grid-template-columns: 1fr; }
}

.fugaCard{
  border: 1px solid var(--fuga-border);
  border-radius: var(--fuga-radius);
  background:
    linear-gradient(180deg, var(--fuga-surface), var(--fuga-surface2));
  box-shadow:
    0 10px 30px rgba(0,0,0,0.35),
    0 1px 0 rgba(255,255,255,0.06) inset;
  overflow: hidden;
}

.fugaCardHead{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--fuga-border2);
}

.fugaKicker{
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fuga-muted2);
  line-height: 1.1;
}

.fugaTitle{
  font-size: 16px;
  font-weight: 600;
  color: var(--fuga-text);
  line-height: 1.25;
  margin-top: 3px;
}

.fugaHeadActions{
  display: flex;
  align-items: center;
  gap: 10px;
}

.fugaBtn{
  appearance: none;
  border: 1px solid var(--fuga-border);
  background: rgba(255,255,255,0.03);
  color: var(--fuga-text);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12.5px;
  cursor: pointer;
}

.fugaBtn:hover{
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.045);
}

.fugaBadge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--fuga-border);
  background: rgba(255,255,255,0.03);
  color: var(--fuga-text);
  font-size: 12.5px;
  white-space: nowrap;
}

.fugaBadge.isReady{
  border-color: rgba(120, 210, 210, 0.35);
  box-shadow: 0 0 0 3px rgba(120, 210, 210, 0.08);
}

.fugaKvGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  padding: 12px 14px 10px;
}

@media (max-width: 540px){
  .fugaKvGrid{ grid-template-columns: 1fr; }
}

.fugaKv{
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 12px;
  padding: 10px 10px;
  background: rgba(0,0,0,0.10);
}

.fugaKey{
  font-size: 12px;
  color: var(--fuga-muted2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.fugaVal{
  font-size: 13.5px;
  color: var(--fuga-text);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.fugaValMono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.fugaChips{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.fugaChip{
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}

.fugaLegend{
  padding: 0 14px 12px;
}

.fugaLegendRow{
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px dashed rgba(255,255,255,0.07);
}

.fugaLegendRow:first-child{ border-top: none; }

.fugaLegendLabel{
  font-size: 12px;
  color: var(--fuga-muted2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fugaBar{
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}

.fugaBar > i{
  display: block;
  height: 100%;
  width: 100%;
}

.fugaDetails{
  border-top: 1px solid var(--fuga-border2);
  padding: 10px 14px;
}

.fugaDetails summary{
  cursor: pointer;
  color: var(--fuga-muted);
  font-size: 12.5px;
}

.fugaRaw{
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.86);
  font-size: 12.5px;
  line-height: 1.35;
  overflow: auto;
}

/* FUGA meta cards: compactere kv layout */
.fugaKvGrid{
  gap: 6px;
  margin-top: 8px;
}
.fugaKv{
  padding: 6px 10px;
  border-radius: 10px;
}
.fugaKv .k{
  margin-bottom: 2px;
  line-height: 1.15;
}
.fugaKv .v{
  line-height: 1.2;
}

/* Meer Luft onder console-snippets */
#structChatLog pre,
.structChatLog pre,
pre.structHelpCmd,
pre.fugaCodeBlock{
  margin: 10px 0 14px;
}