/* CRM library, file 5 of 7: surfaces. Loaded after lib/controls.css, before lib/timeline.css and app.css.

   Belongs here: what holds content. crm-card with its padding knobs and its compact and collapsed looks, crm-entry (a row inside a
   card), crm-kv (label and value), crm-stats and crm-stat, the tones of crm-callout, crm-section, and the skeleton of
   what loads (crm-skeleton, crm-skel and its shapes).

   Contract: a base rule is ONE class, a modifier two, descendant parts go inside :where(); no id, no element selector, no @layer.
   Padding, gap and density are --k-* knobs fed by the density tokens, declared again on every primitive so a value never leaks into
   a nested one; a page changes a surface through a knob or in context (`.crm-page-x .crm-card`), never by restyling the class itself.

   The builders are in public/app/components/surface.js (statTile, statGrid, callout, defList, entry, section), card.js (createCard)
   and skeleton.js (skeleton, skeletonShapes, skeletonLine). */

/* ── The card ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   A white rounded box with a head (toggle, title, count, actions) and a body. Its room is two knobs, fed by the density tokens:
     --k-pad-x  left and right of the head and the body, and under the body          --k-pad-y  above and under the head
   so a card in a [data-density="compact"] part, and every card on a phone (lib/tokens.css), is tighter without a rule of its own.
   A page that wants other room sets a knob in context (`.crm-about .crm-card-body { --k-pad-x: var(--sp-5); }`). The parts fall
   back on the tokens, so a head or a body outside a card still has its room. */
.crm-card { --k-pad-x: var(--crm-pad-x); --k-pad-y: var(--crm-pad-y); --k-ruled: var(--crm-card-ruled); background: var(--crm-surface-card); border: 1px solid var(--line); border-radius: var(--crm-radius-card); box-shadow: var(--crm-elev-card); }
/* --k-ruled 1 (the theme Dealleader): a line under the head, and the room of the head again above the body */
.crm-card-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--k-pad-y, var(--crm-pad-y)) var(--k-pad-x, var(--crm-pad-x)); border-bottom: calc(var(--k-ruled, 0) * 1px) solid var(--line); }
.crm-card-heading { display: flex; align-items: baseline; gap: var(--sp-2); flex: 1 1 auto; min-width: 0; }
.crm-card-title { font-size: var(--fs-lg); font-weight: var(--crm-fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-card-count { color: var(--muted); font-size: var(--fs-md); }
/* an icon in front of the title (createCard({ icon })), for a card among others of its kind: the quick view */
.crm-card-icon { align-self: center; color: var(--muted); font-size: var(--crm-icon-sm); }
.crm-card-actions { display: flex; align-items: center; gap: var(--sp-2); }
/* a text button in the head ("+ Toevoegen"): the weight of a ds button */
.crm-card-action { display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-2) var(--sp-3); border-radius: var(--crm-radius-ctl); color: var(--blue); font-size: var(--fs-md); font-weight: var(--crm-fw-semibold); }
/* on the soft blue the text is the info ink: --blue on it is 3.7:1 in dark */
.crm-card-action:hover { background: var(--blue-soft); color: var(--crm-info-ink); }
/* an action only admins have (createCard actions [{ admin: true }], 18-11-2026): the ink of --crm-admin on its soft field, with the shield
   of lib/controls.css after the label */
.crm-card-action.crm-admin { background: var(--crm-admin-soft); color: var(--crm-admin); }
.crm-card-action.crm-admin:where(:hover) { box-shadow: inset 0 0 0 .0625rem var(--crm-admin); }
.crm-card-body { padding: calc(var(--k-pad-y, var(--crm-pad-y)) * var(--k-ruled, 0)) var(--k-pad-x, var(--crm-pad-x)) var(--k-pad-x, var(--crm-pad-x)); }
/* compact: one step tighter, with a smaller title. createCard({ density: 'compact' }) sets data-density on the card, and that is
   where the room comes from (lib/tokens.css remaps --crm-pad-x and --crm-pad-y there, and --crm-row-y, --crm-cell-x and
   --crm-av-sm for what stands in it: an entry, the cells of a table, a small avatar). The word compact only makes the title smaller. */
.crm-card.compact > :where(.crm-card-head) :where(.crm-card-title) { font-size: var(--fs-md); }
/* collapsed: a slim row without a shadow, so a card that matters less can stay on the page without its weight */
.crm-card.collapsed { --k-pad-y: var(--sp-2); --k-ruled: 0; box-shadow: none; }
.crm-card.collapsed > :where(.crm-card-head) :where(.crm-card-title) { font-size: var(--fs-md); }
.crm-card.collapsed > :where(.crm-card-head) :where(.crm-card-toggle .ms) { transform: rotate(-90deg); }
:where(.crm-card-toggle .ms) { transition: transform var(--crm-dur); }

/* ── Figures ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   crm-stats is a row of tiles, as many next to each other as fit (--k-min is the least width of one: 9rem, so
   two fit next to each other on a phone); crm-stat is one figure: what it is (crm-stat-label), the figure (crm-stat-value) and a line under it
   (crm-stat-sub), with an icon at the left when it has one. statTile() and statGrid() of components/surface.js build them.
   A tile is a flat framed box, not a card: it also stands inside one. A tone word next to the class (warn, bad, ok, info) fills
   the tile softly and writes the figure in the ink of the tone (the tone table of lib/chip.css): a figure that asks for a look.
   The label and the figure say what it is; the colour only stresses it.
   The aliases are the four tile families the pages had (Analytics and the group of a company, a segment, Gebruikers en rechten
   and the campaigns, a survey): by hand they keep working, with the parts found by what they are (a strong is the figure). */
.crm-stats, .crm-seg-stats, .crm-ac-stats, .crm-nps-tiles { --k-min: 9rem; --k-gap: var(--sp-3); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--k-min)), 1fr)); gap: var(--k-gap); }
:where(.crm-stat, .crm-seg-stat, .crm-ac-stat, .crm-nps-tile) {
  --k-ink: var(--muted); --k-bg: var(--crm-surface-card); --k-accent: var(--faint); --k-solid: var(--crm-hue-slate-solid); --k-line: var(--line);
}
.crm-stat, .crm-seg-stat, .crm-ac-stat, .crm-nps-tile {
  --k-pad: var(--sp-3) var(--sp-4);
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; row-gap: var(--sp-0); min-width: 0; padding: var(--k-pad);
  border: 1px solid var(--k-line); border-radius: var(--crm-radius-box); background: var(--k-bg); box-shadow: none; color: var(--k-ink); font-size: var(--fs-sm);
}
:where(.crm-stat, .crm-seg-stat, .crm-ac-stat, .crm-nps-tile) > :where(*) { grid-column: 2; min-width: 0; overflow-wrap: anywhere; }
/* the icon stands at the left of the three lines; like the label and the sub line it has the ink of the tone (muted without one) */
:where(.crm-stat, .crm-seg-stat, .crm-ac-stat, .crm-nps-tile) > .ms { grid-column: 1; grid-row: 1 / span 3; align-self: center; margin-right: var(--sp-4); font-size: var(--crm-icon-lg); }
:where(.crm-stat, .crm-seg-stat, .crm-ac-stat, .crm-nps-tile) > :where(strong, .crm-stat-value, .crm-stat-n, .crm-seg-stat-n) { color: var(--ink); font-size: var(--fs-xl); font-weight: var(--crm-fw-bold); font-variant-numeric: tabular-nums; line-height: 1.2; }
:where(.crm-stat, .crm-seg-stat, .crm-ac-stat, .crm-nps-tile):where(.ok, .warn, .bad, .info, .violet) > :where(strong, .crm-stat-value, .crm-stat-n, .crm-seg-stat-n) { color: var(--k-ink); }
:where(.crm-stat, .crm-seg-stat, .crm-ac-stat, .crm-nps-tile) > :where(.crm-stat-sub) { font-size: var(--fs-xs); }
/* an icon in the line under the figure says what the tone says ("2 te laat" with a clock), so not by colour alone */
:where(.crm-stat-sub) .ms { font-size: var(--crm-icon-xs); vertical-align: -.15em; }
/* sm: the compact tile of a side panel. Less room, the label smaller, the figure one step down; the icon stands in the line of the
   label instead of at the left of the three, so four fit next to each other in a panel of 36rem */
