/* Conservatief theme, per DESIGN_SYSTEM.md (design tokens + component inventory). Applied in
   place to SLM's existing slm- prefixed classes and layout — no markup changes, tokens/values
   only. Deliberate deviations from the doc carry a comment saying why. */

:root {
    /* Palette — DESIGN_SYSTEM.md "Design tokens" table, Conservatief column (SynVest brand). */
    --slm-navy: #002b5c;          /* SynVest blauw donker — sidebar background */
    --slm-navy-700: #001c3d;      /* panels on dark surfaces */
    --slm-action: #002b5c;        /* SynVest blauw donker — primary action / links */
    --slm-action-700: #00a1e0;    /* SynVest blauw licht — hover / pressed */
    --slm-action-tint: #eaf7ff;   /* pale blauw-licht tint for accent fills/hovers */
    --slm-accent-green: #82e000;  /* SynVest groen licht — sparing highlight only, never a surface color */
    --slm-positive: #3d6b4f;      /* positive / settled / checks */
    --slm-warning: #8a5a00;
    --slm-danger: #b42318;        /* negative / arrears */
    --slm-warning-tint: #fbf1dc;
    --slm-warning-line: #ecd9a8;
    --slm-danger-tint: #fbeaea;
    --slm-bg: #f4f6f9;            /* page background */
    --slm-surface: #ffffff;       /* card surface */
    --slm-ink: #14202e;           /* primary text */
    --slm-muted: #5b6573;         /* secondary text */
    --slm-muted-3: #868e99;       /* tertiary text */
    --slm-divider: #dcdfe3;       /* borders */
    --slm-table-head: #f6f7f8;
    --slm-row-divider: #eceef0;
    --slm-radius: 6px;

    /* $success is a status semantic here (settled instalments, presence checks), so it stays green
       and is NOT collapsed into the action blue. */
    --slm-up: var(--slm-positive);   /* outstanding growing → portfolio growing → good */
    --slm-down: var(--slm-danger);

    /* Sidebar-local tokens. */
    --sb-hover: rgba(255, 255, 255, .08);
    --sb-active: rgba(255, 255, 255, .15);
    --sb-text-dim: rgba(255, 255, 255, .72);
}

* { box-sizing: border-box; }

/* button/input/select/textarea don't inherit the page font by default in browsers — pull them back
   onto the Helvetica Neue stack set on html/body below. */
button, input, select, textarea { font-family: inherit; }

/* Knob 1 — type scale. The whole ramp below is in rem, so this one value scales body text,
   headings and controls together. Never scale a single element instead. */
html { font-size: 14px; }

