:root {
  --bg: #ffffff;
  --sunk: #f6f7f9;
  --ink: #15181e;
  --ink-2: #4a5160;
  --muted: #8a919e;
  --line: #eceef2;
  --accent: #fdc24e;
  --accent-ink: #2a2110;
  --c-factuur: #fdc24e;
  --c-regeling: #8b9cf7;
  --c-overig: #a3a9b4;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; max-width: 1240px; margin: 0 auto; padding: 22px 32px; }
.logo { height: 46px; mix-blend-mode: multiply; }
.seg { display: flex; gap: 2px; background: var(--sunk); border-radius: 12px; padding: 4px; }
.seg button { padding: 7px 16px; border-radius: 9px; font-weight: 500; color: var(--ink-2); transition: background .2s, color .2s; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

main { max-width: 1240px; margin: 0 auto; padding: 12px 32px 64px; }

/* Case cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.card {
  --c: var(--c-overig);
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px 18px; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c); }
.card.new { animation: rise .6s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.row { --c: var(--c-overig); }
.cat-factuur_opvragen { --c: var(--c-factuur); }
.cat-betalingsregeling { --c: var(--c-regeling); }
.cat-anders { --c: var(--c-overig); }

.c-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cat { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cat i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.c-who { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.c-subj { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; min-height: 33px; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.st svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st.hot { background: color-mix(in srgb, var(--accent) 25%, #fff); color: var(--accent-ink); }
.why {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap;
  padding: 7px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); transition: transform .15s, box-shadow .2s;
}
.why:hover { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent); }
.why svg { width: 14px; height: 14px; fill: currentColor; }

.prog { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.prog span { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative; }
.prog span.done { background: var(--accent); }
.prog span.now::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: slide 1.1s infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Closed */
.section { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 44px 0 6px; }
.closed { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: 10px minmax(160px, 1.1fr) minmax(0, 2fr) 120px 48px 30px; gap: 16px; align-items: center;
  padding: 9px 6px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .55; }
.row b { color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .why-sm { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.row .why-sm:hover { background: var(--sunk); color: var(--ink); }
.row .why-sm svg { width: 14px; height: 14px; fill: currentColor; }

/* SharePoint library */
.sp-site { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.sp-title { display: flex; align-items: center; gap: 12px; padding: 16px 22px; font-size: 18px; font-weight: 600; border-bottom: 1px solid var(--line); }
.sp-mark { width: 30px; height: 30px; border-radius: 8px; background: #038387; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.crumbs { display: flex; gap: 8px; padding: 14px 22px 8px; color: var(--muted); font-weight: 500; }
.crumbs span + span::before { content: "›"; margin-right: 8px; }
.crumbs span:last-child { color: var(--ink); }
.lib-row {
  display: grid; grid-template-columns: 34px minmax(0, 1.3fr) minmax(0, 1.5fr) 150px 120px; gap: 14px; align-items: center;
  width: 100%; text-align: left; padding: 12px 22px; border-top: 1px solid var(--line); transition: background .15s;
}
.lib-row.head { font-size: 12px; color: var(--muted); font-weight: 600; cursor: default; }
button.lib-row:hover { background: var(--sunk); }
.pdf-ico { width: 26px; height: 32px; border-radius: 4px; background: #fde7e6; color: #d92d20; font-size: 9px; font-weight: 700; display: grid; place-items: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.betaald::before { background: #12b76a; }
.badge.herinnering::before { background: #f79009; }
.badge.openstaand::before { background: var(--c-regeling); }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(21, 24, 30, .42); backdrop-filter: blur(6px); display: grid; place-items: center; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; background: #fff; border-radius: 24px; box-shadow: 0 30px 80px rgba(16, 24, 40, .3); animation: pop .35s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(10px); } }
.x { position: absolute; top: 16px; right: 16px; z-index: 5; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.x:hover { background: var(--sunk); color: var(--ink); }
.x svg, .ctl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.doc { width: min(860px, 94vw); padding: 30px; }
.doc-grid { display: grid; grid-template-columns: 300px 1fr; gap: 30px; align-items: start; }
.doc-grid img { width: 100%; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.doc h3 { margin: 4px 0 18px; font-size: 18px; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 500; }
.open-pdf { display: inline-flex; margin-top: 24px; padding: 9px 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; }

/* Journey */
.journey { width: min(1180px, 96vw); height: min(740px, 92vh); display: flex; flex-direction: column; padding: 26px 30px 20px; overflow: hidden; }
.rail { list-style: none; margin: 0 56px 0 0; padding: 0; display: flex; align-items: center; }
.rail li { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: color .3s; white-space: nowrap; }
.rail li:not(:last-child)::after { content: ""; width: 48px; height: 2px; margin: 0 12px; background: var(--line); transition: background .4s; }
.rail li.done:not(:last-child)::after { background: var(--accent); }
.rail .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--sunk); color: var(--muted); transition: background .3s, color .3s, transform .3s, box-shadow .3s; }
.rail li.done { color: var(--ink-2); }
.rail li.done .n { background: color-mix(in srgb, var(--accent) 35%, #fff); color: var(--accent-ink); }
.rail li.now { color: var(--ink); }
.rail li.now .n { background: var(--accent); color: var(--accent-ink); transform: scale(1.12); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); }

.stage { position: relative; flex: 1; margin-top: 14px; }
.fx, .lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx { z-index: 3; }
.lines { z-index: 2; overflow: visible; }
.lines path { fill: none; stroke-linecap: round; transition: stroke-dashoffset .7s cubic-bezier(.6, 0, .2, 1), opacity .5s; }

.scene { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 80px; transition: opacity .45s, transform .55s cubic-bezier(.2, .8, .2, 1), filter .45s; }
.scene.from-right { opacity: 0; transform: translateX(60px); filter: blur(6px); }
.scene.from-left { opacity: 0; transform: translateX(-60px); filter: blur(6px); }
.scene.to-left { opacity: 0; transform: translateX(-60px) scale(.97); filter: blur(6px); }
.scene.to-right { opacity: 0; transform: translateX(60px) scale(.97); filter: blur(6px); }

.controls { display: flex; justify-content: center; gap: 10px; padding-top: 8px; }
.ctl { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); color: var(--ink-2); transition: background .15s, opacity .2s; }
.ctl:hover { background: #eceef2; }
.ctl.primary { background: var(--accent); color: var(--accent-ink); }
.ctl.primary:hover { background: #f7b733; }
.ctl:disabled { opacity: .35; cursor: default; }

.pane { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 22px 24px; position: relative; }
.pop { opacity: 0; transform: translateY(12px) scale(.96); transition: opacity .5s, transform .6s cubic-bezier(.2, .9, .3, 1.25); }
.pop.in { opacity: 1; transform: none; }

/* 1. Mail */
.mail { width: min(600px, 90%); }
.m-from { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; background: color-mix(in srgb, var(--accent) 30%, #fff); color: var(--accent-ink); flex: none; }
.avatar.lg { width: 76px; height: 76px; font-size: 25px; }
.m-from b { display: block; }
.m-from span { color: var(--muted); font-size: 13px; }
.m-from time { margin-left: auto; }
.m-subj { font-size: 19px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 12px; }
.m-body { white-space: pre-wrap; color: var(--ink-2); line-height: 1.65; }
.w { opacity: 0; filter: blur(4px); transition: opacity .35s, filter .35s; }
.w.in { opacity: 1; filter: none; }

/* 2. Classification */
.mail.compact { width: min(500px, 50%); font-size: 13.5px; }
.mail.compact .m-subj { font-size: 16px; }
mark {
  --soft: color-mix(in srgb, var(--c) 32%, transparent);
  color: inherit; border-radius: 4px; padding: 1px 2px; margin: 0 -2px;
  background: linear-gradient(var(--soft), var(--soft)) no-repeat 0 0 / 0% 100%;
  transition: background-size .5s cubic-bezier(.6, 0, .2, 1), box-shadow .3s;
}
mark.on { background-size: 100% 100%; box-shadow: inset 0 -2px 0 var(--c); }
.bins { display: flex; flex-direction: column; gap: 16px; width: 290px; }
.bin {
  --c: var(--c-overig);
  display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 16px; border: 1.5px solid var(--line);
  background: #fff; transition: border-color .4s, background .4s, opacity .5s, transform .5s cubic-bezier(.2, .9, .3, 1.3), box-shadow .4s;
}
.b-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 20%, #fff); color: color-mix(in srgb, var(--c) 65%, #000); }
.b-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.b-name { font-weight: 600; flex: 1; }
.b-pct { font-family: var(--mono); font-size: 14px; opacity: 0; transition: opacity .3s; }
.bin.pick { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); transform: scale(1.05); box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 35%, transparent); }
.bin.pick .b-pct { opacity: 1; }
.bin.dim { opacity: .35; transform: scale(.96); }

/* 3. Customer */
.sender { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 30px 34px; }
.sender b { font-size: 17px; }
.doc-ico svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.addr { font-family: var(--mono); font-size: 13px; color: var(--ink-2); background: var(--sunk); padding: 5px 10px; border-radius: 8px; }
.profile { width: 390px; }
.p-head { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 12px; color: var(--ink-2); }
.p-head svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.f { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); opacity: 0; transform: translateX(-10px); transition: opacity .4s, transform .5s cubic-bezier(.2, .9, .3, 1.2); }
.f.in { opacity: 1; transform: none; }
.f span { color: var(--muted); font-size: 13px; }
.f b { font-weight: 600; }
.mono { font-family: var(--mono); font-weight: 500 !important; }

/* 4. SharePoint */
.keychip { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; }
.keychip span { font-size: 12px; color: var(--muted); font-weight: 600; }
.keychip b { font-family: var(--mono); font-size: 22px; font-weight: 500; }
.keychip small { color: var(--ink-2); }
.sp { width: 460px; padding: 0; overflow: hidden; }
.sp .sp-title { font-size: 15px; padding: 14px 18px; }
.sp .sp-mark { width: 26px; height: 26px; font-size: 13px; }
.sp .crumbs { padding: 10px 18px 6px; font-size: 12.5px; }
.sp-row { display: grid; grid-template-columns: 24px 1fr 100px; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); transition: background .25s, opacity .4s, box-shadow .3s, transform .4s; opacity: 0; transform: translateY(6px); }
.sp-row.in { opacity: 1; transform: none; }
.sp-row .pdf-ico { width: 22px; height: 27px; font-size: 8px; }
.sp-row b { font-weight: 500; font-size: 13px; display: block; }
.sp-row small { color: var(--muted); font-size: 12px; }
.sp-row .num { font-size: 13px; }
.sp-row.scan { background: color-mix(in srgb, var(--accent) 14%, #fff); }
.sp-row.miss { opacity: .32; }
.sp-row.hit { background: color-mix(in srgb, var(--accent) 24%, #fff); box-shadow: inset 4px 0 0 var(--accent); }
.thumb { width: 190px; border-radius: 10px; border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(16, 24, 40, .16); background: #fff; }

/* 5. Reply */
.draft { width: 560px; }
.d-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 28%, #fff); color: var(--accent-ink); }
.d-subj { font-weight: 600; font-size: 16px; margin-bottom: 10px; }
.d-body { display: grid; white-space: pre-wrap; color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.d-body > span { grid-area: 1 / 1; }
.d-body .ghost { visibility: hidden; }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); vertical-align: text-bottom; animation: blinkc .8s steps(2) infinite; }
@keyframes blinkc { 50% { opacity: 0; } }
.d-att { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; width: fit-content; }
.d-att b { font-size: 13px; font-weight: 500; display: block; }
.d-att small { color: var(--muted); font-size: 12px; }
.done-badge { position: absolute; bottom: 6px; left: 50%; display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; transform: translate(-50%, 12px) scale(.95); opacity: 0; transition: opacity .45s, transform .55s cubic-bezier(.2, .9, .3, 1.3); }
.done-badge.in { opacity: 1; transform: translate(-50%, 0); }
.done-badge i { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.done-badge svg { width: 12px; height: 12px; fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* Hand-off */
.handoff { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 56px; text-align: center; }
.handoff .avatar { background: var(--sunk); color: var(--ink-2); }
.handoff .avatar svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.handoff b { font-size: 18px; }

@media (max-width: 860px) {
  .top, main { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: 1fr; }
  .c-foot { flex-wrap: wrap; }
  .row { grid-template-columns: 10px 1fr 48px 30px; }
  .row .s, .row .st { display: none; }
  .doc-grid { grid-template-columns: 1fr; }
  .lib-row { grid-template-columns: 34px 1fr 100px; }
  .lib-row > :nth-child(3), .lib-row > :nth-child(4) { display: none; }
  .journey { padding: 18px 14px; }
  .rail li:not(.now) .t { display: none; }
  .rail li:not(:last-child)::after { width: 16px; margin: 0 6px; }
  .scene { flex-direction: column; gap: 20px; }
  .mail.compact, .bins, .profile, .sp, .draft { width: 100%; }
  .thumb { display: none; }
}