.crm-stat.sm { --k-pad: var(--sp-2) var(--sp-3); column-gap: var(--sp-1); }
:where(.crm-stat.sm) > .ms { grid-row: 1; margin-right: 0; font-size: var(--crm-icon-sm); }
:where(.crm-stat.sm) > :where(.crm-stat-label) { font-size: var(--fs-xs); }
:where(.crm-stat.sm) > :where(.crm-stat-value, .crm-stat-sub) { grid-column: 1 / -1; }
:where(.crm-stat.sm) > :where(.crm-stat-value) { font-size: var(--fs-lg); }
/* strip: every tile on one line, as wide as each other however many there are, and two by two on a phone, where every row is as
   tall as the tallest (a tile without a line under its figure no longer makes its row shorter than the bones were) and a last tile
   that stands alone takes the whole row instead of leaving an empty cell (review 12-11) */
.crm-stats.strip { --k-gap: var(--sp-2); grid-template-columns: none; grid-auto-columns: minmax(0, 1fr); grid-auto-rows: 1fr; grid-auto-flow: column; }
@media (width < 40rem) {
  .crm-stats.strip { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; }
  .crm-stats.strip > :where(:last-child:nth-child(odd)) { grid-column: 1 / -1; }
}
/* clickable: a tile that leads to what it counts (statTile({ onClick }), the KPIs of Member 360): a button with the look of the tile,
   its frame a step stronger under the pointer; the focus ring is the one of lib/base.css */
.crm-stat.clickable { width: 100%; text-align: start; cursor: pointer; }
.crm-stat.clickable:where(:hover) { --k-line: var(--line-strong); }
/* lg: the one figure a panel is about (the month of the dashboard, 13-11-2026): more room and the figure two steps up. solid: that
   tile on the blue solid with white text (5.2:1 light, 4.7:1 dark), the one anchor of its panel. crm-stat-body is what stands under
   the figure and its line (statTile({ body }): a meter with its two ends). */
