/* Facturen en offertes: regeleditor, documentweergave en zijkolom. */

.inline-form { display: contents; }
.filters__right { display: flex; gap: var(--space-3); align-items: center; margin-left: auto; }
.filters__right input[type="search"] { width: 260px; }
.show-sm { display: none; }
.doc-list-status { margin-top: 2px; }
.doc-list-status .status { font-size: .82rem; }

/* ---------- Editor: klantkeuze ---------- */
.doc-client { display: flex; gap: var(--space-3); align-items: stretch; }
.doc-client select { flex: 1 1 auto; min-width: 0; }
.doc-client .btn { flex: none; }

/* ---------- Editor: regels ---------- */
.lines { --line-cols: minmax(0, 1fr) 76px 92px 128px 172px 108px 102px; display: flex; flex-direction: column; }
.lines--kor { --line-cols: minmax(0, 1fr) 76px 92px 128px 108px 102px; }
/* Offerte: extra kolom "Eenmalig / Per maand" */
.lines--billing { --line-cols: minmax(0, 1fr) 56px 64px 108px 120px 146px 100px 92px; }
.lines--billing.lines--kor { --line-cols: minmax(0, 1fr) 64px 76px 116px 124px 104px 92px; }
.lines--billing .line__tools .icon-btn { width: 30px; }
.lines--billing .line select { padding-left: 8px; padding-right: 4px; }
.line__per { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.lines__head, .line { display: grid; grid-template-columns: var(--line-cols); gap: var(--space-2); align-items: start; }
.lines__head { padding: 0 0 var(--space-2); border-bottom: 1px solid var(--border); color: var(--muted); font-size: .8rem; font-weight: 600; }
.lines__head > span { display: flex; align-items: center; gap: 6px; }
.lines__head .num { justify-content: flex-end; }
.line { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.line textarea { min-height: 40px; resize: vertical; overflow: hidden; }
.line .input-group__addon { padding: 0 8px; }
.line__label { display: none; }
.line__total { text-align: right; font-variant-numeric: tabular-nums; padding-top: 9px; white-space: nowrap; font-weight: 550; }
.line__tools { display: flex; justify-content: flex-end; gap: 0; }
.line__tools .icon-btn { width: 34px; height: 38px; }
.lines__head + .line [data-line-up], .line:last-child [data-line-down] { visibility: hidden; }
.line.has-error :where(textarea, input) { border-color: var(--danger); }
.line .field__error { margin-top: var(--space-1); }
.icon--flip { transform: rotate(180deg); }
.lines__foot { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-6); flex-wrap: wrap; padding-top: var(--space-4); }
.lines__foot .totals { flex: 0 1 360px; }

/* Twee totalenblokken (offerte met regels per maand) */
.totals__block + .totals__block { margin-top: var(--space-5); }
.totals__title { font-weight: 700; font-size: .85rem; color: var(--muted); padding-bottom: var(--space-1); margin-bottom: var(--space-1); border-bottom: 1px solid var(--border); }

/* ---------- Documentweergave ---------- */
.doc-view { align-items: start; }
.doc-view__main, .doc-view__side { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.doc-view .card + .card { margin-top: 0; }
.doc-sheet__body { padding: var(--space-8) var(--space-8) var(--space-6); border-top: 3px solid var(--primary); border-radius: var(--radius) var(--radius) 0 0; }
.doc-sheet__top { display: flex; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; margin-bottom: var(--space-8); }
.doc-sheet__title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.025em; }
.doc-sheet__number { color: var(--muted); margin-top: var(--space-1); font-family: var(--font-mono); font-size: .88rem; letter-spacing: -.01em; }
.doc-sheet__from, .doc-sheet__to { display: flex; flex-direction: column; font-size: .9rem; line-height: 1.55; }
.doc-sheet__from { text-align: right; color: var(--muted); }
.doc-sheet__from strong, .doc-sheet__to strong { color: var(--text); }
.doc-sheet__label { color: var(--muted); font-size: .78rem; margin-bottom: var(--space-1); }
.doc-sheet__parties { display: flex; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; margin-bottom: var(--space-6); }
.doc-sheet__meta { font-size: .9rem; align-self: start; }
.doc-sheet__meta dd { text-align: right; font-variant-numeric: tabular-nums; }
.doc-sheet__text { margin-bottom: var(--space-5); }
.doc-sheet__lines { margin: 0 calc(var(--space-8) * -1); }
.doc-sheet__lines .table th:first-child, .doc-sheet__lines .table td:first-child { padding-left: var(--space-8); }
.doc-sheet__lines .table th:last-child, .doc-sheet__lines .table td:last-child { padding-right: var(--space-8); }
.doc-sheet__lines .table td { vertical-align: top; }
.doc-sheet__qty .cell-sub { white-space: normal; max-width: 9em; margin-left: auto; line-height: 1.3; }
.doc-sheet__lines .table tbody tr:hover td { background: transparent; }
.doc-sheet__lines .table tbody tr:last-child td { border-bottom: 1px solid var(--border); }
.doc-sheet__desc { white-space: normal; overflow-wrap: anywhere; }
.doc-sheet__totals { margin-top: var(--space-4); }
.doc-sheet__notes { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--border); font-size: .9rem; }

