:root {
  --bg: #f6f1e9;
  --card: #ffffff;
  --ink: #1d2a33;
  --muted: #6b7780;
  --line: #e6dfd3;
  --sea: #1f5f7a;
  --sea-soft: #e3eef2;
  --sun: #d9822b;
  --sun-soft: #fbeedd;
  --green: #3b7d4f;
  --green-soft: #e4f1e7;
  --red: #b5462f;
  --red-soft: #f8e3de;
  --violet: #6a4c93;
  --violet-soft: #ece6f4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29, 42, 51, .06), 0 4px 16px rgba(29, 42, 51, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 650; }
a { color: var(--sea); }

/* Buttons & inputs */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 550; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: #cfc5b5; }
.btn.primary { background: var(--sea); border-color: var(--sea); color: #fff; }
.btn.primary:hover { background: #184d63; }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
input, select, textarea {
  font: inherit; color: inherit; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--sea); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); background: var(--card); border-radius: 16px; padding: 28px;
  box-shadow: var(--shadow); display: grid; gap: 14px; text-align: center;
}
.login-card label { text-align: left; }
.login-card input[name=pin] { font-size: 22px; letter-spacing: 6px; text-align: center; }
.logo { font-size: 40px; color: var(--sun); line-height: 1; }
.error { color: var(--red); min-height: 1.2em; margin: 0; font-size: 14px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(246, 241, 233, .92); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 16px; padding: 10px 24px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; color: var(--sea); white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--muted);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

main { max-width: 1180px; margin: 0 auto; padding: 20px 24px 60px; }
main > section { display: grid; gap: 16px; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: grid; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .val { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .lbl { color: var(--muted); font-size: 13px; }
.tile.warn .val { color: var(--red); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1 1 260px; width: auto; }
.toolbar select { width: auto; }
.spacer { flex: 1; }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; justify-content: space-between; cursor: pointer; }
.list li:first-child { border-top: 0; }
.list .sub { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty { color: var(--muted); margin: 0; }

/* Badges */
.badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.k-origineel { background: var(--sun-soft); color: #9a5512; }
.k-vertaling { background: var(--sea-soft); color: var(--sea); }
.k-analyse { background: var(--violet-soft); color: var(--violet); }
.k-notitie { background: #eee; color: #555; }
.s-open { background: var(--sun-soft); color: #9a5512; }
.s-bezig { background: var(--sea-soft); color: var(--sea); }
.s-gedaan { background: var(--green-soft); color: var(--green); }
.chip { font-size: 12px; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 99px; }

/* Documenten */
.doc-list { display: grid; gap: 10px; }
.doc { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.doc-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; }
.doc-row:hover { background: #fcfaf6; }
.doc-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; background: var(--bg); color: var(--muted); }
.doc-icon.pdf { background: var(--red-soft); color: var(--red); }
.doc-icon.xls { background: var(--green-soft); color: var(--green); }
.doc-icon.md { background: var(--violet-soft); color: var(--violet); }
.doc-main { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-children { border-top: 1px solid var(--line); background: #fcfaf6; }
.doc-children .doc-row { padding-left: 40px; }
.doc-children .doc-row + .doc-row { border-top: 1px solid var(--line); }

/* Afspraken */
.af-list { display: grid; gap: 10px; }
.af { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; gap: 14px; align-items: flex-start; }
.af input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--green); flex: none; }
.af.done .af-title { text-decoration: line-through; color: var(--muted); }
.af-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.af-title { font-weight: 600; }
.af-desc { color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.overdue { color: var(--red); font-weight: 600; }

/* Cijfers */
.chart-wrap { position: relative; height: 260px; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr:hover td { background: #fcfaf6; }

/* Modal */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog.wide { width: min(1100px, calc(100vw - 32px)); height: calc(100dvh - 32px); }
dialog::backdrop { background: rgba(29, 42, 51, .45); }
#modalBody { display: flex; flex-direction: column; height: 100%; max-height: inherit; }
.m-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.m-head h3 { flex: 1; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.m-body { padding: 18px 20px; overflow: auto; display: grid; gap: 12px; align-content: start; flex: 1; }
.m-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.m-foot .left { margin-right: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.close { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; padding: 4px; }

/* Viewer */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 300px; flex: 1; min-height: 0; }
.viewer-main { min-height: 0; overflow: auto; background: #f3efe8; }
.viewer-main iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.viewer-main img { max-width: 100%; display: block; margin: 0 auto; }
.viewer-side { border-left: 1px solid var(--line); padding: 16px; overflow: auto; display: grid; gap: 14px; align-content: start; font-size: 14px; }
.viewer-side dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.viewer-side dt { color: var(--muted); }
.viewer-side dd { margin: 0; overflow-wrap: anywhere; }
.markdown { background: #fff; max-width: 820px; margin: 0 auto; padding: 28px 32px; min-height: 100%; line-height: 1.6; }
.markdown table { border-collapse: collapse; margin: 12px 0; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 10px; }
.markdown pre { background: var(--bg); padding: 12px; border-radius: 8px; overflow: auto; }
.sheet-tabs { display: flex; gap: 4px; padding: 8px; flex-wrap: wrap; position: sticky; top: 0; background: #f3efe8; }
.sheet-wrap { padding: 0 8px 8px; }
.sheet-wrap table { border-collapse: collapse; background: #fff; font-size: 13px; }
.sheet-wrap td, .sheet-wrap th { border: 1px solid #e2ddd3; padding: 4px 8px; white-space: nowrap; }
.no-preview { padding: 40px; text-align: center; color: var(--muted); }

.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--sea); background: var(--sea-soft); }
.seg { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); }

@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .viewer { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .viewer-side { border-left: 0; border-top: 1px solid var(--line); max-height: 40dvh; }
}
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .tabs { order: 3; flex-basis: 100%; }
  #logout { margin-left: auto; }
  main { padding: 14px 16px 60px; }
  .row2 { grid-template-columns: 1fr; }
  .doc-children .doc-row { padding-left: 24px; }
  .chart-wrap { height: 220px; }
}

a.btn { text-decoration: none; text-align: center; display: inline-block; }
@media (max-width: 600px) {
  .tabs button { flex: 1; padding: 8px 6px; font-size: 14px; }
}

.file-rows { display: grid; gap: 10px; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.file-row small { font-weight: 400; overflow-wrap: anywhere; }
@media (max-width: 600px) { .file-row { grid-template-columns: 1fr; } }

/* Infographics */
.k-infographic { background: var(--green-soft); color: var(--green); }
.doc-icon.html { background: var(--green-soft); color: var(--green); }
.ig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ig-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; }
.ig-card:hover { box-shadow: 0 2px 4px rgba(29,42,51,.08), 0 8px 24px rgba(29,42,51,.1); }
.ig-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #f3efe8; border-bottom: 1px solid var(--line); }
.ig-thumb iframe { position: absolute; top: 0; left: 0; width: 400%; height: 400%; border: 0; transform: scale(.25); transform-origin: 0 0; pointer-events: none; background: #fff; }
.ig-info { padding: 12px 16px; display: grid; gap: 2px; }
@media (max-width: 600px) { .tabs button { flex: none; padding: 8px 10px; } }

/* ===== v2: tags, opmerkingen, kleurrijkere documenten, interactieve cijfers ===== */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.seg button { white-space: nowrap; }
.toolbar .seg { flex: none; }
.toolbar .seg button { flex: none; padding: 6px 12px; }
.tile.flat { box-shadow: none; background: var(--bg); }
.val.sm { font-size: 20px; font-weight: 700; }
#ovCijfers .tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Tags */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.tag.pick { cursor: pointer; border: 1.5px solid transparent; }
.tag.pick:hover { filter: brightness(.96); }
.tag.pick.on { border-color: currentColor; box-shadow: 0 0 0 2px #fff inset; }
.tag-x { border: 0; background: transparent; color: inherit; font-size: 15px; line-height: 1; padding: 0 0 1px 2px; cursor: pointer; opacity: .7; }
.tag-x:hover { opacity: 1; }
.tagbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 26px; }
.tagbar-lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 2px; }
.tag-line { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }

/* Documenten: meer kleur */
.doc { border-left: 4px solid var(--sun); }
.doc-row { transition: background .12s; }
.doc-icon { width: 42px; height: 42px; border-radius: 10px; font-size: 11px; letter-spacing: .03em; color: #fff; background: #8a97a0; }
.doc-icon.pdf { background: #c8553d; color: #fff; }
.doc-icon.xls { background: #3b8a57; color: #fff; }
.doc-icon.md, .doc-icon.txt { background: #6a4c93; color: #fff; }
.doc-icon.html { background: #2f8f9d; color: #fff; }
.doc-icon.img { background: #d9822b; color: #fff; }
.doc-icon.doc { background: #2f6fb0; color: #fff; }
.doc-title { font-size: 15.5px; }
.doc-meta { margin-top: 3px; gap: 6px; }
.doc-children { background: #fbf8f2; }
.doc-children .doc-icon { width: 34px; height: 34px; border-radius: 8px; font-size: 10px; }
.cc { font-size: 13px; font-weight: 650; color: var(--sea); background: var(--sea-soft); padding: 3px 9px; border-radius: 99px; white-space: nowrap; flex: none; }
.doc-group { display: grid; gap: 6px; }
.doc-group-head { display: flex; gap: 8px; align-items: center; padding: 4px 2px 0; }
.hint { color: var(--muted); font-size: 13px; margin: 2px; }
.drop-loose { display: none; border: 2px dashed var(--sea); color: var(--sea); background: var(--sea-soft); border-radius: var(--radius); padding: 14px; text-align: center; font-weight: 600; }
.doc-list.dragging.can-loose .drop-loose { display: block; }
.drop-loose.drop-on { background: var(--sea); color: #fff; }
.doc.drop-on { outline: 3px solid var(--sea); outline-offset: 2px; }
.doc-row[draggable=true] { cursor: grab; }
@media (hover: none) { .drag-hint { display: none; } }

/* Documentvenster */
.side-block { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.comment-row { display: flex; gap: 6px; }
.comment-row input { min-width: 0; padding: 6px 8px; font-size: 13px; }
.comment-form { display: grid; gap: 6px; }
.comment-form textarea { min-height: 56px; font-size: 14px; }
.comments { display: grid; gap: 8px; }
.comment { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.comment-head .tag-x { margin-left: auto; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-actions .btn { padding: 7px 6px; white-space: normal; }
.viewer { grid-template-columns: minmax(0, 1fr) 330px; }

/* Cijfers */
.cf-app { display: grid; gap: 16px; }
.src { font-size: 13px; color: var(--muted); text-align: right; }
.scen-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.ctrl { display: grid; gap: 20px; align-content: start; }
.ctrl > div { display: grid; gap: 6px; }
.ctrl-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ctrl .val { font-weight: 700; }
.ctrl .seg { justify-self: start; display: inline-flex; flex-wrap: wrap; }
.ctrl .seg button { flex: none; padding: 6px 12px; font-size: 13px; }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: var(--sea); }
.toggle { display: flex; grid-auto-flow: column; gap: 8px; align-items: center; font-weight: 600; color: var(--ink); cursor: pointer; font-size: 14px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--sea); flex: none; }
.range-ends { display: flex; justify-content: space-between; }
.result { background: var(--sea); color: #fff; border-radius: var(--radius); padding: 20px; display: grid; gap: 12px; align-content: start; }
.result.loss { background: var(--red); }
.result .big { font-size: clamp(28px, 4.5vw, 40px); font-weight: 750; line-height: 1.15; }
.result .lbl { opacity: .85; font-size: 13px; }
.result table { width: 100%; border-collapse: collapse; font-size: 14px; }
.result td { padding: 5px 0; border-top: 1px solid rgba(255,255,255,.2); }
.result td:last-child { text-align: right; }
.stack { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.18); }
.stack i { display: block; height: 100%; transition: width .2s; }
#rsKosten { background: #fff; }
#rsWinst { background: #8fd0a0; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; opacity: .92; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; background: var(--c); }

.st-table { display: grid; }
.st-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 110px 190px 120px; gap: 10px; align-items: center; padding: 9px 4px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 400; color: var(--ink); cursor: pointer; }
.st-row input { width: 17px; height: 17px; accent-color: var(--sea); }
.st-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-top: 0; cursor: default; }
.st-foot { font-weight: 700; border-top: 2px solid var(--ink); cursor: default; }
.st-row > .num { text-align: right; }
.st-name { font-weight: 600; display: block; }
.st-note { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.st-row.off { opacity: .45; }
.strong { font-weight: 700; }

.bars { display: grid; gap: 4px; }
.bar { display: grid; grid-template-columns: 230px minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 8px; border: 0; background: transparent; text-align: left; width: 100%; font: inherit; color: inherit; }
button.bar { cursor: pointer; }
button.bar:hover { background: var(--bg); }
.bar .track { height: 18px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--sea); border-radius: 5px; min-width: 2px; }
.bar.hot .fill, .subbars .fill { background: var(--sun); }
.bar .amt { text-align: right; font-size: 14px; }
.bar .name { font-weight: 600; font-size: 14px; }
.subbars { margin: 2px 0 8px 14px; padding: 10px; background: var(--sun-soft); border-radius: 10px; display: grid; gap: 2px; }
.subbars .track { background: rgba(255,255,255,.7); }

.th-list { display: grid; }
.th { display: grid; gap: 5px; padding: 10px 2px; border-top: 1px solid var(--line); }
.th:first-child { border-top: 0; }
.th-head, .th-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.over { color: var(--red); font-weight: 700; }
.th-track { display: flex; height: 14px; background: var(--green-soft); border-radius: 7px; overflow: hidden; flex-direction: row-reverse; }
.th-sure { background: var(--red); }
.th-maybe { background: #e2a193; }
.totalrow { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 2px 0; border-top: 2px solid var(--ink); margin-top: 6px; font-weight: 700; }
.rng { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 160px; gap: 10px; align-items: center; padding: 7px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.rng .track { position: relative; height: 14px; background: var(--bg); border-radius: 7px; }
.rng .band { position: absolute; top: 0; bottom: 0; background: var(--sun); border-radius: 7px; min-width: 3px; }
.rng .amt { text-align: right; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.fact { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.fact .lbl { font-weight: 600; font-size: 14px; }
details.manage summary { cursor: pointer; font-weight: 650; }

@media (max-width: 860px) {
  .scen-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer { grid-template-columns: minmax(0, 1fr); }
  .viewer-side { max-height: 48dvh; }
  .st-head { display: none; }
  .st-row { grid-template-columns: 22px minmax(0, 1fr) auto; row-gap: 2px; }
  .st-row > .num { grid-column: 2 / -1; text-align: left; font-size: 13px; }
  .st-row > .num::before { content: attr(data-l) ": "; color: var(--muted); font-weight: 400; }
  .st-foot > .num::before { content: ""; }
  .bar { grid-template-columns: minmax(0, 1fr) auto; }
  .bar .track { grid-column: 1 / -1; grid-row: 2; height: 12px; }
  .rng { grid-template-columns: minmax(0, 1fr) auto; }
  .rng .track { grid-column: 1 / -1; grid-row: 2; }
  .src { text-align: left; }
  .card-head { flex-wrap: wrap; }
}
/* Losmaak-strook zweeft onderin, zodat de lijst niet verspringt tijdens het slepen */
.drop-loose { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; width: min(520px, calc(100vw - 32px)); box-shadow: 0 8px 30px rgba(29,42,51,.25); background: #fff; }

/* ===== Planning (Gantt) ===== */
.tile.txt .val { font-size: 22px; }
.gantt-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.gantt { display: grid; grid-template-columns: minmax(220px, 300px) minmax(620px, 1fr); row-gap: 4px; align-items: stretch; }
.g-head { border: 0; }
.g-years, .g-months { display: flex; font-size: 12px; color: var(--muted); }
.g-years span { border-left: 1px solid var(--line); padding: 2px 6px; font-weight: 700; color: var(--ink); }
.g-months span { flex: 1; text-align: center; border-left: 1px solid var(--line); padding: 2px 0; }
.g-label { position: sticky; left: 0; z-index: 2; background: var(--card); border: 0; text-align: left; font: inherit; color: inherit; padding: 6px 10px 6px 0; cursor: pointer; display: grid; gap: 1px; }
.g-label:hover .g-name { color: var(--sea); text-decoration: underline; }
.g-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.g-dates { font-size: 12px; color: var(--muted); }
.g-track { position: relative; cursor: pointer; border-radius: 6px; min-height: 40px;
  background: repeating-linear-gradient(90deg, var(--bg) 0, var(--bg) calc(100% / var(--months) - 1px), var(--line) calc(100% / var(--months) - 1px), var(--line) calc(100% / var(--months))); }
.g-bar { position: absolute; top: 9px; bottom: 9px; border-radius: 6px; min-width: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.g-track:hover .g-bar { filter: brightness(1.1); }
.g-aankoop { background: var(--sun); }
.g-bouw { background: var(--sea); }
.g-verkoop { background: var(--green); }
.g-now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--red); z-index: 1; }
.legend.dark { color: var(--muted); opacity: 1; }
.legend .lg-aankoop { --c: var(--sun); } .legend .lg-bouw { --c: var(--sea); } .legend .lg-verkoop { --c: var(--green); } .legend .lg-now { --c: var(--red); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot.g-aankoop { background: var(--sun); } .dot.g-bouw { background: var(--sea); } .dot.g-verkoop { background: var(--green); }
.note-card { background: var(--sun-soft); box-shadow: none; border-left: 4px solid var(--sun); }
@media (max-width: 600px) { .gantt { grid-template-columns: 150px minmax(560px, 1fr); } .g-name { font-size: 13px; } }
.card { align-content: start; }
.g-bar { top: 50%; bottom: auto; height: 22px; transform: translateY(-50%); }

/* Cijfers uit het Excel */
.sc-table th.cur, .sc-table td.cur { background: var(--sea-soft); font-weight: 700; }
.sc-table th.num { text-align: right; }
.fin-stack { display: flex; height: 34px; border-radius: 8px; overflow: hidden; font-size: 12.5px; font-weight: 700; color: #fff; margin-bottom: 12px; }
.fin-stack span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; padding: 0 6px; min-width: 0; }
.fs-bank { background: #7a8b99; } .fs-mtec { background: var(--sea); } .fs-bram { background: var(--sun); }

/* =====================================================================
   Thema v3: strak, donkergroene zijbalk, serif-koppen (Fraunces), Inter
   ===================================================================== */
:root {
  --bg: #e9e3d8;
  --card: #f3efe7;
  --ink: #1c241f;
  --muted: #6f6a60;
  --line: #d6cdbd;
  --side: #1c2a22;
  --side-ink: #d9ddd5;
  --gold: #c9a45c;
  --sea: #1f3a2e;            /* primaire kleur = donkergroen */
  --sea-soft: #dfe4da;
  --sun: #b8873b;
  --sun-soft: #efe3cb;
  --green: #4d7a5a;
  --green-soft: #dde8dc;
  --red: #a4442f;
  --red-soft: #f1dcd3;
  --violet: #6b5a86;
  --violet-soft: #e6e0ec;
  --radius: 10px;
  --shadow: none;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
}
body { background: var(--bg); color: var(--ink); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14.5px; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }

/* Layout met zijbalk */
#app:not([hidden]) { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 22px 14px 16px; gap: 6px; }
.sidebar .brand { font-family: var(--serif); font-weight: 400; font-size: 21px; color: #f1ede4; padding: 0 8px 18px; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.brand-mark { color: var(--gold); font-size: 18px; }
.sidebar .tabs { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: visible; }
.nav-section { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); padding: 16px 10px 6px; }
.sidebar .tabs button, .nav-foot { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; color: var(--side-ink); font: 500 14.5px/1 Inter, sans-serif; padding: 10px 10px; border-radius: 7px; cursor: pointer; text-align: left; box-shadow: none; }
.sidebar .tabs button:hover, .nav-foot:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .tabs button.active { background: rgba(255,255,255,.1); color: #fff; box-shadow: none; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-foot { opacity: .75; }

main { max-width: 1120px; margin: 0; padding: 28px 40px 64px; width: 100%; }
.page-head { padding-bottom: 6px; }
.page-head .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.page-head h1 { font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1.1; letter-spacing: -.015em; margin: 6px 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); position: relative; }
.page-head h1::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 40px; height: 1px; background: var(--ink); }

/* Kaarten, tegels: rand in plaats van schaduw */
.card, .tile, .doc, .ig-card { background: var(--card); border: 1px solid var(--line); box-shadow: none; border-radius: var(--radius); }
.card { padding: 18px 20px; }
.tiles { gap: 0; background: transparent; }
#tiles, #ovCijfers .tiles, #plApp > .tiles { display: flex; flex-wrap: wrap; gap: 8px 44px; padding: 4px 0 8px; }
#tiles .tile, #ovCijfers .tile, #plApp > .tiles .tile { background: transparent; border: 0; padding: 0; border-radius: 0; }
.tile .val, .val.sm, .tile.txt .val { font-family: var(--serif); font-weight: 300; font-size: 34px; line-height: 1.15; letter-spacing: -.01em; }
#ovCijfers .tile .val { font-size: 28px; }
.tile .lbl { order: -1; }
.tile { display: flex; flex-direction: column; }
.tile .lbl, .fact .lbl { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.tile.warn .val { color: var(--red); }
.card-head h2, .card > h2 { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Knoppen en invoer */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 7px; font-weight: 600; font-size: 13.5px; padding: 8px 14px; }
.btn:hover { border-color: #bdb2a0; background: #f7f4ee; }
.btn.primary { background: var(--side); border-color: var(--side); color: #f1ede4; }
.btn.primary:hover { background: #2a3d31; }
input, select, textarea { background: #fbf9f5; border-color: var(--line); border-radius: 7px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.seg { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { border-radius: 6px; font-weight: 600; }
.seg button.on, .seg button.active { background: var(--side); color: #f1ede4; box-shadow: none; }

/* Badges en tags: gedempt */
.badge { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; }
.k-origineel { background: #e6d8bc; color: #7a5520; }
.k-vertaling { background: #dfe4da; color: #2f4a3a; }
.k-analyse { background: #e3dce8; color: #5a4a73; }
.k-notitie, .k-infographic { background: #e4ded3; color: #5e584e; }
.tag { font-weight: 600; font-size: 11.5px; }
.cc { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* Documenten */
.doc { border-left: 1px solid var(--line); overflow: hidden; }
.doc-row { padding: 12px 16px; }
.doc-row:hover { background: #f7f4ee; }
.doc-icon, .doc-children .doc-icon { width: 34px; height: 40px; border-radius: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; background: #fbf9f5; border: 1px solid var(--line); color: var(--muted); position: relative; }
.doc-icon.pdf { color: #a4442f; border-color: #d9b7aa; background: #fbf4f0; }
.doc-icon.xls { color: #3f6b4d; border-color: #b8cdb9; background: #f2f7f1; }
.doc-icon.md, .doc-icon.txt { color: #5a4a73; border-color: #cdc2d8; background: #f6f3f8; }
.doc-icon.html, .doc-icon.img, .doc-icon.doc { color: #7a5520; border-color: #dccaa6; background: #faf5ec; }
.doc-children .doc-icon { width: 28px; height: 34px; }
.doc-title { font-weight: 600; font-size: 14.5px; }
.doc-children { background: #ede8de; border-top: 1px solid var(--line); }
.doc-children .doc-row + .doc-row { border-top: 1px solid var(--line); }
.tagbar-lbl { color: var(--muted); }

/* Tabellen zoals het voorbeeld */
.table { font-size: 14px; }
.table th { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--muted); background: transparent; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px 12px; }
.table tr:hover td { background: transparent; }
.sc-table th.cur, .sc-table td.cur { background: #e6dfd1; }

/* Cijfers en planning */
.result { background: var(--side); border-radius: var(--radius); }
.result .big { font-family: var(--serif); font-weight: 300; font-size: 44px; letter-spacing: -.015em; }
.result.loss { background: var(--red); }
#rsWinst { background: var(--gold); }
.legend span[style*="8fd0a0"]::before, .legend #rsLbl::before { background: var(--gold); }
.bar .track, .th-track, .rng .track { background: #e4ddd0; }
.bar .fill { background: var(--side); }
.bar.hot .fill, .subbars .fill { background: var(--sun); }
.subbars { background: #ede5d3; }
.totalrow { border-top: 1px solid var(--ink); }
.fact { background: transparent; border: 1px solid var(--line); }
.fact .val.sm { font-size: 26px; }
.fs-bank { background: #8e8a7e; } .fs-mtec { background: var(--side); } .fs-bram { background: var(--sun); }
.fin-stack { border-radius: 6px; height: 30px; }
.g-track { background: repeating-linear-gradient(90deg, #ece6da 0, #ece6da calc(100% / var(--months) - 1px), var(--line) calc(100% / var(--months) - 1px), var(--line) calc(100% / var(--months))); }
.g-label { background: var(--card); }
.g-bar { border-radius: 4px; box-shadow: none; height: 18px; }
.g-aankoop, .dot.g-aankoop { background: var(--sun); }
.g-bouw, .dot.g-bouw { background: var(--side); }
.g-verkoop, .dot.g-verkoop { background: var(--green); }
.legend .lg-bouw { --c: var(--side); }
.note-card { background: #efe5cf; border: 1px solid #dccaa6; border-left: 3px solid var(--sun); }
.list li { border-top-color: var(--line); }

/* Modal en login */
dialog { border-radius: 12px; background: var(--card); box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.m-head h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: -.01em; }
.m-head, .m-foot { border-color: var(--line); }
.viewer-side { background: var(--card); border-color: var(--line); }
.comment { background: #ebe5da; }
.login { background: var(--side); }
.login-card { background: var(--card); border-radius: 12px; box-shadow: none; border: 1px solid var(--line); }
.login-card h1 { font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: -.01em; }
.logo { color: var(--gold); }
.toast { background: var(--side); }

/* Telefoon en tablet: zijbalk wordt een balk bovenaan */
@media (max-width: 860px) {
  #app:not([hidden]) { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 4px; }
  .sidebar .brand { padding: 0 6px; font-size: 18px; flex: 1; }
  .sidebar .tabs { order: 3; flex: 1 0 100%; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .nav-section { display: none; }
  .sidebar .tabs button { width: auto; flex: none; padding: 8px 12px; font-size: 14px; gap: 8px; }
  .nav-foot { width: auto; padding: 8px 10px; }
  .nav-foot span { display: none; }
  main { padding: 18px 16px 56px; }
  .page-head h1 { font-size: 30px; }
  #tiles, #ovCijfers .tiles, #plApp > .tiles { gap: 14px 28px; }
  .tile .val, .val.sm, .tile.txt .val { font-size: 26px; }
  .result .big { font-size: 36px; }
}
main > section { padding-top: 18px; }
.ctrl { align-content: start; grid-auto-rows: max-content; }
@media (max-width: 600px) {
  .sidebar .tabs .ico { display: none; }
  .sidebar .tabs button { padding: 8px 11px; }
  .sidebar .tabs { justify-content: space-between; }
}
.ctrl p { margin: 0; }

/* ===== v3.1: kleinere typografie, rustiger pillen, uitgelijnde rijen ===== */
body { font-size: 13.5px; line-height: 1.5; }
main { padding: 26px 36px 56px; max-width: 1180px; }
.page-head .eyebrow { font-size: 10.5px; }
.page-head h1 { font-size: 30px; padding-bottom: 12px; }
#tiles, #ovCijfers .tiles, #plApp > .tiles { gap: 6px 40px; }
.tile .val, .val.sm, .tile.txt .val { font-size: 26px; }
#ovCijfers .tile .val, .fact .val.sm { font-size: 22px; }
.tile .lbl, .fact .lbl, .card-head h2, .card > h2 { font-size: 10.5px; letter-spacing: .11em; }
.card { padding: 16px 18px; gap: 10px; }
.card-head { min-height: 26px; }
.btn { font-size: 12.5px; padding: 6px 12px; }
.btn.small, .card-head .btn { font-size: 12px; padding: 3px 10px; font-weight: 600; }
.sidebar .tabs button, .nav-foot { font-size: 13.5px; padding: 9px 10px; }
.sidebar .brand { font-size: 19px; }
.nav-section { font-size: 10px; }

/* Pillen: klein en rustig */
.badge { font-size: 9.5px; letter-spacing: .07em; padding: 2px 7px; line-height: 1.5; font-weight: 700; vertical-align: middle; }
.tag { font-size: 11px; padding: 1px 8px; line-height: 1.6; }
.k-loopt { background: #e6d8bc; color: #7a5520; }

/* Lijstrijen: vaste kolommen, één regel per item */
.list li.row { display: grid; grid-template-columns: auto minmax(0, 1fr) 84px 128px; gap: 12px; align-items: center; padding: 9px 0; font-size: 13.5px; }
.r-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-badge { justify-self: start; }
.r-date { text-align: right; color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#ovDocs li.row { grid-template-columns: auto minmax(0, 1fr) 84px 76px; }
.list li.row .dot { margin: 0; }
.doc-icon.mini { width: 22px; height: 26px; font-size: 7px; border-radius: 3px; letter-spacing: .02em; }
.list li.row:hover .r-title { color: var(--side); text-decoration: underline; text-underline-offset: 2px; }

/* Documentenlijst iets compacter */
.doc-row { padding: 10px 14px; gap: 12px; }
.doc-title { font-size: 14px; }
.doc-meta { gap: 6px; font-size: 12px; }
.doc-icon { width: 30px; height: 36px; }
.doc-children .doc-icon { width: 26px; height: 31px; }
.doc-children .doc-row { padding-left: 34px; }
.table { font-size: 13px; }
.table th, .table td { padding: 8px 10px; }
.result .big { font-size: 38px; }
.result table, .ctrl-row, .bar .name, .bar .amt { font-size: 13px; }
.g-name { font-size: 13px; }
.m-head h3 { font-size: 20px; }

@media (max-width: 600px) {
  .list li.row, #ovDocs li.row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .list li.row .r-date { grid-column: 2 / -1; text-align: left; margin-top: -6px; }
  .page-head h1 { font-size: 26px; }
}
@media (max-width: 860px) {
  main { padding: 18px 16px 56px; }
  #tiles, #ovCijfers .tiles, #plApp > .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
  .tile .val, .val.sm, .tile.txt .val { font-size: 22px; }
  .card-head:has(> .btn) { flex-wrap: nowrap; }
}

/* ===== Detailvenster document + iconen (Lucide) ===== */
.lucide { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #ebe5da; }
.btn.danger { color: var(--red); }

/* Iconknoppen in lijsten */
.row-actions { display: inline-flex; gap: 2px; flex: none; }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: var(--muted); border: 1px solid transparent; }
.icon-btn:hover { color: var(--side); background: #fbf9f5; border-color: var(--line); }
.icon-btn .lucide { width: 16px; height: 16px; }
.doc-row .row-actions { margin-left: 4px; }
.cc { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; font-size: 12px; }
.cc .lucide { width: 13px; height: 13px; }
#ovDocs li.row { grid-template-columns: auto minmax(0, 1fr) 84px 76px auto; }
#ovDocs .icon-btn { width: 26px; height: 26px; }

/* Detailvenster: smal, overzichtelijk */
dialog:not(.wide) { width: min(580px, calc(100vw - 24px)); }
.dm-head { align-items: flex-start; gap: 14px; padding: 18px 20px 16px; }
.dm-head .doc-icon { margin-top: 2px; }
.dm-title { flex: 1; min-width: 0; display: grid; gap: 6px; justify-items: start; }
.dm-title h3 { font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
.dm-head .close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; padding: 0; }
.dm-head .close:hover { background: #ebe5da; color: var(--ink); }
.dm-head .close .lucide { width: 18px; height: 18px; }
.dm-body { gap: 0; padding: 0 20px 6px; }
.dm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 0 16px; }
.dm-actions .btn { padding: 10px 12px; font-size: 13.5px; }
.dm-meta { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 0; padding: 14px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.dm-meta dt { color: var(--muted); }
.dm-meta dd { margin: 0; overflow-wrap: anywhere; }
.dm-sec { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.dm-sec h4 { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.dm-sec h4 .lucide { width: 14px; height: 14px; }
.dm-sec .tag-line { margin: 0; }
.dm-kids { list-style: none; margin: 0; padding: 0; display: grid; }
.dm-kids li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.dm-kids li:first-child { border-top: 0; }
.dm-kid { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.dm-kid:hover .r-title { text-decoration: underline; }
.comment-row .btn { flex: none; }
.dm-foot { flex-wrap: wrap; gap: 8px; padding: 12px 20px; }
.dm-foot .spacer { flex: 1; }
.dm-foot .btn { padding: 7px 11px; }

@media (max-width: 600px) {
  .dm-actions { grid-template-columns: 1fr; }
  .dm-foot { justify-content: stretch; }
  .dm-foot .spacer { display: none; }
  .dm-foot .btn { flex: 1 1 45%; }
  .doc-row .row-actions .icon-btn { width: 28px; }
}
a.btn { display: inline-flex; }
dialog:not(.wide) { width: min(640px, calc(100vw - 24px)); }
.dm-body { grid-template-columns: minmax(0, 1fr); }
.dm-body > *, .dm-sec > *, .comment-row > input { min-width: 0; }
.dm-foot { flex-wrap: nowrap; }
@media (max-width: 600px) { .dm-foot { flex-wrap: wrap; } .dm-body, .dm-head, .dm-foot { padding-left: 16px; padding-right: 16px; } }
.dm-kids { grid-template-columns: minmax(0, 1fr); }
.dm-kids li { min-width: 0; }

/* ===== Documenten per fase ===== */
.doc-list { gap: 26px; }
.fase { display: grid; gap: 8px; }
.fase-head { display: flex; align-items: center; gap: 10px; padding: 0 2px 6px; border-bottom: 1px solid var(--line); }
.fase-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--ink); font-size: 12px; font-weight: 700; flex: none; }
.fase.nu .fase-num { background: var(--side); color: #f1ede4; border-color: var(--side); }
.fase-head h2 { font-family: var(--serif); font-weight: 400; font-size: 21px; letter-spacing: -.01em; text-transform: none; color: var(--ink); margin: 0; }
.fase-meta { color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.fase-add { margin-left: auto; }
.fase-empty { margin: 2px 2px 0; color: var(--muted); font-size: 13px; }
.fase.rest .fase-num { border-style: dashed; }

.stuk-list { display: grid; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stuk { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 10px 12px 10px 14px; border-top: 1px solid var(--line); }
.stuk:first-child { border-top: 0; }
.stuk:hover { background: #f7f4ee; }
.stuk-name { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); text-decoration: none; }
.stuk-name .doc-icon.mini { width: 26px; height: 31px; font-size: 8px; }
.stuk-txt { display: grid; min-width: 0; }
.stuk-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stuk-name:hover .stuk-title { text-decoration: underline; text-underline-offset: 2px; }
.stuk-sub { font-size: 12px; color: var(--muted); }
.stuk-sub .nog { color: var(--sun); font-weight: 600; }
.stuk-files { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fbtn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); background: #fbf9f5; color: var(--ink); white-space: nowrap; }
.fbtn .lucide { width: 13px; height: 13px; opacity: .7; }
.fbtn:hover { border-color: #bdb2a0; background: #fff; }
.fb-vertaling { background: var(--side); border-color: var(--side); color: #f1ede4; }
.fb-vertaling:hover { background: #2a3d31; border-color: #2a3d31; }
.fb-analyse { background: #ece6f1; border-color: #d6cbe0; color: #4d3f66; }
.more { position: relative; }
.more-n { position: absolute; top: -2px; right: -3px; min-width: 15px; height: 15px; border-radius: 8px; background: var(--sun); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; padding: 0 3px; }

/* Toevoegen */
.up-body { gap: 18px; padding-top: 16px; }
.up-step { display: grid; gap: 8px; }
.up-q { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.up-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--side); color: #f1ede4; font-size: 12px; }
.up-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.up-choices.two { grid-template-columns: 1fr 1fr; }
.up-choices button { border: 1px solid var(--line); background: #fbf9f5; border-radius: 8px; padding: 11px 8px; font: 600 13.5px Inter, sans-serif; color: var(--ink); cursor: pointer; }
.up-choices button:hover { border-color: #bdb2a0; }
.up-choices button.on { background: var(--side); border-color: var(--side); color: #f1ede4; }
.up-choices button:disabled { opacity: .45; cursor: not-allowed; }
.up-bij { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drop { display: grid; justify-items: center; gap: 4px; padding: 18px; }
.drop .lucide { width: 22px; height: 22px; color: var(--muted); }

@media (max-width: 760px) {
  .stuk { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .stuk-files { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; padding-left: 38px; }
  .fase-meta { display: none; }
  .up-choices { grid-template-columns: 1fr 1fr; }
  .up-bij { grid-template-columns: 1fr; }
}

/* ===== Rij opent venster; versie kiezen in het venster ===== */
.stuk { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; font: inherit; color: inherit; text-align: left; padding: 12px 14px; cursor: pointer; }
.stuk:first-child { border-top: 0; }
.stuk:hover { background: #f7f4ee; }
.stuk:hover .stuk-title { text-decoration: underline; text-underline-offset: 2px; }
.stuk .doc-icon.mini { width: 26px; height: 31px; font-size: 8px; }
.stuk-has { display: flex; gap: 6px; }
.has { font-size: 11.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; background: #fbf9f5; white-space: nowrap; }
.has-vertaling { color: #1c2a22; border-color: #b9c4b5; background: #e6ebe2; }
.chev { color: var(--muted); display: grid; }
.chev .lucide { width: 18px; height: 18px; }

.dm-title h3 { font-size: 22px; }
.dm-sec.first { border-top: 0; padding-top: 16px; }
.versies { display: grid; gap: 8px; }
.versie { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fbf9f5; padding: 6px 8px 6px 6px; }
.versie:hover { border-color: #bdb2a0; }
.versie-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 6px; text-decoration: none; color: var(--ink); border-radius: 8px; }
.versie-txt { display: grid; min-width: 0; flex: 1; }
.versie-txt strong { font-size: 14.5px; }
.versie-txt .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.versie-open { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); white-space: nowrap; }
.versie-main:hover .versie-open { border-color: #bdb2a0; background: #fff; }
.v-vertaling { border-color: #9fb09b; background: #eef2ea; }
.v-vertaling .versie-open { background: var(--side); color: #f1ede4; border-color: var(--side); }
.versie-acts { display: flex; gap: 0; }
.icon-btn.danger { color: var(--red); }
button.icon-btn { background: transparent; cursor: pointer; }
.add-versie { justify-self: start; margin-top: 2px; }

@media (max-width: 600px) {
  .stuk { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 6px; }
  .stuk-has { grid-column: 2 / -1; grid-row: 2; flex-wrap: wrap; }
  .stuk .cc { display: none; }
  .versie { flex-wrap: wrap; }
  .versie-open { padding: 6px 9px; }
  .versie-acts { margin-left: auto; }
}
.versie-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) {
  .versie .doc-icon { display: none; }
  .versie-main { gap: 8px; padding: 4px; }
  .versie-txt strong { font-size: 14px; }
}
/* Gekozen bestanden als kaartjes */
.file-rows { gap: 8px; }
.file-card { border: 1px solid var(--line); border-radius: 10px; background: #fbf9f5; padding: 8px 10px 10px; display: grid; gap: 6px; }
.file-card.flash { animation: flashin 1.6s ease-out; }
@keyframes flashin { 0% { background: #e6ebe2; border-color: #9fb09b; } 100% { background: #fbf9f5; border-color: var(--line); } }
.file-card-head { display: flex; align-items: center; gap: 10px; }
.file-card-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .file-row { border-top: 0; padding-top: 0; }
.file-card .icon-btn { width: 28px; height: 28px; }
.toast { z-index: 1000; }
dialog .toast { position: fixed; }

/* ===== Cijfers: subtabs en bouwbegroting ===== */
.subtabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.subtabs button { border: 0; background: transparent; font: 600 14px Inter, sans-serif; color: var(--muted); padding: 10px 16px 11px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: baseline; }
.subtabs button span { font-weight: 500; font-size: 11.5px; color: var(--muted); }
.subtabs button:hover { color: var(--ink); }
.subtabs button.on { color: var(--ink); border-bottom-color: var(--side); }
.bg-tiles { display: flex; flex-wrap: wrap; gap: 6px 40px; padding: 4px 0; }
.bg-tiles .tile { background: transparent; border: 0; padding: 0; }
.bg-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 9px 12px; background: #efe5cf; border: 1px solid #dccaa6; border-radius: 8px; font-size: 13px; }
.bg-note .lucide { width: 15px; height: 15px; margin-top: 2px; color: var(--sun); }
.toolbar .src { margin-left: auto; }
.bg-chapters { display: grid; }
.bg-chap { border-top: 1px solid var(--line); }
.bg-chap:first-child { border-top: 0; }
.bg-chaphead { display: grid; grid-template-columns: 20px minmax(0, 1.3fr) minmax(80px, 1fr) 52px 130px; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; padding: 10px 4px; cursor: pointer; }
.bg-chaphead:hover { background: #f7f4ee; }
.bg-chap.open .chev { transform: rotate(90deg); }
.bg-chap .chev { transition: transform .15s; color: var(--muted); }
.bg-cname { display: grid; min-width: 0; }
.bg-cname strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-bar { height: 10px; background: #e4ddd0; border-radius: 5px; overflow: hidden; }
.bg-bar span { display: block; height: 100%; background: var(--side); border-radius: 5px; }
.bg-pct { color: var(--muted); font-size: 12.5px; text-align: right; }
.bg-amt { text-align: right; font-weight: 600; }
.bg-warn { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--sun); color: #fff; font-size: 11px; font-weight: 700; vertical-align: 1px; cursor: help; }
.bg-body { padding: 4px 4px 14px 36px; display: grid; gap: 4px; }
.bg-sub { display: grid; gap: 0; margin-top: 6px; }
.bg-subhead { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; font-weight: 600; font-size: 13px; padding: 6px 8px; background: #ebe5d9; border-radius: 6px; }
.bg-sub.d1 .bg-subhead { background: #f1ece2; }
.bg-sub .bg-sub { margin-left: 14px; }
.bg-posts { display: grid; }
.bg-post { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto 110px; gap: 10px; align-items: baseline; padding: 6px 8px; border-bottom: 1px solid #e8e1d4; font-size: 13px; }
.bg-post:last-child { border-bottom: 0; }
.bg-code { font-size: 11.5px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-name { min-width: 0; }
.bg-calc { color: var(--muted); font-size: 12px; text-align: right; }
.bg-post .bg-amt { font-weight: 600; }
@media (max-width: 760px) {
  .bg-chaphead { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .bg-bar, .bg-pct { display: none; }
  .bg-body { padding-left: 8px; }
  .bg-post { grid-template-columns: minmax(0, 1fr) auto; }
  .bg-post .bg-code { display: none; }
  .bg-post .bg-calc { grid-column: 1; grid-row: 2; text-align: left; }
  .bg-subhead { grid-template-columns: minmax(0, 1fr) auto; }
  .bg-subhead .bg-code { display: none; }
  .subtabs button span { display: none; }
  .toolbar .src { margin-left: 0; }
}
.bg-path { display: block; font-size: 11.5px; color: var(--muted); }