.crm-stat.lg { --k-pad: var(--sp-4) var(--sp-5); row-gap: var(--sp-1); }
:where(.crm-stat.lg) > :where(.crm-stat-value) { font-size: var(--fs-2xl); }
.crm-stat.solid { --k-ink: var(--crm-on-solid); --k-bg: var(--crm-hue-blue-solid); --k-accent: var(--crm-on-solid); --k-line: transparent; }
:where(.crm-stat.solid) > :where(.crm-stat-value) { color: var(--crm-on-solid); }
.crm-stat-body { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }

/* ── Meters and bars ───────────────────────────────────────────────────────────────────────────────────────────────────────────
   crm-meter is how far something is along (the day of the dashboard, the month towards its goal): a track with a fill of --k-value
   (crm-meter-fill, 0 to 100 %) and, when there is one, a tick at --k-target (crm-meter-target: the goal, or today in a month). meter()
   builds it as a progressbar with a name and its value for a screen reader; the text next to it says the same, so the length is never
   the only thing that tells. The fill is the blue solid, or the accent of a tone word (ok, warn, bad, info: the tone table); invert
   is white on a solid fill (the solid tile). --k-h is the height of the track.
   crm-bars is a small column chart (the revenue per month): a column per value (crm-bars-item), its bar (crm-bars-bar, --k-value
   of the plot, which is --k-h high) over its label (crm-bars-label), the value as text for a screen reader (crm-bars-say) and in
   the tooltip. The current one (on, aria-current) is the blue solid with its label in bold, the rest the strong line colour: the
   label says which one it is, not the colour alone. barChart() builds it. */
:where(.crm-meter) { --k-ink: var(--ink); --k-bg: var(--line); --k-accent: var(--crm-hue-blue-solid); --k-solid: var(--crm-hue-blue-solid); --k-line: transparent; }
.crm-meter { --k-value: 0%; --k-target: 0%; --k-h: .375rem; position: relative; display: block; flex: none; width: 100%; height: var(--k-h); border-radius: var(--pill); background: var(--k-bg); }
:where(.crm-meter) > :where(.crm-meter-fill) { position: absolute; inset: 0 auto 0 0; width: var(--k-value); border-radius: inherit; background: var(--k-accent); }
:where(.crm-meter) > :where(.crm-meter-target) { position: absolute; inset: calc(var(--sp-1) * -1) auto calc(var(--sp-1) * -1) var(--k-target); width: .125rem; border-radius: var(--pill); background: var(--k-ink); }
.crm-meter.invert { --k-ink: var(--crm-on-solid); --k-bg: color-mix(in srgb, var(--crm-on-solid) 28%, transparent); --k-accent: var(--crm-on-solid); }
.crm-bars { --k-h: 6rem; --k-gap: var(--sp-2); display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; align-items: end; gap: var(--k-gap); min-width: 0; }
.crm-bars-item { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
:where(.crm-bars-item) > :where(.crm-bars-plot) { display: flex; align-items: flex-end; height: var(--k-h); }
:where(.crm-bars-plot) > :where(.crm-bars-bar) { width: 100%; height: var(--k-value, 0%); min-height: .1875rem; border-radius: var(--crm-radius-tag) var(--crm-radius-tag) 0 0; background: var(--line-strong); }
:where(.crm-bars-item.on) :where(.crm-bars-bar) { background: var(--crm-hue-blue-solid); }
:where(.crm-bars-item) > :where(.crm-bars-label) { overflow: hidden; color: var(--muted); font-size: var(--fs-xs); text-align: center; text-overflow: ellipsis; white-space: nowrap; }
:where(.crm-bars-item.on) > :where(.crm-bars-label) { color: var(--ink); font-weight: var(--crm-fw-bold); }
:where(.crm-bars-item) > :where(.crm-bars-say) { position: absolute; inset: 0 auto auto 0; width: .0625rem; height: .0625rem; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── The head of a record ──────────────────────────────────────────────────────────────────────────────────────────────────────
   crm-hero is the head of one record on a band in its colour (the quick view, 12-11-2026): what leads it (crm-hero-lead, a large
   avatar), the name as a heading (crm-hero-title, a link to the record), a line under it (crm-hero-sub: the domain and the city, or
   the company of a deal), a row of chips (crm-hero-chips: status, type, the owner) and what ends it at the right (crm-hero-end).
   hero() of components/surface.js builds it. The band reads the tone knobs: neutral it is the sunken surface with the ink of the
   page; with data-hue (a hue of lib/tokens.css, the colour of the record's avatar) it is the 14 % tint of that hue and the text is
   its ink, 5.0:1 or more in both themes (the hue table of lib/chip.css). The chips on it are outline badges: their own surface.
   It wraps: the body takes at least 12rem next to the lead, and what ends it goes under them when the two do not fit next to each
   other (the Brand Ambassador of Member 360 on a phone). */
:where(.crm-hero) { --k-ink: var(--ink); --k-bg: var(--crm-surface-sunken); --k-accent: var(--faint); --k-solid: var(--crm-hue-slate-solid); --k-line: transparent; }
.crm-hero { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-4); min-width: 0; padding: var(--sp-5); border-radius: var(--crm-radius-card); background: var(--k-bg); color: var(--k-ink); }
.crm-hero-lead { display: inline-flex; flex: none; }
.crm-hero-body { display: flex; flex: 1 1 12rem; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.crm-hero-title { font-size: var(--fs-xl); font-weight: var(--crm-fw-bold); line-height: 1.25; overflow-wrap: anywhere; }
/* bridge: `.ds h3` gives a heading the navy of ds.css; the name has the ink of the band */
.crm .crm-hero-title { color: var(--k-ink); }
/* bridge: the name is a link in that ink (`.crm .crm-link` is blue, under 4.5:1 on some tints), underlined under the pointer */
.crm .crm-hero-title > a { color: inherit; font-weight: inherit; }
/* bridge: a link in the line under the name (the domain, the company of a deal) is that ink too, and underlined, so it is not told by colour */
.crm .crm-hero-sub a { color: inherit; text-decoration: underline; text-underline-offset: .15em; }
.crm-hero-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); min-width: 0; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.crm-hero-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.crm-hero-end { display: flex; flex: none; align-items: center; gap: var(--sp-1); }
/* foot (18-11-2026): what belongs to the head under its line, in the band (the ways to reach who asked a lead) */
.crm-hero-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); min-width: 0; margin-top: var(--sp-1); }
/* compact (18-11-2026, the lead in its dialog: "er wordt erg slecht gebruik gemaakt van de ruimte"): less room, the title a step smaller with
   the chips next to it, the line under them */