/* ---------- Zijkolom ---------- */
.doc-facts { grid-template-columns: max-content minmax(0, 1fr); }
.doc-facts dt { display: flex; align-items: center; gap: 6px; }
.doc-late { color: var(--danger); }
.doc-todo, .doc-steps { margin: var(--space-3) 0; padding: 0; list-style: none; }
.doc-todo li { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-2) 0; font-size: .92rem; }
.doc-todo li + li { border-top: 1px solid var(--border); }
.doc-todo .icon { color: var(--warning); margin-top: 2px; }
.doc-steps { padding-left: 1.2rem; list-style: disc; font-size: .92rem; }
.doc-steps li + li { margin-top: var(--space-1); }
.doc-payments { list-style: none; margin: 0; padding: 0; }
.doc-payments li { padding: var(--space-3) var(--space-6); }
.doc-payments li + li { border-top: 1px solid var(--border); }
.doc-payments__main { display: flex; justify-content: space-between; gap: var(--space-3); font-size: .93rem; }
.doc-payments__amount { font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap; }
.doc-payments__sub { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); color: var(--muted); font-size: .84rem; min-height: 28px; }
.doc-payments__sub .icon-btn { width: 30px; height: 30px; margin-right: -6px; }
.doc-payments__sub form { margin: 0; }
.doc-view__side .sig-row:last-of-type { border-bottom: 0; }

/* ---------- Uitklappanelen (versturen, betaling) ---------- */
.doc-panel { border-color: var(--border-strong); }
.doc-panel__intro { margin-bottom: var(--space-4); font-size: .92rem; }
.doc-attach { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); font-size: .9rem; padding: var(--space-2) var(--space-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.doc-attach .icon { width: 16px; height: 16px; }

/* ---------- Smaller scherm ---------- */
@media (max-width: 1250px) {
  .lines { --line-cols: minmax(0, 1fr) 70px 84px 120px 150px 100px 102px; }
  .lines--billing { --line-cols: minmax(0, 1fr) 52px 60px 104px 116px 128px 96px 92px; }
  .lines--billing.lines--kor { --line-cols: minmax(0, 1fr) 60px 70px 112px 120px 100px 92px; }
}
@media (max-width: 1100px) {
  .doc-view__side { order: -1; }
  .doc-view { display: flex; flex-direction: column; gap: var(--space-6); }
  .doc-view > * { width: 100%; }
}
@media (max-width: 860px) {
  .show-sm { display: block; }
  .doc-list td:first-child { width: 1%; white-space: nowrap; }
  .doc-list .cell-sub.show-sm { white-space: nowrap; }
  .doc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .doc-stats .stat { padding: var(--space-3) var(--space-4); }
  .doc-stats .stat:last-child { grid-column: 1 / -1; }
  .filters__right { margin-left: 0; width: 100%; }
  .filters__right input[type="search"] { width: auto; flex: 1 1 140px; min-width: 0; }
  .filters__right select { flex: 0 1 auto; min-width: 0; }
  .doc-client { flex-direction: column; }

  .lines__head { display: none; }
  .line { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-4) 0; }
  .line__desc, .line__total { grid-column: 1 / -1; }
  .line__label { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; margin-bottom: 4px; }
  .line__vat select { width: 100%; }
  .line__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 0; }
  .line__total .line__label { margin: 0; }
  .lines--kor .line__price { grid-column: 1 / -1; }
  .lines--billing .line__vat { grid-column: 1 / -1; }
  .lines--billing.lines--kor .line__price { grid-column: auto; }
  .line__billing select { width: 100%; }
  .line__total .line__label { margin-right: auto; }
  .line__total { gap: var(--space-2); }
  .line__per { display: inline; }
  .line__tools { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px dashed var(--border); padding-top: var(--space-2); }
  .lines__foot { flex-direction: column-reverse; align-items: stretch; }
  .lines__foot .totals { flex: none; max-width: none; }

  .doc-sheet__body { padding: var(--space-5) var(--space-4); }
  .doc-sheet__top { margin-bottom: var(--space-5); }
  .doc-sheet__from { text-align: left; }
  .doc-sheet__lines { margin: 0 calc(var(--space-4) * -1); }
  .doc-sheet__lines .table th:first-child, .doc-sheet__lines .table td:first-child { padding-left: var(--space-4); }
  .doc-sheet__lines .table th:last-child, .doc-sheet__lines .table td:last-child { padding-right: var(--space-4); }
  .doc-sheet__meta dd { text-align: left; }
  .doc-payments li { padding: var(--space-3) var(--space-4); }
}