html, body {
    margin: 0;
    /* 'Helvetica Neue' is Mac/iOS-only; Arial is its metric-compatible stand-in everywhere else
       (huisstijlhandboek body face). Deliberately no -apple-system/Segoe UI fallback — those are
       OS-default UI fonts, not Helvetica look-alikes, and would silently mask the brand font on
       Windows. */
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--slm-bg);
    color: var(--slm-ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Type ramp, in rem. */
h1, .h1, .slm-page-title { font-size: 1.5rem; }
h2, .h2 { font-size: 1.25rem; }
h3, .h3 { font-size: 1.1875rem; }
h4, .h4 { font-size: .9375rem; }
h5, .h5, h6, .h6 { font-size: .8125rem; }
/* Merriweather is the huisstijlhandboek's heading face; Helvetica Neue stays on subheadings/body. */
h1, h2, h3, h4, h5, h6, .slm-page-title {
    font-family: Merriweather, Georgia, serif;
    font-weight: 600;
    line-height: 1.5;
}

.slm-loading { padding: 2rem; color: var(--slm-muted); }

.slm-cell-load { color: var(--slm-muted); }

/* ── Layout & navigation ─────────────────────────────────────────────── */

/* App shell is exactly one viewport tall; the content pane scrolls on its own (see .slm-content),
   so the page scrollbar sits beside the content — below the top bar — not up the full window. */
.slm-layout { display: flex; height: 100vh; overflow: hidden; }

/* Knob 3 note: the sidebar sizes itself in px so the type knob never distorts navigation. Kept as
   a flex column rather than fixed + margin-left because the shell is already a flex row; the
   visual result is identical. */
.slm-sidebar {
    /* Wide enough for the peildatum's datetime input, which clips below ~250px. */
    width: 240px;
    flex: 0 0 240px;
    background: var(--slm-navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 0 12px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    /* Sticky already makes this a stacking context; the explicit z-index keeps a dialog opened
       from the sidebar (the model changelog) painting above the main column. */
    z-index: 30;
}

.slm-brand {
    flex: 0 0 auto;
    min-height: 84px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 6px;
    border-bottom: 1px solid var(--sb-hover);
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
/* Triple A house logo. Drawn for dark backgrounds; a client theme can claim the slot by
   overriding --brand-logo-image. Logo box 180×64, background-size: contain. */
.slm-brand__logo {
    flex: 0 0 auto;
    width: 180px; height: 64px;
    background-image: var(--brand-logo-image, url("../assets/int/logo.svg"));
    background-repeat: no-repeat;
    background-position: left center;
    background-size: contain;
}
/* Stands in for the SynVest wordmark next to the logo mark, so it takes the logo's Merriweather
   face (huisstijlhandboek), not the body font. */
.slm-brand__sub { display: block; font-family: Merriweather, Georgia, serif; font-weight: 700; font-size: 12px; color: var(--sb-text-dim); margin-top: 2px; }

.slm-nav { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.slm-nav__link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 12px;
    font-size: .92rem;
    border-radius: var(--slm-radius);
    color: var(--sb-text-dim);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.slm-nav__link:hover { background: var(--sb-hover); color: #fff; }
.slm-nav__link.active { background: var(--sb-active); color: #fff; }
.slm-nav__link--disabled, .slm-nav__link--disabled:hover { background: none; color: var(--sb-text-dim); opacity: .45; cursor: default; }
.slm-nav__section {
    margin: 18px 0 4px; padding: 0 12px;
    font-size: 12px; font-weight: 600; color: var(--sb-text-dim);
}
.slm-nav__empty { padding: 6px 12px; font-size: 13px; color: var(--sb-text-dim); font-style: italic; }

/* Sidebar bottom block: the model version sits above the build versions. */
.slm-sidebar__footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--sb-hover);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.slm-modelversion {
    display: flex;
    align-items: baseline;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 12px;
    text-align: left;
    color: var(--sb-text-dim);
    cursor: pointer;
}
.slm-modelversion:hover { color: #fff; }
.slm-modelversion__hint { opacity: .6; text-decoration: underline; }

.slm-version {
    font-size: 12px;
    color: var(--sb-text-dim);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
}
.slm-version__sep { opacity: .5; }
.slm-version--drift { color: #f2b84b; font-weight: 600; }

.slm-main { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.slm-topbar {
    flex: 0 0 auto; z-index: 20;
    display: flex; justify-content: flex-end; align-items: center; gap: 12px;
    padding: 12px 32px; background: var(--slm-surface); border-bottom: 1px solid var(--slm-divider);
}
.slm-topbar__right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.slm-topbar__sep { width: 1px; height: 22px; background: var(--slm-divider); }
.slm-testidentity { display: inline-flex; align-items: center; gap: 8px; }
.slm-testidentity__active { color: #92400e; font-size: .82rem; }

.slm-topfilter { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--slm-muted); }

/* Reading history is a mode, so it lives in the top bar for as long as it lasts. Its own
   segmented-control chrome carries the state, so it turns amber as a whole once historical. */
.slm-peildatum {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px; background: var(--slm-bg); border: 1px solid var(--slm-divider); border-radius: var(--slm-radius);
}
.slm-peildatum--historical { background: var(--slm-warning-tint); border-color: var(--slm-warning-line); }
.slm-peildatum__preset {
    background: none; border: none; border-radius: 3px;
    padding: 4px 12px; font: inherit; font-size: .78rem; color: var(--slm-muted); cursor: pointer;
}
.slm-peildatum__preset:hover { color: var(--slm-ink); }
.slm-peildatum__preset.is-active { background: var(--slm-action); color: #fff; }
.slm-peildatum--historical .slm-peildatum__preset { color: var(--slm-warning); }
.slm-peildatum--historical .slm-peildatum__preset.is-active { background: var(--slm-warning); color: #fff; }
.slm-peildatum__input {
    margin-right: 2px; padding: 4px 8px; font-size: .78rem;
    border: 1px solid var(--slm-divider); border-radius: var(--slm-radius); background: var(--slm-surface);
}

.slm-content {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 24px 32px 48px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 28, 61, 0.25) transparent;
}
/* WebKit/Chromium: thin overlay-style thumb that only stands out on hover. */
.slm-content::-webkit-scrollbar { width: 10px; height: 10px; }
.slm-content::-webkit-scrollbar-track { background: transparent; }
.slm-content::-webkit-scrollbar-thumb {
    background: rgba(0, 28, 61, 0.22);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.slm-content::-webkit-scrollbar-thumb:hover { background: rgba(0, 28, 61, 0.4); background-clip: padding-box; }

/* ── Page vocabulary ─────────────────────────────────────────────────── */

.slm-page-title { margin: 0 0 4px; }
/* A title with no lead under it keeps the lead's gap to the content. */
.slm-page-title--solo { margin-bottom: 24px; }
/* The record a detail page is about (a loan number): one step up the ramp, so it leads the page's other headings. */
.slm-page-title--record { font-size: 1.875rem; line-height: 1.3; }
.slm-page-lead { color: var(--slm-muted); margin-top: 0; margin-bottom: 24px; }
/* Page title with its write actions alongside. */
.slm-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

.slm-stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.stat-card {
    background: var(--slm-surface); border: 1px solid var(--slm-divider); border-radius: var(--slm-radius);
    padding: 16px 20px; min-width: 200px;
}
/* Highlights the primary metric among a KPI row — DESIGN_SYSTEM.md .kpi-accent. */
.stat-card--accent { background: var(--slm-action-tint); }
.stat-card__label { color: var(--slm-muted); font-size: .8125rem; }
.stat-card__value { font-size: 1.5rem; font-weight: 600; margin-top: 4px; }
.stat-card__note { color: var(--slm-muted); font-size: .75rem; margin-top: 4px; }

.slm-card {
    background: var(--slm-surface); border: 1px solid var(--slm-divider); border-radius: var(--slm-radius);
    padding: 20px 24px; margin-bottom: 24px;
}
.slm-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.slm-card__head h2 { margin: 0; }
.slm-card__head-actions { display: flex; align-items: center; gap: 12px; }
/* Stacks a group of buttons vertically inside a head-actions row. */
.slm-btn-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
/* Many actions side by side, wrapping onto the next line instead of one tall column. */
.slm-btn-wrap { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 560px; margin-bottom: 16px; }
.slm-card__search { width: 220px; }
.slm-asof { color: var(--slm-muted); font-size: .82rem; display: inline-flex; align-items: baseline; gap: 8px; }
.slm-linkbtn {
    background: none; border: none; padding: 0; font: inherit; font-size: .85rem;
    color: var(--slm-action); cursor: pointer; text-decoration: none;
}
.slm-linkbtn:hover { color: var(--slm-action-700); }
.slm-linkbtn:disabled { color: var(--slm-muted); cursor: default; text-decoration: none; }

.slm-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin: 0 0 8px; }

.slm-field { display: flex; flex-direction: column; gap: 6px; }
.slm-field__label { font-size: .8125rem; font-weight: 500; color: var(--slm-muted); }
.slm-field__input {
    width: 100%;
    padding: 7px 10px;
    font: inherit; font-size: .9rem;
    color: var(--slm-ink); background: var(--slm-surface);
    border: 1px solid var(--slm-divider); border-radius: var(--slm-radius);
}
.slm-field__input:focus { outline: none; border-color: var(--slm-action); }
.slm-field__input:disabled { background: var(--slm-row-divider); color: var(--slm-muted); }
/* Blazor puts .invalid on a field that failed validation. */
.slm-field__input.invalid { border-color: var(--slm-danger); }
.slm-field__hint { font-size: .75rem; color: var(--slm-muted); }

/* An input with a fixed suffix (e.g. "%") shown inside the field, right-aligned. */
.slm-field__input-group { position: relative; }
.slm-field__input-group .slm-field__input { padding-right: 28px; }
.slm-field__input-suffix {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slm-muted);
    font-size: .9rem;
    pointer-events: none;
}

/* Two columns of fields in a dialog; a field can claim the full width. */
.slm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.slm-form-grid__wide { grid-column: 1 / -1; }

/* A grouped sub-section of fields within a dialog (e.g. the initial valuation on collateral create). */
fieldset.slm-form-grid { border: 1px solid var(--slm-divider); border-radius: var(--slm-radius); padding: 16px; margin-top: 16px; }
fieldset.slm-form-grid legend { padding: 0 6px; font-size: .8125rem; font-weight: 600; color: var(--slm-muted); }

/* Validation output rendered by ValidationSummary / ValidationMessage. */
.validation-errors { margin: 0; padding-left: 1.1rem; }
.validation-message { color: var(--slm-danger); font-size: .8125rem; }

/* ── Tables ──────────────────────────────────────────────────────────── */

/* Wraps a grid too wide for its card, so it scrolls sideways instead of spilling past the card edge.
   Flipping wrapper and grid vertically puts the scrollbar above the grid, reachable without
   scrolling to the last row; the double flip leaves the grid itself upright. */
.slm-grid-scroll { overflow-x: auto; transform: rotateX(180deg); }
.slm-grid-scroll > * { transform: rotateX(180deg); }
.slm-grid { width: 100%; border-collapse: collapse; font-size: 1rem; margin-bottom: 0; }
.slm-grid th, .slm-grid td { padding: 10px 14px; border-bottom: 1px solid var(--slm-row-divider); vertical-align: middle; }
.slm-grid thead th {
    background: var(--slm-table-head);
    color: var(--slm-muted); font-weight: 600; font-size: .8125rem;
    white-space: nowrap; text-align: left;
}
/* QuickGrid renders its sortable headers as buttons; keep them looking like header text. */
.slm-grid thead th button { color: inherit; font: inherit; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
/* Keep numeric column headers right-aligned like their cells. */
.slm-grid thead th.slm-num, .slm-grid thead th.slm-num button { text-align: right; }
.slm-grid tbody td { font-variant-numeric: tabular-nums; }
.slm-grid tbody tr { transition: background .1s ease; }
.slm-grid tbody tr:hover { background: var(--slm-row-divider); }
.slm-grid tbody tr:last-child td { border-bottom: none; }
.slm-grid tfoot td { border-top: 1px solid var(--slm-muted-3); border-bottom: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.slm-grid a { color: var(--slm-action); text-decoration: none; font-weight: 500; }
.slm-grid a:hover { text-decoration: underline; }
/* width:1% + nowrap shrinks numeric columns to their content; the first column absorbs the rest. */
.slm-grid .slm-num { text-align: right; white-space: nowrap; width: 1%; }
/* Keeps a date on one line in a wide grid that would otherwise squeeze it onto two. */
.slm-grid .slm-date { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* Right-aligned column of row actions (amend, release), sized to its buttons. */
.slm-grid .slm-rowactions { text-align: right; white-space: nowrap; width: 1%; }
.slm-grid .slm-rowactions > * + * { margin-left: 8px; }

/* Make a whole row a link via a stretched anchor overlay: the reference link's ::after covers the
   (relatively-positioned) row, so a click anywhere navigates. */
.slm-grid--rows tbody tr { position: relative; }
.slm-grid--rows tbody tr:hover { cursor: pointer; }
.slm-rowlink::after { content: ""; position: absolute; inset: 0; }
/* A button in such a row sits above the overlay, so it is clicked rather than the row. */
.slm-grid--rows tbody .slm-btn { position: relative; z-index: 1; }

/* Denser variant for long, low-detail lists (e.g. Payments) — smaller type, tighter cells. */
.slm-grid--dense th, .slm-grid--dense td { padding: 6px 14px; font-size: .875rem; }

/* A thin non-interactive row splitting a single table into two date ranges (e.g. past/upcoming
   payments around "today"), instead of two separate tables with their own headers. */
.slm-grid__divider td {
    background: var(--slm-table-head); color: var(--slm-muted);
    font-size: .8125rem; font-weight: 600;
    padding: 4px 14px;
}

/* Compact inline stats line, replacing a row of full StatCards where the page is meant to read
   dense rather than dashboard-like. */
.slm-payments-summary { display: flex; gap: 20px; flex-wrap: wrap; margin: 4px 0 16px; font-size: .85rem; color: var(--slm-muted); }
.slm-payments-summary strong { color: var(--slm-ink); font-weight: 600; }

/* Search input + <select> filters + result count, wraps on narrow width — DESIGN_SYSTEM.md
   "Filter bar" (.filter-bar). */
.slm-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.slm-filter-count { color: var(--slm-muted); font-size: .82rem; }

/* Tabs: native buttons; the selected one is bold and underlined, not told apart by colour alone. */
.slm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--slm-divider); margin-bottom: 16px; }
.slm-tabs__tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 14px; font: inherit; color: var(--slm-muted); cursor: pointer; }
.slm-tabs__tab[aria-selected="true"] { color: var(--slm-ink); font-weight: 600; border-bottom-color: var(--slm-action); }
.slm-tabs__tab:focus-visible { outline: 2px solid var(--slm-action); outline-offset: 2px; }

/* Upload screen: the data-type picker with its template download beside it. */
.slm-upload-type { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.slm-upload-type .slm-field { width: 320px; max-width: 100%; }

/* Dashed drop target — DESIGN_SYSTEM.md "Upload zone" (.upload-zone). The native file input is
   invisible and fills the label, so the whole zone is the click/drop target. */
.slm-upload-zone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: 2px dashed var(--slm-divider); border-radius: var(--slm-radius);
    padding: 40px 20px; text-align: center; cursor: pointer;
    background: var(--slm-table-head);
}
.slm-upload-zone:hover { border-color: var(--slm-action); background: var(--slm-action-tint); }
.slm-upload-zone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.slm-upload-zone__title { font-weight: 500; }
.slm-upload-zone__hint { color: var(--slm-muted); font-size: .8125rem; }

/* Document/zekerheid type chip — DESIGN_SYSTEM.md ".type-chip". */
.type-chip {
    display: inline-block; padding: 2px 8px; border-radius: var(--slm-radius);
    background: var(--slm-row-divider); color: var(--slm-muted); font-size: .78rem; font-weight: 500;
}

/* Segmented control: one choice out of a few (same look as the peildatum presets). */
.slm-segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--slm-radius); background: var(--slm-row-divider); }
.slm-segmented__option {
    background: none; border: none; border-radius: 3px;
    padding: 4px 14px; font: inherit; font-size: .82rem; color: var(--slm-muted); cursor: pointer; white-space: nowrap;
}
.slm-segmented__option:hover { color: var(--slm-ink); }
.slm-segmented__option.is-active { background: var(--slm-action); color: #fff; }
.slm-segmented__option:focus-visible { outline: 2px solid var(--slm-action); outline-offset: 1px; }

/* Heat scale for a matrix of rates or surcharges: one hue (SynVest blauw) from pale to dark, ink
   text on the light steps and white on the dark ones, each pair at 4.5:1 or better. */
.slm-heat--0 { background: #eaf7ff; color: var(--slm-ink); }
.slm-heat--1 { background: #c4e8f8; color: var(--slm-ink); }
.slm-heat--2 { background: #86cdee; color: var(--slm-ink); }
.slm-heat--3 { background: #1f78b0; color: #fff; }
.slm-heat--4 { background: #002b5c; color: #fff; }

.slm-matrix-hint { margin: 4px 0 16px; max-width: 72ch; }

/* Small multiples: one matrix per panel (e.g. per energy label), wrapping to the width available. */
.slm-multiples { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px 32px; }
.slm-multiples__panel { margin: 0; flex: 0 0 auto; max-width: 100%; overflow-x: auto; }
.slm-multiples__panel figcaption { margin-bottom: 6px; }
.slm-matrix { border-collapse: separate; border-spacing: 2px; font-size: .82rem; font-variant-numeric: tabular-nums; }
.slm-matrix th { color: var(--slm-muted); font-weight: 500; white-space: nowrap; padding: 2px 4px; }
.slm-matrix thead th { text-align: right; font-size: .75rem; }
.slm-matrix tbody th { text-align: left; }
.slm-matrix .slm-matrix__corner { text-align: left; color: var(--slm-muted-3); font-weight: 400; }
.slm-matrix td { text-align: right; padding: 6px 8px; border-radius: 4px; white-space: nowrap; }
.slm-matrix td.slm-heat--0 { box-shadow: inset 0 0 0 1px var(--slm-divider); }
.slm-matrix td:hover { outline: 2px solid var(--slm-accent-green); outline-offset: -2px; }

/* Rentetabel: the dimensions it does not vary sit as chips in the card head; the sum of base
   rate and costs is the figure a reader looks for, so it carries the weight. */
.slm-ratetable__fixed { flex-wrap: wrap; justify-content: flex-end; }
.slm-ratetable { width: auto; min-width: min(100%, 560px); margin-top: 8px; }
.slm-ratetable th, .slm-ratetable td { padding-right: 32px; }
/* The grid's 1% numeric columns would stretch a content-width table to the card edge. */
.slm-ratetable .slm-num { width: auto; }
.slm-ratetable .slm-ratetable__total { font-weight: 600; }

/* Energy label tag in the colours of the EU energy label, so a label reads at a glance; each
   colour carries its letter, never the meaning alone. */
.slm-energy {
    display: inline-flex; align-items: center; height: 22px; padding: 0 14px 0 8px;
    font-weight: 700; font-size: .82rem; color: var(--slm-ink);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
}
.slm-energy--a { background: #009640; }
.slm-energy--b { background: #52ae32; }
.slm-energy--c { background: #c8d400; }
.slm-energy--d { background: #ffed00; }
.slm-energy--e { background: #fbba00; }
.slm-energy--f { background: #eb6909; }
.slm-energy--g { background: #e2001a; color: #fff; }

/* ── Valuation band, loan detail and overview ────────────────────────── */

.slm-loan-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.slm-loan-lead a { color: var(--slm-action); font-weight: 500; text-decoration: none; }
.slm-loan-lead a:hover { color: var(--slm-action-700); }

/* The valuation band: outstanding → boekwaarde → intrinsieke waarde → herwaardering, read left to
   right. The 1px gap over a divider-coloured backdrop draws the rules between figures, and keeps
   drawing them correctly when the row wraps. */
.slm-valuation {
    background: var(--slm-surface); border: 1px solid var(--slm-divider); border-radius: var(--slm-radius);
    overflow: hidden; margin-bottom: 24px;
}
.slm-valuation__figures {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1px; background: var(--slm-divider);
}
.slm-figure { background: var(--slm-surface); padding: 18px 24px 16px; }
.slm-figure__label { color: var(--slm-muted); font-size: .8125rem; }
/* Merriweather figures give the amounts the weight of a statement, not a form field. */
.slm-figure__value {
    font-family: Merriweather, Georgia, serif; font-weight: 600; font-size: 1.5rem; line-height: 1.3;
    font-variant-numeric: lining-nums tabular-nums; margin-top: 4px; white-space: nowrap;
}
.slm-figure__note { color: var(--slm-muted); font-size: .75rem; margin-top: 4px; }
/* The present value is what the page is for: the band's one tinted panel, as .stat-card--accent. */
.slm-figure--lead { background: var(--slm-action-tint); }
.slm-figure--lead .slm-figure__value { font-size: 1.875rem; color: var(--slm-navy); }
.slm-figure--down .slm-figure__value,
.slm-figure--danger .slm-figure__value { color: var(--slm-down); }
.slm-valuation__basis {
    margin: 0; padding: 10px 24px; border-top: 1px solid var(--slm-divider);
    background: var(--slm-table-head); color: var(--slm-muted); font-size: .82rem;
}

/* The overview's band closes with where its figures come from and the way to the run behind them. */
.slm-valuation__basis--split { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }

/* Overview: how long a near-maturity loan has left, under its maturity date. */
.slm-maturity__left { color: var(--slm-muted); font-size: .75rem; }
.slm-maturity__left.is-soon { color: var(--slm-warning); font-weight: 600; }

/* A labelled on/off switch in a card head. */
.slm-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--slm-muted); cursor: pointer; }

/* Overview: maturing loans beside what needs attention, both cards the row's height, one column when
   narrow. A half-width head wraps its switch and link under the title rather than squeezing it. */
.slm-overview-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.slm-overview-row .slm-card__head { flex-wrap: wrap; }
@media (max-width: 1100px) {
    .slm-overview-row { grid-template-columns: minmax(0, 1fr); }
}
/* A second group heading in one card sits clear of the list above it. */
.slm-card > .slm-terms__title:not(:first-of-type) { margin-top: 20px; }
.slm-attention__list dd { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.slm-attention__total td { font-weight: 600; border-top: 1px solid var(--slm-muted-3); }

/* Terms and collateral on the left; how the rate was built, who is involved and notes beside them. */
.slm-loan-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); column-gap: 24px; align-items: start; }
@media (max-width: 1100px) {
    .slm-loan-layout { grid-template-columns: minmax(0, 1fr); }
}

.slm-terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 32px; }
.slm-terms__title {
    margin: 0 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--slm-divider);
    font-family: inherit; font-size: .875rem; font-weight: 600;
}

/* Label/figure pairs set as a ledger: label left, figure right-aligned on tabular numerals. */
.slm-facts { margin: 0; }
.slm-facts > div {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    padding: 6px 0; border-bottom: 1px solid var(--slm-row-divider);
}
.slm-facts > div:last-child { border-bottom: none; }
.slm-facts dt { color: var(--slm-muted); }
.slm-facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.slm-facts dd.slm-nowrap { white-space: nowrap; overflow-wrap: normal; }
.slm-facts__sub { display: block; font-size: .75rem; color: var(--slm-muted-3); }
.slm-facts > .slm-facts__total { border-top: 1px solid var(--slm-muted-3); border-bottom: none; margin-top: 2px; padding-top: 8px; }
.slm-facts__total dt, .slm-facts__total dd { color: var(--slm-ink); font-weight: 600; }

/* Discount rate build-up: one bar in the heat scale, base rate darkest. */
.slm-buildup__total { font-family: Merriweather, Georgia, serif; font-size: 1.25rem; color: var(--slm-navy); font-variant-numeric: lining-nums; }
.slm-buildup__bar { display: flex; gap: 2px; height: 12px; margin: 0 0 12px; border-radius: 2px; overflow: hidden; }
.slm-buildup__seg { flex-basis: 0; min-width: 3px; }
.slm-buildup__swatch { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 2px; }
.slm-buildup__seg.slm-heat--0, .slm-buildup__swatch.slm-heat--0 { box-shadow: inset 0 0 0 1px var(--slm-divider); }

/* Schedule: the period of the latest valuation carries a tint. */
.slm-card__head:has(.slm-segmented) { flex-wrap: wrap; align-items: center; }
.slm-schedule tbody tr.is-current td,
.slm-cashflows tbody tr.is-current td { background: var(--slm-action-tint); }
.slm-schedule__legend { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: .82rem; }
.slm-schedule__mark { width: 14px; height: 12px; background: var(--slm-action-tint); box-shadow: inset 0 0 0 1px var(--slm-divider); }
.slm-schedule__more { margin-top: 12px; }

/* ── Status / feedback ───────────────────────────────────────────────── */

.slm-muted { color: var(--slm-muted); }
.slm-notes { margin: 0; white-space: pre-wrap; }
.slm-readonly-hint { font-size: .78rem; color: var(--slm-muted); font-style: italic; }
.is-up { color: var(--slm-up); }
.is-down { color: var(--slm-down); }
.slm-error { color: var(--slm-danger); }
.slm-sec-ok { color: var(--slm-positive); font-weight: 600; white-space: nowrap; }
.slm-warning {
    background: var(--slm-warning-tint); border: 1px solid var(--slm-warning-line); color: var(--slm-warning);
    padding: 10px 14px; border-radius: var(--slm-radius); margin: 16px 0;
}
.slm-warning summary { cursor: pointer; }

/* Labelled status pill — DESIGN_SYSTEM.md semantic colour table. A status reads as a word, never
   as a bare coloured dot: the tag itself stays neutral, a small square in front carries the colour. */
.status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 1px 8px; border-radius: 3px; font-size: .8125rem; font-weight: 500;
    background: var(--slm-row-divider); color: var(--slm-ink);
}
.status-pill::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 1px; background: var(--slm-muted-3); }
/* Actief / Ontvangen / Goedgekeurd */
.status-pill--success::before { background: var(--slm-positive); }
/* Achterstallig / Hoog risico */
.status-pill--danger::before { background: var(--slm-danger); }
/* Watchlist / Middel risico / Open (controle) */
.status-pill--warning::before { background: #c98a1a; }
/* Verwacht */
.status-pill--info::before { background: var(--slm-action-700); }
/* Afgelost / Gepland */
.status-pill--draft { color: var(--slm-muted); }

.slm-btn {
    background: var(--slm-action); color: #fff; border: none; border-radius: var(--slm-radius);
    padding: 6px 14px; cursor: pointer; text-decoration: none; font-size: .85rem;
}
.slm-btn:hover { background: var(--slm-action-700); }
.slm-btn:disabled { background: var(--slm-divider); color: var(--slm-muted); cursor: default; }
.slm-btn--sm { padding: 4px 10px; font-size: .8rem; }
/* Secondary action (cancel, release): the same shape, without the filled action colour. The outline
   is an inset shadow rather than a border, so it stays the same size as a filled button beside it. */
.slm-btn--ghost { background: none; color: var(--slm-action); box-shadow: inset 0 0 0 1px var(--slm-divider); }
.slm-btn--ghost:hover { background: rgba(0, 28, 61, .04); color: var(--slm-action-700); }
.slm-btn--ghost:disabled { background: none; color: var(--slm-muted); }

/* Dialogs (create / amend / link). */
.slm-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0, 28, 61, .45);
    display: flex; align-items: center; justify-content: center; z-index: 50;
}
.slm-modal {
    /* Explicit, so a dialog opened from the sidebar doesn't inherit its white text. */
    color: var(--slm-ink);
    background: var(--slm-surface); border: 1px solid var(--slm-divider); border-radius: var(--slm-radius);
    width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow: auto;
    box-shadow: 0 10px 30px rgba(0, 28, 61, .25);
}
.slm-modal__head {
    padding: 16px 20px;
    background: var(--slm-navy); color: #fff;
    border-bottom: 1px solid var(--slm-navy-700);
    border-top-left-radius: var(--slm-radius); border-top-right-radius: var(--slm-radius);
}
.slm-modal__head h3 { margin: 0; color: #fff; }
.slm-modal__head--closable { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.slm-modal__close {
    flex: none; width: 32px; height: 32px; padding: 0;
    background: none; border: 0; border-radius: var(--slm-radius);
    color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.slm-modal__close:hover { background: var(--slm-navy-700); }
.slm-modal__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.slm-modal__body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.slm-modal__foot { padding: 14px 20px; border-top: 1px solid var(--slm-divider); display: flex; justify-content: flex-end; align-items: center; gap: 16px; }
/* The server's message sits to the left of the buttons, in the same row. */
.slm-modal__error { margin-right: auto; font-size: .85rem; }

/* Model changelog: one block per release, in the order the file lists them. */
.slm-changelog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.slm-changelog__head { display: flex; align-items: baseline; gap: 10px; }
.slm-changelog__version { font-weight: 600; }
.slm-changelog__date { color: var(--slm-muted); font-size: .85rem; }
.slm-changelog__section { margin: 8px 0 0; color: var(--slm-muted); font-size: .85rem; font-weight: 600; }
.slm-changelog__changes { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.slm-changelog__subchanges { margin: 4px 0 0; padding-left: 18px; list-style: circle; display: flex; flex-direction: column; gap: 2px; }

/* Keep the name + roles + sign-out together as one right-aligned group in the top bar. */
.slm-userbox { display: inline-flex; align-items: center; gap: 12px; }
.slm-user { color: var(--slm-muted); font-size: .9rem; }
.slm-user__roles {
    margin-left: 6px; color: var(--slm-action); font-size: .82rem;
    background: none; border: none; padding: 0; font-family: inherit; cursor: pointer;
}
.slm-user__roles:hover { text-decoration: underline; }
/* A role masked off for testing: struck through wherever it is listed. */
.slm-user__roles .is-off,
.slm-rolelist__name.is-off { text-decoration: line-through; opacity: .6; }

/* Role enable/disable list in the "Your roles" dialog. */
.slm-rolelist { display: flex; flex-direction: column; gap: 10px; }
.slm-rolelist__row { display: flex; align-items: center; gap: 10px; }
.slm-rolelist__name { font-weight: 500; color: var(--slm-ink); }
.slm-rolelist__name.is-unassigned { color: var(--slm-muted); font-weight: 400; }
.slm-rolelist__note { font-size: .82rem; }

/* A plain checkbox in the house action colour. */
.slm-toggle input, .slm-rolelist__row input { margin: 0; accent-color: var(--slm-action); }

/* Role capability matrix in the "Your roles" dialog. */
.slm-rolematrix-wrap { border-top: 1px solid var(--slm-divider); padding-top: 16px; }
.slm-rolematrix__title { margin: 0 0 10px; font-size: .95rem; }
.slm-rolematrix { border-collapse: collapse; width: 100%; font-size: .82rem; }
.slm-rolematrix th, .slm-rolematrix td { padding: 6px 8px; border-bottom: 1px solid var(--slm-row-divider); text-align: center; }
.slm-rolematrix thead th { color: var(--slm-muted); font-weight: 600; white-space: nowrap; }
.slm-rolematrix td.slm-rolematrix__cap, .slm-rolematrix th.slm-rolematrix__cap { text-align: left; color: var(--slm-ink); }
.slm-rolematrix tbody tr:last-child td { border-bottom: none; }
.slm-rolematrix__yes { color: var(--slm-positive); font-weight: 700; }
.slm-rolematrix__no { color: var(--slm-muted); }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; width: 100%;
    background: var(--slm-danger-tint); color: var(--slm-danger); border-top: 1px solid var(--slm-danger);
    padding: 12px 20px;
}

/* New-loan wizard: step indicator and footer buttons. */
.slm-steps { display: flex; gap: 8px; list-style: none; margin: 0 0 16px; padding: 0; counter-reset: slm-step; }
.slm-steps__item {
    counter-increment: slm-step; flex: 1; padding: 8px 12px; border-bottom: 3px solid var(--slm-divider);
    color: var(--slm-muted); font-size: .8125rem;
}
.slm-steps__item::before { content: counter(slm-step) ". "; }
.slm-steps__item--done { border-bottom-color: var(--slm-positive); color: var(--slm-ink); }
.slm-steps__item--active { border-bottom-color: var(--slm-action); color: var(--slm-action); font-weight: 600; }
.slm-wizard-nav { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 16px; }
.slm-wizard-nav__spacer { margin-right: auto; }
.slm-choice { display: flex; gap: 8px; margin-bottom: 16px; }
.slm-choice__option { padding: 6px 14px; border: 1px solid var(--slm-divider); border-radius: var(--slm-radius); background: var(--slm-surface); cursor: pointer; font: inherit; color: var(--slm-ink); }
.slm-choice__option--active { border-color: var(--slm-action); background: var(--slm-action-tint); color: var(--slm-action); font-weight: 600; }
.slm-picklist { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--slm-divider); border-radius: var(--slm-radius); }
.slm-picklist__item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--slm-row-divider); }
.slm-picklist__item:last-child { border-bottom: 0; }
.slm-notice { padding: 10px 14px; border: 1px solid var(--slm-warning); border-radius: var(--slm-radius); color: var(--slm-warning); background: var(--slm-surface); margin: 12px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
/* A loan proposal waiting for approval stands out from the cards in force around it. */
.slm-proposal { border-color: var(--slm-warning); }
.slm-proposal__actions { margin-top: 8px; }
.slm-badge { display: inline-block; padding: 1px 8px; border-radius: 3px; background: var(--slm-action-tint); color: var(--slm-action); font-size: .75rem; margin-left: 8px; }

/* The wizard's steps are cards on a page elsewhere; inside a dialog the dialog itself is the card. */
.slm-modal__body .slm-card { border: 0; padding: 0; margin-bottom: 0; }

/* A table with many columns keeps its natural width and scrolls sideways inside .slm-grid-scroll
   instead of squeezing cells onto several lines; the first column stays put so a row is still
   identifiable. */
.slm-grid--wide { min-width: 72rem; }
.slm-grid--medium { min-width: 48rem; }
.slm-grid--wide th, .slm-grid--wide td, .slm-grid--medium th, .slm-grid--medium td { white-space: nowrap; }
.slm-grid--wide th:first-child, .slm-grid--wide td:first-child,
.slm-grid--medium th:first-child, .slm-grid--medium td:first-child { position: sticky; left: 0; z-index: 1; background: var(--slm-surface); }
.slm-grid--wide thead th:first-child, .slm-grid--medium thead th:first-child { background: var(--slm-table-head); }
.slm-grid--wide tbody tr:hover td:first-child, .slm-grid--medium tbody tr:hover td:first-child { background: var(--slm-row-divider); }
.slm-card__head { flex-wrap: wrap; }
.slm-card__head-actions { flex-wrap: wrap; }
.slm-card__head-actions { margin-left: auto; justify-content: flex-end; }

/* A record's documents: name, when it was last made, and its buttons, one row per kind. */
/* No column gap: each cell carries its own left padding, so a row's divider runs unbroken across the card. */
.slm-docs { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: stretch; }
.slm-docs__row { display: contents; }
.slm-docs__row > * { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--slm-row-divider); }
.slm-docs__row > * + * { padding-left: 12px; }
.slm-docs__row:last-child > * { border-bottom: none; }
.slm-docs__when { color: var(--slm-muted); font-variant-numeric: tabular-nums; white-space: nowrap; justify-content: flex-end; }
.slm-docs__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.slm-docs__actions .slm-notice, .slm-docs__actions .slm-error { flex-basis: 100%; margin: 4px 0 0; }

/* A reference to the one record this record points at (a property's loan): a single line, not a one-row table. */
.slm-ref { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; margin: 0; padding: 4px 0; }
.slm-ref dt { color: var(--slm-muted); }
.slm-ref dd { margin: 0; min-width: 0; }
.slm-ref a { color: var(--slm-action); font-weight: 500; text-decoration: none; }
.slm-ref a:hover { color: var(--slm-action-700); }
.slm-ref__earlier { margin-top: 12px; color: var(--slm-muted); font-size: .8125rem; }
.slm-ref__earlier summary { cursor: pointer; }
.slm-ref__earlier ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.slm-ref__earlier a { color: var(--slm-action); text-decoration: none; }