.crm-hero.compact { align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
.crm-hero.compact > :where(.crm-hero-body) { flex-flow: row wrap; align-items: center; gap: var(--sp-0) var(--sp-3); }
.crm-hero.compact > :where(.crm-hero-body) > :where(.crm-hero-title) { font-size: var(--fs-lg); }
.crm-hero.compact > :where(.crm-hero-body) > :where(.crm-hero-sub) { flex-basis: 100%; order: 1; }
.crm-hero.compact > :where(.crm-hero-body) > :where(.crm-hero-chips) { margin-top: 0; }
.crm-hero.compact > :where(.crm-hero-body) > :where(.crm-hero-foot) { flex-basis: 100%; order: 2; }

/* ── Notices ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   crm-callout is a notice in a soft frame: an icon, what there is to say (crm-callout-body) and, when something can be done
   about it, a button at the right (crm-callout-actions). callout() of components/surface.js builds it. Without a tone word it is
   info; warn | bad | ok take the tone table of lib/chip.css, neutral is the grey strip. The text is the ink of the tone on its soft
   fill, 4.5:1 or more in both themes (info was --blue-dark on --blue-soft, 2.9:1 in dark). inline is the same without the frame:
   a line of text with its icon. crm-ac-note is the older name. */
:where(.crm-callout, .crm-ac-note) { --k-ink: var(--crm-info-ink); --k-bg: var(--blue-soft); --k-accent: var(--blue); --k-solid: var(--crm-hue-blue-solid); --k-line: transparent; }
.crm-callout, .crm-ac-note { display: flex; align-items: flex-start; gap: var(--sp-3); margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--crm-radius-box); background: var(--k-bg); color: var(--k-ink); font-size: var(--fs-sm); }
.crm-callout.neutral { --k-ink: var(--ink); --k-bg: var(--crm-surface-sunken); --k-accent: var(--muted); }
.crm-callout.inline { padding: 0; background: none; }
:where(.crm-callout, .crm-ac-note) > .ms { flex: none; font-size: var(--crm-icon-md); }
.crm-callout-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.crm-callout-actions { display: inline-flex; flex: none; align-items: center; gap: var(--sp-2); margin-left: auto; }

/* ── Labels with their values ──────────────────────────────────────────────────────────────────────────────────────────────────
   crm-kv is a list of rows (crm-kv-row), each a label (crm-kv-key, muted) and its value (crm-kv-val) in two columns; --k-key is
   the width of the label column. stack puts every value under its label, which a row also does by itself in a box narrower than
   24rem that can be asked for its width (crm-cq); ruled draws a line under every row. defList() builds it, as a <dl>. */
.crm-kv { --k-key: 40%; --k-gap: var(--sp-1); display: flex; flex-direction: column; gap: var(--k-gap); margin: 0; font-size: var(--fs-md); }
.crm-kv-row { display: grid; grid-template-columns: minmax(0, var(--k-key, 40%)) minmax(0, 1fr); column-gap: var(--sp-4); min-width: 0; }
.crm-kv-key { color: var(--muted); overflow-wrap: anywhere; }
.crm-kv-val { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.crm-kv.stack > :where(.crm-kv-row) { grid-template-columns: minmax(0, 1fr); }
.crm-kv.ruled > :where(.crm-kv-row) { padding: var(--sp-2) 0; border-bottom: 1px solid var(--line-soft); }
/* cols (18-11-2026): many short facts in a wide box (the request and the origin of a lead): every label small over its value, the rows side
   by side in columns of at least --k-col, as many as fit */
.crm-kv.cols { --k-col: 10rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--k-col)), 1fr)); gap: var(--sp-3) var(--sp-5); }
.crm-kv.cols > :where(.crm-kv-row) { grid-template-columns: minmax(0, 1fr); align-content: start; }
.crm-kv.cols :where(.crm-kv-key) { font-size: var(--fs-sm); }
@container (width < 24rem) { .crm-kv-row { grid-template-columns: minmax(0, 1fr); } }