/* Overgenomen factuur: de echte PDF tonen */
.doc-original { overflow: hidden; }
.doc-original__pdf { display: block; width: 100%; height: 860px; border: 0; background: var(--surface-2); }
@media (max-width: 860px) { .doc-original__pdf { height: 560px; } }

/* Kaart "Klantpagina" bij een factuur of offerte */
.portal-card__link { width: 100%; font-family: var(--font-mono); font-size: .8rem; color: var(--muted); background: var(--surface-2); text-overflow: ellipsis; }
.portal-card__actions { margin-top: var(--space-3); }
.portal-card__seen { display: flex; align-items: flex-start; gap: var(--space-2); margin: var(--space-4) 0 0; font-size: .86rem; color: var(--muted); }
.portal-card__seen .icon { width: 16px; height: 16px; margin-top: 2px; }
.portal-card__reset { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.portal-card__reset button { border: 0; background: none; padding: 0; font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.portal-card__reset button:hover { color: var(--text); }

/* Kortingsregels (includes/discounts.php) */
:root { --disc-ink: #8a5a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --disc-ink: #f0bd62; } }
:root[data-theme="dark"] { --disc-ink: #f0bd62; }
.line--discount { background: color-mix(in srgb, var(--oker, #d9a441) 7%, transparent); border-radius: var(--radius-sm); padding-left: var(--space-2); padding-right: var(--space-2); }
.line--discount .line__disc-value { grid-column: span 2; }
.line__disc-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 650; color: var(--disc-ink); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.line__disc-badge .icon { width: 13px; height: 13px; }
.disc-value { display: flex; gap: 4px; }
.disc-value select { flex: 0 0 58px; padding-left: 8px; padding-right: 4px; }
.disc-value input { flex: 1 1 auto; min-width: 0; }
.disc-dur { display: flex; align-items: center; gap: 5px; font-size: .82rem; color: var(--muted); padding-top: 4px; }
.disc-dur input { width: 52px; text-align: center; padding-left: 4px; padding-right: 4px; }
.disc-dur__pre { display: none; }
.disc-dur[hidden], .line__disc-once[hidden] { display: none; }
.line__disc-once { display: block; font-size: .82rem; color: var(--muted); padding-top: 10px; }
.line__disc-auto { display: flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--muted); padding-top: 10px; }
.line__disc-auto[hidden] { display: none; }
.line--discount [data-line-total] { color: var(--disc-ink); }
.disc-warn { font-size: .8rem; line-height: 1.4; color: var(--disc-ink); margin-top: 6px; }
.disc-warn[hidden], .line--discount [data-disc-warn][hidden] { display: none; }
.disc-menu { position: relative; display: inline-block; }
.disc-menu > summary { list-style: none; cursor: pointer; }
.disc-menu > summary::-webkit-details-marker { display: none; }
.disc-menu__list { position: absolute; z-index: 30; left: 0; top: calc(100% + 4px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.12)); padding: 4px; display: grid; }
.disc-menu__item { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; }
.disc-menu__item:hover, .disc-menu__item:focus-visible { background: var(--surface-sunken, rgba(0,0,0,.05)); }
@media (max-width: 860px) {
  .line--discount .line__disc-value { grid-column: auto; }
  .disc-dur__pre { display: inline; }
  .line--discount .line__disc-once:empty { display: none; }
}

/* Samenhang (includes/relations.php): offerte → factuur/abonnement → facturen, en wat je waar wijzigt. */
.rel-chain, .rel-chain ol { list-style: none; margin: 0; padding: 0; }
.rel-chain { padding: var(--space-3) var(--space-3) var(--space-2); }
.rel-step { position: relative; }
.rel-step + .rel-step::before, .rel-branch + .rel-step::before { content: ""; position: absolute; left: 25px; top: -6px; height: 6px; border-left: 2px solid var(--border); }
.rel-chain > .rel-step + .rel-step, .rel-chain > .rel-branch + .rel-step { margin-top: 6px; }
.rel-step__in { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: .88rem; }
a.rel-step__in:hover { background: var(--surface-2); text-decoration: none; }
.rel-step.is-current .rel-step__in { background: var(--primary-soft); }
.rel-step__ico { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.rel-step.is-current .rel-step__ico { background: var(--surface); border-color: var(--primary); color: var(--primary); }
.rel-step__ico .icon { width: 16px; height: 16px; }
.rel-step__body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.rel-step__kind { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.rel-step.is-current .rel-step__kind { color: var(--primary); }
.rel-step__title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-step__sub { font-size: .8rem; color: var(--muted); }
.rel-step__in .status { font-size: .8rem; flex: none; }
.rel-branch { margin: 4px 0 0 25px; padding-left: 14px; border-left: 2px solid var(--border); }
.rel-branch .rel-step__in { padding-top: 6px; padding-bottom: 6px; }
.rel-branch .rel-step + .rel-step::before { display: none; }
.rel-note { padding: 6px 10px; font-size: .82rem; color: var(--muted); }
.rel-tips { border-top: 1px solid var(--border); padding: var(--space-3) var(--space-5) var(--space-4); }
.rel-tips h3 { font-size: .82rem; margin: 0 0 var(--space-2); }
.rel-tips ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rel-tips li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; font-size: .84rem; line-height: 1.45; color: var(--text); }
.rel-tips .icon { width: 16px; height: 16px; color: var(--muted); margin-top: 2px; }

/* ---------- Oude facturen uploaden (invoice_upload.php) ---------- */
.hist-drop .dropzone__empty { padding: var(--space-12) var(--space-5); }
.hist-review { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.hist-review > .card { margin: 0; }
.hist-review__pdf iframe { display: block; width: 100%; height: min(78vh, 900px); border: 0; border-top: 1px solid var(--border); background: var(--surface-2); }
.hist-review__pdf .card__head { gap: var(--space-3); }
.hist-review__pdf .card__head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hist-review__form .form-grid { grid-template-columns: minmax(0, 1fr); }
.hist-review__form .span-2 { grid-column: 1 / -1; }
@media (max-width: 1100px) {
  .hist-review { grid-template-columns: minmax(0, 1fr); }
  .hist-review__pdf iframe { height: 60vh; }
  .hist-review__form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) { .hist-review__form .form-grid { grid-template-columns: minmax(0, 1fr); } }
.hist-new { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); padding: var(--space-4) var(--space-5);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.hist-new[hidden] { display: none; }
.hist-new__icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--primary); border: 1px solid var(--border); }
.hist-new__text { flex: 1 1 260px; min-width: 0; }
.hist-new__text strong { display: block; }
.hist-new__text span { color: var(--muted); font-size: .92rem; }
.hist-new__label { display: inline-block; margin-right: var(--space-2); color: var(--primary); font-weight: 700; }
.hist-new .actions { flex: none; }

/* Open uren van de klant als suggestie boven de regels (factuur bewerken) */
.doc-hours { margin: 0 0 var(--space-4); border-radius: 18px; border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.doc-hours__bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: 12px 14px; }
.doc-hours__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: #1d3fbb; color: #fff; }
.doc-hours__text { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.doc-hours__text span { color: var(--muted); font-size: .9rem; }
.doc-hours__list { padding: 0 14px 12px; }
.doc-hours__row { display: grid; grid-template-columns: 20px 64px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 9px 2px;
  border-top: 1px solid color-mix(in srgb, var(--primary) 14%, transparent); cursor: pointer; font-size: .93rem; }
.doc-hours__date { color: var(--muted); white-space: nowrap; }
.doc-hours__what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-hours__num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-hours__sum { margin: 8px 2px 0; color: var(--muted); font-size: .86rem; }
@media (max-width: 640px) {
  .doc-hours__bar .btn { flex: 1 1 auto; justify-content: center; }
  .doc-hours__row { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .doc-hours__date { grid-column: 2; grid-row: 2; font-size: .82rem; }
  .doc-hours__what { grid-column: 2; grid-row: 1; white-space: normal; }
  .doc-hours__num:last-child { display: none; }
}

/* Vaste regels per klant: knopjes onder de regels, sterretje per regel */
.doc-favs { display: flex; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-3) 0 var(--space-2); }
.doc-favs__label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 0; font-size: .82rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.doc-favs__label .icon { width: 16px; height: 16px; color: #e0a800; }
.doc-favs__list { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.doc-fav { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); overflow: hidden; max-width: 100%; }
.doc-fav__add { border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 600; color: var(--text); padding: 7px 6px 7px 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-fav__add b { color: var(--muted); font-weight: 600; margin-left: 4px; }
.doc-fav__del { border: 0; background: none; color: var(--faint); font-size: 1.05rem; line-height: 1; padding: 0 12px 0 6px; cursor: pointer; }
.doc-fav:hover { border-color: var(--primary); }
.doc-fav__del:hover { color: var(--danger); }
.line__fav.is-on { color: #e0a800; }
.line__fav.is-on svg { fill: currentColor; }
/* Met het sterretje erbij een kolom breder voor de knoppen */
.lines:has(.line__fav) { --line-cols: minmax(0, 1fr) 76px 92px 128px 172px 108px 128px; }
.lines--kor:has(.line__fav) { --line-cols: minmax(0, 1fr) 76px 92px 128px 108px 128px; }
.lines--billing:has(.line__fav) { --line-cols: minmax(0, 1fr) 56px 64px 108px 120px 146px 100px 120px; }
.lines--billing.lines--kor:has(.line__fav) { --line-cols: minmax(0, 1fr) 64px 76px 116px 124px 104px 120px; }
.lines:has(.line__fav) .line__tools .icon-btn { width: 32px; }
.lines--billing:has(.line__fav) .line__tools .icon-btn { width: 30px; }

/* Facturen: klaar om te herinneren */
.remind-card { margin-bottom: var(--space-6); }
.remind-list { list-style: none; margin: 0; padding: 0 var(--space-2); }
.remind-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: 10px var(--space-3); border-top: 1px solid var(--border); cursor: pointer; }
.remind-list li:first-child .remind-row { border-top: 0; }
.remind-row__main { display: flex; flex-direction: column; min-width: 0; }
.remind-row.is-off { cursor: default; opacity: .65; }
.remind-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-3) var(--space-5) var(--space-4); border-top: 1px solid var(--border); }

/* Live voorbeeld naast de editor (vanaf 1100px) */
.doc-prev { position: fixed; top: 92px; right: 12px; bottom: 12px; width: min(560px, 42vw); z-index: 40; display: flex; flex-direction: column; border-radius: 22px; overflow: hidden;
  background: var(--glas-vol, var(--surface)); border: 1px solid var(--glas-rand, var(--border)); box-shadow: var(--shadow-pop); }
.doc-prev[hidden] { display: none; }
.doc-prev__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.doc-prev__head .muted { flex: 1; }
.doc-prev iframe { flex: 1; width: 100%; border: 0; background: #fff; }
@media (min-width: 1100px) { body.has-doc-prev .content { padding-right: calc(min(560px, 42vw) + 36px); } }

/* Voorbeeld van de mail */
.mail-prev > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--primary); font-weight: 600; font-size: .9rem; list-style: none; }
.mail-prev > summary::-webkit-details-marker { display: none; }
.mail-prev > summary .icon { width: 16px; height: 16px; }
.mail-prev__box { margin-top: 10px; padding: 16px 18px; border-radius: 16px; background: #fff; color: #0f172a; border: 1px solid #e2e6ec; font-size: .93rem; line-height: 1.55; }
.mail-prev__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; color: #4a5466; font-size: .84rem; }
.mail-prev__meta strong { color: #0f172a; font-size: .92rem; }
.mail-prev__subj { font-weight: 800; margin: 6px 0 10px; }
.mail-prev__btn { display: inline-block; margin: 4px 0; padding: 8px 16px; border-radius: 999px; background: #1d3fbb; color: #fff; font-weight: 700; }
.mail-prev__att { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e2e6ec; color: #4a5466; font-size: .85rem; }

/* Telefoon: facturen en offertes als rijen in plaats van een brede tabel, zodat er nooit zijwaarts gescrold hoeft te worden.
   Links nummer en status met daaronder de klant en datum, rechts het bedrag. */
@media (max-width: 640px) {
  .table-wrap:has(> .doc-list) { overflow: visible; }
  .doc-list, .doc-list tbody { display: block; width: 100%; }
  .doc-list thead { display: none; }
  .doc-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); row-gap: 2px;
    padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .doc-list tr:last-child { border-bottom: 0; }
  .doc-list td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; }
  .doc-list td.hide-sm { display: none; }
  .doc-list td:first-child { grid-column: 1; grid-row: 1; width: auto; white-space: normal; display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); }
  .doc-list td:first-child .doc-list-status { margin-top: 0; }
  .doc-list td:nth-child(2) { grid-column: 1; grid-row: 2; overflow-wrap: anywhere; color: var(--muted); font-size: .92rem; }
  .doc-list td:nth-child(2) .cell-sub.show-sm { display: block; font-size: .82rem; }
  .doc-list td.num { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; white-space: nowrap; font-weight: 600; }
}
