/* ============================================================
   Raster (ronde 4, M2): tabellen als spreadsheet
   Bouwt voort op de kaart en de kopstijl van .tbl (patronen.css).
   Vaste kopregel en eerste kolom binnen een eigen scrollvlak.
   Alleen bestaande tokens; actief-accent op donker #8BB1C8 zoals richting A.
   ============================================================ */
.rst { --rst-hoogte: 520px; --rst-accent: var(--brand); --rst-rij: 34px; display: flex; flex-direction: column; }
[data-theme="dark"] .rst { --rst-accent: #8BB1C8; }

.rst__scroll { position: relative; overflow: auto; max-height: var(--rst-hoogte); outline: none; overscroll-behavior: contain; }
.rst__scroll:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--rst-accent) 40%, transparent); }

.rst__t { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; table-layout: fixed; font-size: 13px; }

/* kopregel: stijl van .tbl__kop, maar vast binnen het eigen scrollvlak */
.rst .rst__t thead th { position: sticky; top: 0; z-index: 3; padding: 9px 10px; border-bottom: 1px solid var(--line-strong); border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
.rst .rst__t thead th:first-child { padding-left: 12px; }
.rst .rst__t thead th:last-child { padding-right: 10px; border-right: 0; }
.rst .rst__t thead th.rst__vast { left: 0; z-index: 4; }
.rst .rst__t thead th.is-alleenlezen { color: var(--text-3); background: color-mix(in srgb, var(--bg-2) 70%, var(--surface)); }
.rst .rst__t thead th.rst__cel--bedrag,
.rst .rst__t thead th.rst__cel--getal { text-align: right; }

/* cellen */
.rst__cel { position: relative; height: var(--rst-rij); padding: 0 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--surface); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; cursor: cell; user-select: none; -webkit-user-select: none; }
.rst__cel:last-child { border-right: 0; }
.rst__cel:first-child { padding-left: 12px; }
.rst__w { display: block; overflow: hidden; text-overflow: ellipsis; }
.rst__cel--bedrag, .rst__cel--getal { text-align: right; font-variant-numeric: tabular-nums; }
.rst__cel--datum { font-variant-numeric: tabular-nums; }

/* eerste kolom vast bij opzij scrollen */
.rst__vast { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--line-strong); }

/* niet bewerkbaar: zichtbaar anders (gedempte achtergrond en tekst) */
.rst__cel.is-alleenlezen { background: color-mix(in srgb, var(--bg-2) 45%, var(--surface)); color: var(--text-2); cursor: default; }
[data-theme="dark"] .rst__cel.is-alleenlezen { background: var(--bg-2); color: var(--text-3); }
[data-theme="dark"] .rst .rst__t thead th.is-alleenlezen { background: var(--bg-2); }

/* rij onder de muis */
.rst__t tbody tr:hover > .rst__cel:not(.is-bereik) { background: color-mix(in srgb, var(--bg-2) 30%, var(--surface)); }
.rst__t tbody tr:hover > .rst__cel.is-alleenlezen:not(.is-bereik) { background: color-mix(in srgb, var(--bg-2) 60%, var(--surface)); }

/* bereik en actieve cel */
.rst__cel.is-bereik { background: color-mix(in srgb, var(--rst-accent) 12%, var(--surface)); }
.rst__cel.is-bereik.is-alleenlezen { background: color-mix(in srgb, var(--rst-accent) 10%, color-mix(in srgb, var(--bg-2) 45%, var(--surface))); }
[data-theme="dark"] .rst__cel.is-bereik { background: color-mix(in srgb, var(--rst-accent) 17%, var(--surface)); }
.rst__cel.is-actief::after { content: ''; position: absolute; inset: 0; border: 2px solid var(--rst-accent); pointer-events: none; }
.rst__scroll:not(:focus-within) .rst__cel.is-actief::after { border-color: color-mix(in srgb, var(--rst-accent) 35%, transparent); }
.rst__cel.is-voorlopig { color: var(--text-2); }
.rst__cel.is-bewerk { padding: 0; overflow: visible; z-index: 2; }
.rst__cel.is-bewerk::after { display: none; }

/* invoerveld in de cel */
.rst__inv { position: absolute; inset: 0; box-sizing: border-box; width: 100%; height: 100%; margin: 0; padding: 0 8px; border: 2px solid var(--rst-accent); border-radius: 0; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; outline: none; box-shadow: var(--shadow); }
.rst__inv--num { text-align: right; font-variant-numeric: tabular-nums; }
.rst__inv.is-fout { border-color: var(--neg); }
.rst__inv::placeholder { color: var(--text-3); }
[data-theme="dark"] .rst__inv { color-scheme: dark; }

.rst__leeg { padding: 26px 16px; text-align: center; font-size: 13px; color: var(--text-2); background: var(--surface); }

/* voetregel: melding links, selectie en som rechts */
.rst__voet { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 36px; padding: 7px 14px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 40%, var(--surface)); font-size: 12px; color: var(--text-2); }
.rst__melding { min-width: 0; line-height: 1.45; }
.rst__melding.is-fout { color: var(--neg); }
.rst__melding kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); font: inherit; font-size: 11px; line-height: 17px; color: var(--text); }
.rst__som { display: inline-flex; align-items: center; gap: 14px; flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rst__som b { margin-left: 6px; font-weight: 600; color: var(--text); }
@media (max-width: 720px) { .rst__voet { flex-wrap: wrap; } }