/* ── A row inside a card ───────────────────────────────────────────────────────────────────────────────────────────────────────
   crm-entry: what leads it (crm-entry-lead: an avatar, an icon), the text (crm-entry-body: a small line above the title, the title
   with its chips, a line of facts, whatever else) and what ends the row at the right (crm-entry-end). Rows are parted by a line;
   boxed gives each its own frame. The room above and under a row is the density token, so it is tighter in a compact card.
   entry() builds it. */
.crm-entry { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; padding: var(--crm-row-y) 0; }
:where(.crm-entry) + .crm-entry { border-top: 1px solid var(--line-soft); }
.crm-entry-lead { display: inline-flex; flex: none; }
.crm-entry-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--sp-0); min-width: 0; }
.crm-entry-over { color: var(--muted); font-size: var(--fs-xs); }
.crm-entry-title { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; font-weight: var(--crm-fw-semibold); }
:where(.crm-entry-title) > :where(a, span):where(:first-child) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* bridge: a title that is a link keeps the weight of a title (.crm .crm-link in app.css makes a link lighter) */
.crm .crm-entry-title > a { font-weight: inherit; }
.crm-entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); color: var(--muted); font-size: var(--fs-sm); }
.crm-entry-end { display: flex; flex: none; align-items: center; gap: var(--sp-1); }
.crm-entry.boxed { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--crm-radius-box); }
:where(.crm-entry.boxed) + .crm-entry.boxed { margin-top: var(--sp-3); }

/* ── A linked object ───────────────────────────────────────────────────────────────────────────────────────────────────────────
   crm-linked is the one row of a record that a record, a task or a lead hangs on (Marley 18-11-2026: "betere global styling voor alles
   dat een 'gekoppeld object' is"): the mark of its object (crm-linked-mark, a small avatar of components/shapes.js), what it is in small
   capitals (crm-linked-type), its name as a link with its chips (crm-linked-name; the chips go under the name where they do not fit
   next to it, so a narrow column never cuts the name to two letters), one line of facts cut off at the end (crm-linked-meta),
   what can be done with it at the right (crm-linked-end) and, for a richer card, what stands under the text (crm-linked-more, under the
   text and not under the mark). Rows are parted by a line and have the room of a row (the density token); boxed gives each its own frame
   (the cards of a record page), and boxed rows stand in a crm-stack that gives the room between them.
   linkedObject() of components/surface.js builds it. */
.crm-linked { --k-gap: var(--sp-3); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: var(--k-gap); min-width: 0; padding: var(--crm-row-y) 0; }
:where(.crm-linked) + .crm-linked { border-top: 1px solid var(--line-soft); }
.crm-linked-mark { display: inline-flex; grid-column: 1; }
.crm-linked-body { display: flex; flex-direction: column; grid-column: 2; min-width: 0; }
.crm-linked-type { color: var(--muted); font-size: var(--fs-2xs); font-weight: var(--crm-fw-semibold); letter-spacing: var(--crm-track-caps); line-height: 1.4; text-transform: uppercase; }
.crm-linked-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); min-width: 0; font-weight: var(--crm-fw-semibold); }
:where(.crm-linked-name) > :where(:first-child) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the name keeps the weight of a name: .crm .crm-link (lib/base.css) makes a link lighter; same weight, a later file */
.crm .crm-linked-name > :where(.crm-link) { font-weight: inherit; text-align: start; }
.crm-linked-meta { min-width: 0; overflow: hidden; color: var(--muted); font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.crm-linked-end { display: flex; flex: none; grid-column: 3; align-items: center; gap: var(--sp-1); }
.crm-linked-more { grid-column: 2 / -1; min-width: 0; margin-top: var(--sp-2); }
.crm-linked.boxed { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--crm-radius-box); background: var(--crm-surface-card); }

/* ── A block with a heading ────────────────────────────────────────────────────────────────────────────────────────────────────
   crm-section: a heading (crm-section-head: the title, a count next to it, what can be done with the block at the right) and the
   content under it, --k-gap apart. sub is a block inside a block: the smaller heading. The weight and the colour of the title are
   those ds.css gives a heading; the size is set here, because ds.css never sets one. section() builds it. */
.crm-section { --k-gap: var(--sp-3); display: flex; flex-direction: column; gap: var(--k-gap); min-width: 0; }
.crm-section-head { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.crm-section-title { min-width: 0; margin: 0; font-size: var(--fs-lg); line-height: 1.25; }
.crm-section.sub > :where(.crm-section-head) :where(.crm-section-title) { font-size: var(--fs-md); }
.crm-section-count { color: var(--muted); font-size: var(--fs-md); }
.crm-section-actions { display: inline-flex; align-items: center; gap: var(--sp-2); margin-left: auto; }

/* ── The head of a page and the card of a list ─────────────────────────────────────────────────────────────────────────────────
   (Marley 12-11-2026: Bedrijven had a head with an icon and a count and one card around tabs, toolbar and table, Taken a plain h1
   with a lede and its parts loose on the page. One head and one card now, so the next page cannot drift.)
   crm-pagehead: the title line at the left (crm-pagehead-title: the grey disc with the icon of the page, crm-pagehead-icon; the
   h1, crm-pagehead-name; the count in a bubble; whatever else belongs on that line) and what can be done at the right
   (crm-pagehead-actions). crm-pagehead-lede is a muted line under the title, for a page that needs one; crm-pagehead-say is the
   name of the count (countLabel), read by a screen reader before the number and not shown. pageHead() builds it.
   crm-listcard: one white card with, top to bottom, the row of tabs (crm-listcard-tabs, the tabs of the views without a line of
   their own), the bars (the toolbar inset), the body (crm-listcard-body: the table bare and edge to edge, or the board) and the
   footer. On a desktop it fills what is left of the page and only its body scrolls (the page main carries crm-list-page); on a
   phone the page scrolls and the card grows with what is in it. listCard() builds it. crm-list-head and crm-list-card are the
   hooks the list pages had: they ride along and style nothing.
   Every page has this head since 13-11-2026, a detail page too (a task, a partner, a segment, a survey): its buttons go under the
   title where they do not fit next to it (a phone), level with the mark of the page also when a lede makes the title taller, and a
   long title stays next to its mark and is cut off there. */
.crm-pagehead { --k-gap: var(--sp-5); display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--k-gap); min-width: 0; margin-bottom: var(--sp-5); }
.crm-pagehead-title { display: flex; flex: 1 1 12rem; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); min-width: 0; }
.crm-pagehead-icon { display: inline-grid; flex: none; place-items: center; width: 3rem; height: 3rem; border-radius: var(--pill); background: var(--line); color: var(--muted); font-size: var(--fs-lg); }
:where(.crm-pagehead-icon) > .ms { font-size: var(--crm-icon-md); }
/* the mark of the object the page is about (pageHead({ object }), 13-11-2026): the avatar of lib/chip.css draws shape and fill itself */
.crm-pagehead-icon.object { background: none; }
.crm-pagehead-name { min-width: 0; font-size: var(--fs-2xl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:where(.crm-pagehead-icon) ~ .crm-pagehead-name { max-width: calc(100% - 3rem - var(--sp-4)); }
:where(.crm-pagehead-title) > :where(.crm-pagehead-say) { position: absolute; inset: 0 auto auto 0; width: .0625rem; height: .0625rem; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* the lede is a line of its own under the title, its text at most 42rem wide: a max-width would clamp its flex-basis and put it next to
   the title on a wide screen, so the room at its right is padding (a percentage of the title row), and --k-indent the room of the mark;
   max-width: none also for a hook that has one (crm-lede of a segment) */
.crm-pagehead-lede { --k-indent: 0rem; flex: 1 0 100%; max-width: none; margin: 0; padding: 0 max(0rem, 100% - 42rem - var(--k-indent)) 0 var(--k-indent); color: var(--muted); }
:where(.crm-pagehead-icon) ~ .crm-pagehead-lede { --k-indent: calc(3rem + var(--sp-4)); }
.crm-pagehead-actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; align-self: flex-start; align-items: center; justify-content: flex-end; gap: var(--sp-3); min-width: 0; min-height: 3rem; margin-left: auto; }
.crm-listcard { --k-pad-x: var(--sp-5); display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--crm-radius-card); background: var(--crm-surface-card); box-shadow: var(--crm-elev-card); }
.crm-listcard-tabs { display: flex; flex: none; align-items: center; min-width: 0; padding: 0 var(--k-pad-x, var(--sp-5)); border-bottom: 1px solid var(--line); }
.crm-listcard-body { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; }
@media (width < 48rem) {
  .crm-pagehead { margin-bottom: var(--sp-4); }
  .crm-pagehead-name { font-size: var(--fs-xl); }
  .crm-listcard { --k-pad-x: var(--sp-3); overflow: visible; }
}
/* a phone: the card of a list runs from edge to edge of the screen (over the 5vw of the page), so its table has the whole width */
@media (width < 40rem) {
  .crm-listcard { margin-inline: -5vw; border-inline: 0; border-radius: 0; }
}

/* ── Skeletons ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   What stands where content comes while it loads (Marley 11-11-2026: skeleton loaders on every screen): grey shapes in the measures
   of the real thing, so nothing jumps when the data arrives. skeleton(kind, opts) of components/skeleton.js and
   loadingState(text, { kind }) of components/empty.js build them; a page never writes these classes.
   crm-skeleton holds one shape: it is the polite status with aria-busy and one line for a screen reader (crm-skeleton-say, the
   loading text of the page), and the shapes in it are aria-hidden.
   crm-skel is the one bone: a line of text by default, one line box high (1lh, so a column of bones is as tall as the text it
   stands for) with a bar of --k-bar in the middle. The modifiers take the size of the real part from its token:
     wide, short   90 % and 40 % instead of 70 %            title    the size of a card title           figure  of a stat figure
     sub           a small line under a name (crm-cell-sub)  heading  the h1 of a page
     chip          --crm-chip-h, a pill                      disc     --crm-av-sm (--k-w for another)    box     a tick box
     field         --crm-ctl-h, the width of the row         block    --k-h high (6rem), a graph or a text area
     ratio         its height from its width (--k-ratio, a thumbnail of 4:3) instead of --k-h
     tile          the frame of a stat tile (its bones inside)
   The shapes around the bones are parts of the skeleton: a table (cells with the room of a cell), a board (lanes with cards), a
   card, rows of a card (entries), label and value rows (kv), form rows, tiles, tabs, a head and a calendar grid. One shimmer, off
   under prefers-reduced-motion; the colours are --crm-skel and --crm-skel-shine (lib/tokens.css, with a dark twin). */
/* in a page body that is a grid (the task page: main and side) the skeleton spans every column; it is the shape of the whole body */
.crm-skeleton { --k-gap: var(--crm-gap); display: flex; flex-direction: column; grid-column: 1 / -1; gap: var(--k-gap); min-width: 0; }
/* inset: the body of a card without padding of its own (the list card), its parts one under the other without room between them */
.crm-skeleton.inset { --k-gap: 0; }
:where(.crm-skeleton) > :where(.crm-skeleton-say) { position: absolute; inset: 0 auto auto 0; width: .0625rem; height: .0625rem; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.crm-skel { --k-w: 70%; --k-h: 1lh; --k-bar: .75em; --k-r: var(--crm-radius-ctl); position: relative; display: block; flex: none; width: var(--k-w); max-width: 100%; height: var(--k-h); }
.crm-skel::before {
  content: ""; position: absolute; inset: calc((var(--k-h) - var(--k-bar)) / 2) 0; border-radius: var(--k-r);
  background: linear-gradient(90deg, var(--crm-skel) 25%, var(--crm-skel-shine) 50%, var(--crm-skel) 75%); background-size: 200% 100%;
  animation: crm-shimmer 1.4s linear infinite;
}
.crm-skel.wide { --k-w: 90%; }
.crm-skel.short { --k-w: 40%; }
.crm-skel.sub { --k-w: 55%; font-size: var(--fs-xs); }
.crm-skel.title { --k-w: 45%; font-size: var(--fs-lg); line-height: 1.25; }
.crm-skel.heading { --k-w: 50%; font-size: var(--fs-2xl); line-height: 1.2; }
.crm-skel.figure { --k-w: 4rem; font-size: var(--fs-xl); line-height: 1.2; }
.crm-skel.chip { --k-w: 4.5rem; --k-h: var(--crm-chip-h); --k-bar: var(--k-h); --k-r: var(--pill); display: inline-block; vertical-align: middle; }
.crm-skel.disc { --k-w: var(--crm-av-sm); --k-h: var(--k-w); --k-bar: var(--k-h); --k-r: var(--pill); }
.crm-skel.box { --k-w: 1.15rem; --k-h: var(--k-w); --k-bar: var(--k-h); }
.crm-skel.field { --k-w: 100%; --k-h: var(--crm-ctl-h); --k-bar: var(--k-h); }
.crm-skel.block { --k-w: 100%; --k-h: 6rem; --k-bar: var(--k-h); --k-r: var(--crm-radius-box); }
.crm-skel.ratio { --k-h: auto; aspect-ratio: var(--k-ratio, 4 / 3); }
.crm-skel.ratio::before { inset: 0; }
.crm-skel.tile { --k-w: auto; --k-h: auto; display: flex; flex-direction: column; row-gap: var(--sp-0); min-width: 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--crm-radius-box); font-size: var(--fs-sm); }
.crm-skel.tile::before { content: none; }
@keyframes crm-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .crm-skel::before { animation: none; } }

/* a table: --k-cols columns of cells with the room of a cell (the density tokens), the head on the sunken surface. A column is
   at least 6rem, so on a phone the shape is cut at the right like a table that scrolls; bare is the table inside a card */
.crm-skel-table { --k-cols: 4; display: grid; grid-template-columns: repeat(var(--k-cols), minmax(6rem, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--crm-radius-card); background: var(--crm-surface-card); font-size: var(--fs-md); }
.crm-skel-table.bare { border: 0; border-radius: 0; background: none; }
:where(.crm-skel-table) > :where(.crm-skel-cell) { min-width: 0; padding: var(--crm-row-y) var(--crm-cell-x); border-bottom: 1px solid var(--line-soft); }
:where(.crm-skel-table) > :where(.crm-skel-cell.th) { border-bottom-color: var(--line-strong); background: var(--surface-2); font-size: var(--fs-2xs); }
/* a board: lanes of --k-lane next to each other on the sunken surface, with compact cards in them */
.crm-skel-board { --k-lane: 17rem; display: grid; grid-auto-columns: minmax(var(--k-lane), 1fr); grid-auto-flow: column; gap: var(--sp-4); overflow: hidden; }
.crm-skel-board.inset { padding: var(--sp-4) var(--sp-6); }
:where(.crm-skel-board) > :where(.crm-skel-lane) { display: flex; flex-direction: column; gap: var(--sp-2); min-height: 12rem; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--crm-radius-box); background: var(--crm-surface-sunken); }
/* a card: the frame and the room of crm-card; compact is a card on a board */
.crm-skel-card { --k-pad-x: var(--crm-pad-x); --k-pad-y: var(--crm-pad-y); display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding: var(--k-pad-y) var(--k-pad-x); border: 1px solid var(--line); border-radius: var(--crm-radius-card); background: var(--crm-surface-card); box-shadow: var(--crm-elev-card); }
.crm-skel-card.compact { --k-pad-x: var(--sp-4); --k-pad-y: var(--sp-3); gap: var(--sp-2); border-radius: var(--crm-radius-ctl); }
/* rows of a card: what leads (a disc), the lines, a line between the rows; the room of crm-entry */
.crm-skel-entry { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; padding: var(--crm-row-y) 0; }
:where(.crm-skel-entry) + .crm-skel-entry { border-top: 1px solid var(--line-soft); }
:where(.crm-skel-entry, .crm-skel-head, .crm-skel-hero) > :where(.crm-skel-body) { display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--sp-0); min-width: 0; }
/* labels with their values, in the two columns of crm-kv */
.crm-skel-kv { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; font-size: var(--fs-md); }
:where(.crm-skel-kv) > :where(.crm-skel-pair) { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); column-gap: var(--sp-4); }
/* a form: a label over a field, row under row */
.crm-skel-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; max-width: 40rem; }
:where(.crm-skel-form) > :where(.crm-skel-pair) { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-sm); }
/* the figures of a page: the grid of crm-stats */
.crm-skel-tiles { --k-min: 9rem; --k-gap: var(--sp-3); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--k-min)), 1fr)); gap: var(--k-gap); }
/* the strip of compact tiles of the quick view: the grid of crm-stats.strip, the room and the type of crm-stat.sm */
.crm-skel-tiles.strip { --k-gap: var(--sp-2); grid-template-columns: none; grid-auto-columns: minmax(0, 1fr); grid-auto-rows: 1fr; grid-auto-flow: column; }
@media (width < 40rem) { .crm-skel-tiles.strip { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; } }
:where(.crm-skel-tiles.strip, .crm-stats.strip) > .crm-skel.tile { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); }
:where(.crm-skel-tiles.strip, .crm-stats.strip) .crm-skel.figure { font-size: var(--fs-lg); }
/* the head of a record on its band (crm-hero), and a row of round actions (crm-action-bar): a disc of 2.75rem over a short label */
.crm-skel-hero { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-4); min-width: 0; padding: var(--sp-5); border-radius: var(--crm-radius-card); background: var(--crm-surface-sunken); }
/* like crm-hero: the text keeps 12rem next to the disc, and what ends the band goes under it when the two do not fit */
.crm-skel-hero > :where(.crm-skel-body) { flex-basis: 12rem; }
.crm-skel-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
:where(.crm-skel-actions) > :where(.crm-skel-action) { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); min-width: 4.25rem; padding: var(--sp-1); font-size: var(--fs-xs); line-height: 1.2; }
/* tabs over a body, and a head: a disc with its lines next to it. inset: the view tabs in the bar of a list card, with the room
   of a tab (crm-tabs.underline in a crm-view-bar) */
.crm-skel-tabs { --k-gap: var(--sp-5); display: flex; gap: var(--k-gap); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line); }
.crm-skel-tabs.inset { --k-gap: calc(var(--sp-5) * 2 + var(--sp-1)); overflow: hidden; padding: var(--sp-3) calc(var(--sp-5) * 2) calc(var(--sp-3) + .125rem); }
/* the head of a page with buttons: the title at the left, the buttons at the right; they drop under it when they do not fit */
.crm-skel-pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
:where(.crm-skel-pagehead) > :where(:first-child) { flex: 1 1 20rem; min-width: 0; }
:where(.crm-skel-pagehead) > :where(:last-child) { margin-left: auto; }
/* a heading with its text and a table under it: the room of a section of a page (crm-an-section) */
.crm-skel-section { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding-top: var(--sp-6); }
/* the row of Kolommen over a table: the room of createDataTable (crm-dt-host) */
.crm-skel-dthost { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.crm-skel-dtbar { display: flex; align-items: center; justify-content: flex-end; min-height: 2rem; }
.crm-skel-head { --k-gap: var(--sp-3); display: flex; align-items: center; gap: var(--k-gap); min-width: 0; }
/* a month: seven columns, a row of weekday names, days of the height of crm-cal-day */
.crm-skel-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--crm-radius-box); background: var(--crm-surface-card); font-size: var(--fs-sm); }
:where(.crm-skel-cal) > :where(.crm-skel-cell) { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; min-height: 6.5rem; padding: var(--sp-2); border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
:where(.crm-skel-cal) > :where(.crm-skel-cell.th) { min-height: 0; padding: var(--sp-2) var(--sp-3); border-bottom-color: var(--line); font-size: var(--fs-xs); }
@media (width < 40rem) { :where(.crm-skel-cal) > :where(.crm-skel-cell) { min-height: 3.5rem; } }
