/* IST design system · components v0.5.3 (draft, 2026-11-17)
   Plain HTML/CSS on top of tokens.css. Only semantic tokens here, no raw colours.
   Rule of thumb: the brand colour fills AREAS (chrome, primary button, title bar); the strong brand step draws
   LINES, MARKS and TEXT (active bar, selection, links). State is never colour alone. */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: var(--text-md); line-height: var(--leading-normal);
       color: var(--text); background: var(--page); }
[data-density="compact"] body, body[data-density="compact"] { font-size: var(--text-sm); }
h1, h2, h3, h4 { margin: 0; line-height: var(--leading-tight); font-weight: var(--weight-semibold); }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* a container that gets focus by script (tabindex="-1", e.g. a detail panel after a click in a list) shows no ring.
   Widgets that move focus with the arrow keys give the focused item tabindex="0" (WAI-ARIA roving tabindex), so
   their ring stays. */
:where([tabindex="-1"]):focus { outline: none; }
/* hidden means hidden, also for components that set their own display */
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- utilities for layout: before the components, so a component's own rule wins over them ---------- */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); } .gap-4 { gap: var(--space-4); } .gap-6 { gap: var(--space-6); }
.grow { flex: 1; min-width: 0; }
/* spacing between blocks (DS-31): put .flow on a page or panel body; a section title gets more room above it */
.flow { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--space-4); }
.flow > .section-title:not(:first-child) { margin-top: var(--space-6); }
/* an inner grid whose content can't widen the page (DS-59 rule 6) */
.stack-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--stack-gap, var(--space-4)); }
mark, .mark { background: var(--highlight); color: inherit; padding: 0 1px; }
/* show or hide by breakpoint */
@media (max-width: 759px) { .hide-phone { display: none !important; } }
@media (min-width: 760px) { .show-phone { display: none !important; } }
/* text helpers (v0.4.2): two sizes, the mono font (a case number, a hash), text that keeps its line breaks, user text
   that wraps anywhere (a URL, a hash), the reading width, a list inside a card or an alert */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.mono { font-family: var(--font-mono); }
.pre-line { white-space: pre-line; }
.wrap-anywhere { overflow-wrap: anywhere; }
.measure { max-width: var(--measure); }
/* one line, or cut after one, two or three lines (v0.5.2). The full text stays reachable: a title, the detail page. */
.nowrap { white-space: nowrap; }
.truncate { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.clamp-2, .clamp-3 { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
.bullets { margin: var(--space-1) 0 0; padding-left: var(--space-5); }
.bullets > li + li { margin-top: var(--space-1); }
/* column grids (v0.4.2): two or three columns, one below 760 px; three become two below 1,100 px. .span-all takes a
   whole row. */
.grid-2, .grid-3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-all { grid-column: 1 / -1; }
@media (max-width: 1099px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 759px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
/* (v0.5.2) two columns only from 1,100 px; and as many columns as fit, each at least 220 px wide */
.grid-2.grid-2--from-wide { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .grid-2.grid-2--from-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--space-4); }
/* (v0.5.2) blocks with a hairline between them, the same space above and below each line */
.divided { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); margin: 0; padding: 0;
           list-style: none; }
.divided > * + * { padding-top: var(--space-3); border-top: var(--line) solid var(--border); }
/* (v0.5.2) a form without a box of its own: its controls join the bar or row around it, e.g. a GET form in a filter bar */
.form-contents { display: contents; }
/* (v0.5.2) on paper: a lead-in stays with what follows; a short table or a figure stays on one page */
.keep-next { break-after: avoid; }
.keep-whole { break-inside: avoid; }

/* ---------- type ---------- */
/* The page title speaks the CD's headline voice: heavy italic. It is the only italic in an app. */
.page-title { overflow-wrap: break-word; hyphens: auto; font-size: var(--text-2xl); font-weight: var(--weight-display); font-style: italic;
              letter-spacing: -0.01em; line-height: var(--leading-tight); }
.page-title--lg { font-size: var(--text-3xl); }
/* The "Balken": the title sits on a brand bar (CD 2024, p. 10–12): square, upright, about 1.1 × the type size
   high, about 0.4 em at each end; a wrapped title gets one bar per line. For one title per page. */
.page-title--bar { line-height: 1.3; }
.page-title--bar > .page-title-text, .page-title--bar > span { background: var(--brand); color: var(--brand-on); line-height: 1.1;
                          padding: 0.02em 0.4em 0.06em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.section-title { font-size: var(--text-xl); font-weight: var(--weight-semibold); }
.label-caps { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-caps);
              text-transform: uppercase; color: var(--text-muted); }
/* keys in running text (v0.4.2): <kbd> in a frame; .kbds keeps a group of keys on one line */
kbd, .kbd { display: inline-block; min-width: 1.6em; padding: 0 var(--space-1); border: var(--line) solid var(--border-strong);
            border-bottom-width: 2px; border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
            font-family: var(--font-mono); font-size: var(--text-sm); line-height: var(--leading-tight); text-align: center;
            white-space: nowrap; }
.kbds { white-space: nowrap; }

/* ---------- icons: line icons on a 24-unit grid, in the text colour; always aria-hidden ---------- */
/* <svg class="icon" aria-hidden="true"><use href="ds/icons.svg#icon-search"/></svg> (the set: icons.svg) */
.icon { width: var(--icon); height: var(--icon); flex: none; fill: none; stroke: currentColor;
        stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: var(--icon-sm); height: var(--icon-sm); }

/* ---------- app frame ---------- */
.app-header { background: var(--chrome-bg); color: var(--chrome-text); display: flex; align-items: center;
              gap: var(--space-4); min-height: 56px; padding: 0 var(--gutter); position: relative; }
.app-header :focus-visible, .app-nav :focus-visible { outline-color: var(--chrome-focus); }
/* light chrome: the brand appears as a bar along the top edge, the header itself stays white */
[data-chrome="light"] .app-header, :root:not([data-chrome]) .app-header {
  border-bottom: var(--line) solid var(--border); box-shadow: inset 0 var(--bar) 0 var(--brand); padding-top: var(--bar); }
/* the name may shrink and truncate, so the header actions never leave the screen */
.app-name { position: relative; display: block; min-width: 0; padding: 0 0.1em 0 calc(var(--bar) + var(--space-3));
            margin-right: -0.1em; /* room for the italic overhang inside the clip, without moving what follows */ overflow: hidden; text-overflow: ellipsis; font-size: var(--text-lg); font-weight: var(--weight-display);
            font-style: italic; letter-spacing: -0.01em; white-space: nowrap; color: inherit; text-decoration: none; }
.app-name::before { content: ""; position: absolute; left: 0; top: 50%; translate: 0 -50%; width: var(--bar); height: 1.4em;
                    background: var(--chrome-mark); }
/* in full colour (at 0.85 opacity it fell to 4.57:1); when the header runs short it truncates long before the name */
.app-sub { flex: 0 100 auto; min-width: 0; overflow: hidden; font-size: var(--text-sm); text-overflow: ellipsis;
           white-space: nowrap; }
.app-header .spacer { flex: 1; }
.header-action { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: var(--space-2);
                 height: var(--control-h-sm);
                 padding: 0 var(--space-2); border: 0; background: transparent; color: inherit; cursor: pointer;
                 font-size: var(--text-sm); border-radius: var(--radius-sm); text-decoration: none; position: relative; }
.header-action:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
/* an icon-only header action (DS-5): square; its label stays for screen readers */
.header-action--icon { width: var(--control-h-sm); justify-content: center; padding: 0; }
.header-action--icon > .header-action-label { position: absolute; width: 1px; height: 1px; overflow: hidden;
                                              clip: rect(0 0 0 0); white-space: nowrap; }
/* the slot the bug report component fills (bugreport.js, data-slot), and an action that POSTs (e.g. "Abmelden") in a
   form of its own: neither takes room, so their buttons count as header actions (v0.4.2) */
.header-slot, .header-form { display: contents; }
/* the signed-in person (v0.4.3, D5 A): avatar, name and role from 1,100 px, the avatar alone below (the name stays for
   screen readers); it opens the person menu, which holds every account action (v0.5.3, IDEE-18) */
.header-user { gap: var(--space-2); }
.header-user-text { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; max-width: 16rem; text-align: left;
                    line-height: var(--leading-tight); }
.header-user-name { overflow: hidden; font-weight: var(--weight-semibold); text-overflow: ellipsis; white-space: nowrap; }
.header-user-role { overflow: hidden; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1099px) {
  .header-user-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* the logo slot (DS-62): the brand's logo before the app name with a .vsep between them; the name drops its bar */
.app-brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; color: inherit; text-decoration: none; }
.app-logo { display: block; flex: none; width: auto; height: var(--logo-h); }
.app-brand > .app-name { padding-left: 0; }
.app-brand > .app-name::before { content: none; }
/* the logo on a white field, for a chrome the coloured logo doesn't suit */
.app-logo--framed { box-sizing: content-box; padding: 4px 6px; border-radius: var(--radius-sm); background: var(--surface); }

/* the context switch, e.g. the course (DS-63): two lines and a chevron; opens a .menu. On phones it moves into the
   drawer (DS-64). */
.context-switch { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; min-height: var(--target-min);
                  padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent;
                  color: inherit; text-align: left; cursor: pointer; }
.context-switch:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.context-switch-text { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; line-height: var(--leading-tight); }
.context-switch-code { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-caps); }
.context-switch-name { overflow: hidden; font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }

/* a live status in the header (DS-37): a small mark and its label, role="status". The label stays on phones too
   (principle 3); keep it short there. */
.header-status { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: var(--text-xs);
                 white-space: nowrap; }
.header-status > .status-mark { width: 10px; height: 10px; }
.header-status-label { overflow: hidden; text-overflow: ellipsis; }

.app-nav { background: var(--chrome-bg); color: var(--chrome-text); display: flex; gap: var(--space-1);
           padding: 0 calc(var(--gutter) - var(--space-3)); overflow-x: auto; scrollbar-width: none; }
[data-chrome="light"] .app-nav, :root:not([data-chrome]) .app-nav { border-bottom: var(--line) solid var(--border); }
.app-nav > a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2);
             height: 44px; padding: 0 var(--space-3); position: relative; font-size: var(--text-sm);
             font-weight: var(--weight-medium); white-space: nowrap; }
.app-nav > a[aria-current] { font-weight: var(--weight-bold); }
.app-nav[data-overflow="end"]::after { content: ""; position: sticky; right: 0; flex: none; width: var(--space-8);
  margin-left: calc(-1 * var(--space-8)); background: linear-gradient(to right, transparent, var(--chrome-bg));
  pointer-events: none; }
.app-nav > a[aria-current]::after { content: ""; position: absolute; left: var(--space-3); right: var(--space-3);
                                  bottom: 0; height: var(--bar); background: var(--chrome-nav-mark); }

.page { max-width: var(--content-max); margin: 0 auto; padding: var(--space-6) var(--gutter) var(--space-12); }
/* the head of a page (v0.4.2): the title, a lead line and a meta line, tools on the right. The text column may
   shrink, so a long number or word wraps instead of widening the page; the tools wrap below it when there's no room.
   Put it first in the page's .flow, which spaces it from what follows. */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-6); }
.page-head-main { display: grid; flex: 1 1 24rem; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); min-width: 0; }
.page-head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.page-lead { max-width: var(--measure); color: var(--text-muted); }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); color: var(--text-muted);
             font-size: var(--text-sm); }
/* a work area (v0.4.3, D2): the content and a side column (--aside-w, 320 px, at most 40 %), which stays in view on
   wide screens; below 760 px the side column follows the content. Keep the side column shorter than the screen. */
.work-area { display: grid; grid-template-columns: minmax(0, 1fr) min(var(--aside-w, 320px), 40%); align-items: start;
             gap: var(--space-6); }
.work-area-main, .work-area-aside { min-width: 0; }
@media (min-width: 1100px) { .work-area-aside { position: sticky; top: var(--space-4); } }
/* the side column first (v0.5.2), e.g. filters: on the left from 1,100 px, where it scrolls on its own when it is
   taller than the window; above the content below that */
.work-area.work-area--start { grid-template-columns: minmax(0, 1fr); }
.work-area--start > .work-area-aside { order: -1; }
@media (min-width: 1100px) {
  .work-area.work-area--start { grid-template-columns: min(var(--aside-w, 320px), 40%) minmax(0, 1fr); }
  .work-area--start > .work-area-aside { max-height: calc(100dvh - var(--space-8)); overflow-y: auto; }
}
/* the stage note (DS-57): one line at the foot of every page while an app isn't in production */
.stage-note { padding: var(--space-2) var(--gutter); border-top: var(--line) solid var(--border); background: var(--surface);
              color: var(--text-muted); font-size: var(--text-xs); }
/* a login or PIN page (DS-57): one card in the middle, under the app header */
.auth { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; padding: var(--space-12) var(--gutter); }
.auth > .card { width: 100%; max-width: 400px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
/* a vertical divider between groups in a header or toolbar (DS-4): 24 px, a quarter of the text colour, drawn as a
   border so it stays in Windows high contrast. Mark it aria-hidden. */
.vsep { display: inline-block; flex: none; align-self: center; width: 0; height: 24px;
        border-left: var(--line) solid color-mix(in srgb, currentColor 25%, transparent); }
/* skip link (DS-76): the first focusable element of a page, shown only on focus */
.skip-link { position: absolute; left: var(--space-2); top: var(--space-2); z-index: var(--z-toast); translate: 0 -200%;
             padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-ink);
             color: var(--text-on-ink); font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: none; }
.skip-link:focus-visible { translate: none; outline-color: var(--focus-on-ink); }
/* back link above a page title (DS-69; the sub-page header of DS-37 uses a header action instead) */
.back-link { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--control-h-sm);
             color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
       height: var(--control-h); padding: 0 var(--space-4); border: var(--line) solid transparent;
       border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-semibold);
       line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
       transition: background var(--duration-fast) var(--ease); }
.btn--primary { background: var(--brand); color: var(--brand-on); }
.btn--primary:hover { background: color-mix(in srgb, var(--brand) 88%, var(--text)); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-sunken); }
.btn--quiet { background: transparent; color: var(--text); }
.btn--quiet:hover { background: var(--surface-sunken); }
.btn--danger { background: var(--status-danger); color: var(--status-danger-on); }
.btn--danger:hover { background: color-mix(in srgb, var(--status-danger) 88%, var(--text)); }
.btn--sm { height: var(--control-h-sm); padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn--lg { height: var(--control-h-lg); padding: 0 var(--space-6); font-size: var(--text-md); }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--sm.btn--icon { width: var(--control-h-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field > label, .field-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); }
.input, .select { height: var(--control-h); padding: 0 var(--space-3); border: var(--line) solid var(--border-strong);
                  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
                  font-size: var(--text-sm); min-width: 0; }
.select { appearance: none; padding-right: var(--space-8);
          background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
          background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
/* several lines of text (DS-17): the frame and focus ring of .input, at least two control heights, resizes vertically */
.textarea { display: block; width: 100%; min-width: 0; min-height: calc(2 * var(--control-h));
            padding: var(--space-2) var(--space-3); border: var(--line) solid var(--border-strong);
            border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: var(--text-sm);
            line-height: var(--leading-normal); resize: vertical; }
/* a textarea that grows with its text where the browser can (field-sizing); elsewhere it keeps its rows (v0.4.2) */
.textarea--grow { field-sizing: content; max-height: 60dvh; }
.search { position: relative; display: flex; }
.search .input { width: 100%; padding-left: var(--space-10); }
/* the icon is the field's first svg child, with or without .icon (apps from v0.1 use their own classes) */
.search > svg { position: absolute; left: var(--space-3); top: 50%; translate: 0 -50%; width: var(--icon); height: var(--icon); color: var(--text-muted); }
.search--lg .input { height: var(--control-h-lg); font-size: var(--text-md); }
.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-h-sm); font-size: var(--text-sm);
         cursor: pointer; }
.check > input { width: 18px; height: 18px; accent-color: var(--control-accent); margin: 0; }
/* form states (DS-56a): an invalid field gets the danger border and a message linked with aria-describedby; the
   message carries the ■ mark, so the error is never colour alone. Write "Pflichtfeld" in the label, not just a star. */
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--status-danger); box-shadow: inset 0 0 0 1px var(--status-danger); }
.field-error { display: flex; align-items: flex-start; gap: var(--space-1); color: var(--status-danger-text);
               font-size: var(--text-xs); font-weight: var(--weight-medium); }
.field-error > .status-mark { width: 12px; height: 12px; margin-top: 2px; }
.field-hint { color: var(--text-muted); font-size: var(--text-xs); }
/* fields side by side: their labels line up at the top, whatever message a field shows below */
.field-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-3) var(--space-4); }
/* fields in two equal columns, one below 760 px (v0.4.2); a group that needs the whole row takes .span-all */
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: var(--space-4); }
/* a checkbox whose label wraps (a consent): the box lines up with the first line (v0.4.2) */
.check--wrap { align-items: flex-start; }
.check--wrap > input { margin-top: calc((1lh - 18px) / 2); }
.input:disabled, .select:disabled, .textarea:disabled { background-color: var(--surface-sunken); color: var(--text-muted);
                                                        cursor: not-allowed; }

/* ---------- chips: toggles; tags: static labels ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-h-sm);
        padding: 0 var(--space-3); border: var(--line) solid var(--border-strong); border-radius: var(--radius-sm);
        background: var(--surface); color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-medium);
        cursor: pointer; white-space: nowrap; text-decoration: none; }
.chip:hover { background: var(--surface-sunken); }
.chip .count { color: var(--text-muted); font-weight: var(--weight-regular); font-variant-numeric: tabular-nums; }
/* selected = tint + strong mark + weight (+ the filled square for toggles): never colour alone.
   aria-pressed = one of several toggles (shows a square); aria-checked / aria-current = a single choice (no square) */
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip[aria-current]:not([aria-current="false"]) { background: var(--selected-bg); border-color: var(--selected-mark);
                             box-shadow: inset 0 0 0 1px var(--selected-mark); font-weight: var(--weight-semibold); }
/* toggle chips carry a small square that fills when pressed, so the width never changes */
.chip[aria-pressed]::before { content: ""; width: 12px; height: 12px; flex: none; border: 1.5px solid var(--border-strong);
                              border-radius: 2px; background: var(--surface) center / 10px no-repeat; }
.chip[aria-pressed="true"]::before { border-color: var(--selected-mark); background-color: var(--selected-mark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.6-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
/* a chip that already shows a mark needs no square: tint, border and weight carry the state */
.chip[aria-pressed]:has(> .status-mark, > .category-mark)::before { content: none; }
[data-density="compact"] .chip { padding: 0 var(--space-2); gap: 6px; }   /* text stays --text-sm (DS-26) */
/* one row that scrolls sideways, for phones */
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
/* chips whose text may wrap in narrow places, e.g. example questions (DS-8): auto height, at least the chip height */
.chips--wrap .chip { height: auto; min-height: var(--control-h-sm); padding-top: var(--space-1);
                     padding-bottom: var(--space-1); white-space: normal; text-align: left; }
/* rows that scroll sideways show a fade where more items wait (DS-53); ds.js sets data-overflow. The mask only uses
   alpha, so its colour doesn't matter. */
.chips--scroll[data-overflow="end"], .tabs[data-overflow="end"] {
  -webkit-mask-image: linear-gradient(to right, black calc(100% - var(--space-8)), transparent);
          mask-image: linear-gradient(to right, black calc(100% - var(--space-8)), transparent); }
.chip[aria-pressed="true"] .count, .chip[aria-checked="true"] .count,
.chip[aria-current]:not([aria-current="false"]) .count { color: var(--text); }

.tag { display: inline-flex; align-items: center; gap: var(--space-1); height: 22px; padding: 0 var(--space-2);
       border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--text);
       font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; line-height: 1; }
.tag--brand { background: var(--brand-subtle); color: var(--text); box-shadow: inset var(--bar) 0 0 var(--brand-strong);
              padding-left: calc(var(--space-2) + 2px); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.tag--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
/* on the chrome (ink, brand or light): outlined in the chrome's text colour, where .tag--outline is too faint */
.tag--on-chrome { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor; }
.tag--success { background: var(--status-success-subtle); color: var(--status-success-text); }
.tag--warning { background: var(--status-warning-subtle); color: var(--status-warning-text); }
.tag--danger { background: var(--status-danger-subtle); color: var(--status-danger-text); }
.tag--info { background: var(--status-info-subtle); color: var(--text); }

/* a count on an icon (messages, notifications): a signal, so a circle (DS-52). Write "9+" above nine, so it stays
   round. Its ring takes the colour of the surface it sits on (--badge-ring; the chrome sets it, white on burgundy ink). */
.count-badge { position: absolute; top: 0; right: 0; width: 20px; height: 20px; display: grid;
               grid-template-columns: minmax(0, 1fr); place-items: center; border-radius: var(--radius-round);
               background: var(--status-danger); color: var(--status-danger-on); font-size: var(--text-xs);
               font-weight: var(--weight-bold); line-height: 1; font-variant-numeric: tabular-nums;
               box-shadow: 0 0 0 2px var(--badge-ring, var(--surface)); }
.count-badge--quiet { background: var(--surface-ink); color: var(--text-on-ink); }
[data-chrome="ink"] :is(.app-header, .app-nav) .count-badge--quiet { background: var(--surface); color: var(--text); }
/* next to a label in a list or menu row: in the flow, without a ring */
.count-badge--inline { position: static; box-shadow: none; }
/* a dot: a signal without a number ("new", "changed", a priority) (DS-38). A circle; always with a text alternative,
   e.g. a .visually-hidden word next to it */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: var(--radius-round);
       background: var(--dot-fill, var(--mark-strong)); box-shadow: 0 0 0 2px var(--dot-ring, var(--surface));
       vertical-align: middle; }
/* on a header action, badge and dot sit on the icon's corner; the label moves a little further away */
.header-action:has(> .count-badge) { gap: var(--space-4); }   /* the badge reaches 12 px past the icon, ring included */
.header-action > .count-badge { top: -4px; right: auto; left: calc(var(--space-2) + var(--icon) - 10px); }
.header-action > .dot { position: absolute; top: 4px; right: auto; left: calc(var(--space-2) + var(--icon) - 4px); }
/* an icon-only action: on the corner of its square (after the rules above, so it wins) */
.header-action--icon > .count-badge { left: auto; right: -4px; top: -4px; }
.header-action--icon > .dot { left: auto; right: 6px; top: 6px; }

/* ---------- status: shape + colour + label ---------- */
.status, .category { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm);
                     vertical-align: middle; }
:is(.meta, .stat-label, .item-row-meta, .hit-card-facts, .record-top, .list-item-preview) :is(.status, .category) { font-size: inherit; }
.status-mark, .category-mark { width: 14px; height: 14px; flex: none; display: inline-block; }
.status-mark > svg, .category-mark > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.status-mark .fill-success { fill: var(--status-success); }
.status-mark .fill-warning { fill: var(--status-warning); }
.status-mark .fill-danger { fill: var(--status-danger); }
.status-mark .fill-neutral { fill: var(--mark-ground, var(--surface)); }   /* the ring's inside; transparent on dark surfaces */
.status-mark .fill-info { fill: var(--status-info); }
.status-mark .info-glyph { fill: none; stroke: var(--status-info-on); stroke-width: 1.6; stroke-linecap: round; }
.status-mark .outline, .category-mark .outline { stroke: var(--status-outline); stroke-width: 1.5; }
/* the neutral ring is drawn heavier; here, not inline in map.js, so a strict content security policy keeps it (v0.4.2) */
.status-mark .fill-neutral.outline { stroke-width: 2; }
.status--strong, .category--strong { font-weight: var(--weight-semibold); }
/* categories (not an Ampel): diamonds on the same 14-unit grid, one dark fill, told apart by form.
   The five forms and their markup: CHANGELOG.md (v0.2) and map.js (dsMap.MARKS). */
.category-mark .fill-category { fill: var(--category-fill); }
.category-mark .fill-ground { fill: var(--category-ground); }
/* on dark surfaces the outline turns light, so the marks keep their edge; a category's fill turns light too */
.app-header, .app-nav { --status-outline: var(--chrome-text); --category-fill: var(--chrome-text); --category-ground: transparent;
                         --badge-ring: var(--chrome-badge-ring); --dot-ring: var(--chrome-bg); --dot-fill: var(--chrome-text);
                         --mark-ground: transparent; }
.toast, .tooltip { --status-outline: var(--text-on-ink); --focus: var(--focus-on-ink); --category-fill: var(--text-on-ink);
                   --category-ground: transparent; --mark-ground: transparent; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: var(--line) solid var(--border); border-radius: var(--radius-md); }
.card-pad { padding: var(--space-4) var(--space-5); }
.card--interactive { cursor: pointer; transition: border-color var(--duration-fast) var(--ease); }
.card--interactive:hover { border-color: var(--border-strong); }
/* a head row; it wraps when its parts don't fit, e.g. a title and a segmented switch on a phone (DS-111) */
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
              padding: var(--space-3) var(--space-4); border-bottom: var(--line) solid var(--border); }
/* titles in cards and panel heads (v0.4.2); in a .panel-head the title takes the free room, a note sits at the end */
.card-title, .panel-title { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold);
                            line-height: var(--leading-tight); }
.panel-title { flex: 1 1 auto; min-width: 0; }
.card-sub { color: var(--text-muted); font-size: var(--text-sm); }
.panel-note { color: var(--text-muted); font-size: var(--text-xs); }
/* a card switched off on purpose, not locked (DS-96): a dashed frame, no ground, muted text */
.card--off { border-style: dashed; background: transparent; color: var(--text-muted); }
.divider { border: 0; border-top: var(--line) solid var(--border); margin: 0; }
.sunken { background: var(--surface-sunken); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list.card { overflow: hidden; }
.list.card > :last-child { border-bottom: 0; }
.list-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px var(--space-3); padding: var(--space-3) var(--space-4);
             border-bottom: var(--line) solid var(--border); background: var(--surface); cursor: pointer; }
.list-item:hover { background: var(--surface-hover); }
a.list-item { color: inherit; text-decoration: none; }
.list-item .title { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.list-item .meta { font-size: var(--text-xs); color: var(--text-muted); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); background: var(--surface); }
.table th { text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted);
            letter-spacing: var(--tracking-caps); text-transform: uppercase; padding: var(--space-2) var(--space-3);
            background: var(--surface-sunken); border-bottom: var(--line) solid var(--border-strong); white-space: nowrap; }
.table td { padding: var(--space-3); border-bottom: var(--line) solid var(--border); vertical-align: middle; }
.table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }   /* numbers never wrap (v0.5.2) */
.table tfoot td { font-weight: var(--weight-semibold); border-bottom: 0; border-top: 2px solid var(--border-strong); }
.table tbody tr:hover { background: var(--surface-hover); }
/* a row head in body type (DS-110), e.g. the link to the item: th scope="row" without the column heads' small caps */
.table tbody th[scope="row"] { padding: var(--space-3); border-bottom: var(--line) solid var(--border); background: transparent;
                               color: var(--text); font-size: inherit; font-weight: var(--weight-regular); letter-spacing: 0;
                               text-transform: none; white-space: normal; vertical-align: middle; }
/* column widths on wide screens (v0.4.2): a narrow number, a date field, a name; free text takes the rest */
.table .col-num { width: 3.5rem; }
.table .col-date { width: 11rem; }
.table .col-name { width: 14rem; }
/* (v0.5.2) more widths: the state column (as wide as the item row's), and three general ones */
.table .col-status { width: 176px; }
.table .col-sm { width: 6rem; }
.table .col-md { width: 10rem; }
.table .col-lg { width: 16rem; }
/* (v0.5.2) fixed widths from 1,100 px: the set widths hold, the free column takes the rest, long words break */
@media (min-width: 1100px) {
  .table--fixed { table-layout: fixed; }
  .table--fixed :is(td, th) { overflow-wrap: anywhere; hyphens: auto; }
}
/* (v0.5.2) one line per cell; the table scrolls in its .table-wrap instead. Row heads and .cell-wrap cells wrap. */
.table--nowrap :is(td, th) { white-space: nowrap; }
.table--nowrap tbody th[scope="row"], .table--nowrap .cell-wrap { white-space: normal; min-width: 12rem; }
/* (v0.5.2) a sortable column head: a button in th[aria-sort], with the direction's chevron when sorted. The sorting
   itself is the app's (a link or its script). */
.table-sort { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0; border: 0; background: none;
              color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.table-sort:hover { color: var(--text); text-decoration: underline; }
.table-sort > .icon { width: 14px; height: 14px; }
/* a table with inputs (v0.4.2): cells align at the top, controls fill their cell, a message sits under its control.
   Label each control with aria-labelledby (its column head and its row) or a hidden label. */
.table--inputs td { vertical-align: top; }
.table--inputs tbody th[scope="row"] { padding-top: calc(var(--space-3) + (var(--control-h) - 1lh) / 2); vertical-align: top; }
.table--inputs :is(.input, .select, .textarea) { width: 100%; }
/* a row's status (DS-20): the tint behind the row and, in a cell, the status mark with its label. No bar: the bar
   stays the selection's. */
.table tr.row--success > :is(td, th) { background: var(--status-success-subtle); }
.table tr.row--warning > :is(td, th) { background: var(--status-warning-subtle); }
.table tr.row--danger > :is(td, th) { background: var(--status-danger-subtle); }
.table tr.row--info > :is(td, th) { background: var(--status-info-subtle); }
/* (v0.5.2) a muted row (not counted, inactive), the reason written in the row; a total row inside tbody, since a
   printed tfoot repeats on every page */
.table tr.row--muted > :is(td, th) { color: var(--text-muted); }
.table tr.row--total > :is(td, th) { font-weight: var(--weight-semibold); border-top: 2px solid var(--border-strong); }

/* ---------- key figures (DS-36): a tabular value with a small unit and a muted label ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight);
              font-variant-numeric: tabular-nums; }
.stat-unit { margin-left: 2px; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-muted); }
.stat-label { font-size: var(--text-xs); color: var(--text-muted); }
/* the key-figure bar (DS-105; the apps' look before v0.4, Martin 2026-10-20): each figure with the brand bar in
   front, a large number and its label in small caps. The bar is a border, so it stays in Windows high contrast. */
.stats--strip { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-10); }
.stats--strip > .stat { gap: var(--space-1); padding-left: var(--space-3); border-left: var(--bar) solid var(--brand); }
.stats--strip > .stat > .stat-value { font-size: var(--text-4xl); line-height: 1; }
.stats--strip > .stat > .stat-label { font-weight: var(--weight-semibold); letter-spacing: var(--tracking-caps);
                                      text-transform: uppercase; }
/* a second label is a note to the figure: in normal case */
.stats--strip > .stat > .stat-label ~ .stat-label { font-weight: var(--weight-regular); letter-spacing: normal;
                                                    text-transform: none; }

/* ---------- key-value list (DS-10) on a <dl>: muted keys, values wrap anywhere ---------- */
.kv { display: grid; grid-template-columns: fit-content(var(--kv-key-w, 40%)) minmax(0, 1fr); gap: var(--space-1) var(--space-4);
      margin: 0; font-size: var(--text-sm); }
/* labels above their values, for a narrow panel (v0.4.2); --kv-key-w sets the key column's widest (default 40 %) */
.kv--stack { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
.kv--stack > dt:not(:first-child) { margin-top: var(--space-2); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- empty state (DS-19): nothing to show, and what to do instead ---------- */
.empty-state { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: var(--space-2);
               padding: var(--space-6); border: var(--line) solid var(--border); border-radius: var(--radius-md);
               background: var(--surface); }
.empty-state-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: var(--space-1); border-bottom: var(--line) solid var(--border); overflow-x: auto; scrollbar-width: none; }
/* a link, or a button for tabs that switch panels in the page: the button's frame, ground and font go (DS-99) */
.tab { display: inline-flex; align-items: center; gap: var(--space-2); height: 44px; padding: 0 var(--space-3);
       position: relative; border: 0; background: transparent; color: var(--text); font-family: inherit;
       font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: none; white-space: nowrap;
       cursor: pointer; }
.tab .count { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"], .tab[aria-current]:not([aria-current="false"]) { font-weight: var(--weight-bold); }
.tab[aria-selected="true"]::after, .tab[aria-current]:not([aria-current="false"])::after { content: ""; position: absolute; left: var(--space-3); right: var(--space-3);
                                    bottom: -1px; height: var(--bar); background: var(--selected-mark); }

/* ---------- segmented switch (e.g. Karte | Liste) ---------- */
.segmented { display: inline-flex; border: var(--line) solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented > button { border: 0; background: transparent; height: var(--control-h-sm); padding: 0 var(--space-4);
                    font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; }
.segmented > button + button { border-left: var(--line) solid var(--border-strong); }
.segmented > button[aria-pressed="true"] { background: var(--surface-ink); color: var(--text-on-ink); font-weight: var(--weight-semibold); }
/* segments as links between pages (DS-15): the current page is the pressed segment */
.segmented > a { display: inline-flex; align-items: center; height: var(--control-h-sm); padding: 0 var(--space-4); color: var(--text);
               font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: none; }
.segmented > a + a { border-left: var(--line) solid var(--border-strong); }
.segmented > a[aria-current]:not([aria-current="false"]) { background: var(--surface-ink); color: var(--text-on-ink);
                                                         font-weight: var(--weight-semibold); }

/* a focus ring inside a container that clips or scrolls sits inside its control, so it isn't cut off */
:is(.segmented, .tabs, .app-nav, .chips--scroll, .nav-list, .split-list) :focus-visible { outline-offset: -2px; }
.segmented > :is([aria-pressed="true"], [aria-current]):focus-visible { outline-color: var(--focus-on-ink); }

/* ---------- progress: a bar, literally ---------- */
.progress { height: 6px; background: var(--surface-sunken); position: relative; overflow: hidden; }
.progress > .progress-value, .progress > span { position: absolute; inset: 0 auto 0 0; background: var(--selected-mark); }
/* a level (v0.5.2): three or five upright bars filled up to the level, always with the word beside it. Neither a
   status nor progress; upright, so a step doesn't read as the danger square. */
.level { display: inline-flex; align-items: center; gap: var(--space-2); }
.level-steps { display: inline-flex; align-items: flex-end; gap: 2px; }
.level-step { width: 6px; height: 14px; background: var(--chart-band); }
.level-step.is-on { background: var(--selected-mark); }

/* ---------- messages ---------- */
.alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-3); padding: var(--space-3) var(--space-4);
         border-radius: var(--radius-bar); font-size: var(--text-sm); background: var(--status-info-subtle);
         box-shadow: inset var(--bar) 0 0 var(--status-info); }
.alert--success { background: var(--status-success-subtle); box-shadow: inset var(--bar) 0 0 var(--status-success); }
.alert--warning { background: var(--status-warning-subtle); box-shadow: inset var(--bar) 0 0 var(--status-warning-text); }
.alert--danger { background: var(--status-danger-subtle); box-shadow: inset var(--bar) 0 0 var(--status-danger); }
/* an alert's heading line, before its text and a .bullets list (v0.4.2) */
.alert-title { font-weight: var(--weight-semibold); }
/* a status line (DS-35): one row, smaller; status tones only */
.alert--compact { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); }
.toast { background: var(--surface-ink); color: var(--text-on-ink); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
         box-shadow: var(--shadow-overlay); font-size: var(--text-sm); max-width: 360px; }
.toast .toast-head { font-size: var(--text-xs); opacity: 0.8; }
/* toasts appear here: bottom center, one at a time (DS-74; ds.toast() in ds.js). Put one empty region in the page
   frame, so screen readers announce what arrives. */
.toast-region { position: fixed; left: 50%; bottom: var(--gutter); translate: -50% 0; z-index: var(--z-toast);
                width: max-content; max-width: calc(100vw - 2 * var(--gutter)); }
.tooltip { background: var(--surface-ink); color: var(--text-on-ink); border-radius: var(--radius-sm); padding: var(--space-1) var(--space-2);
           font-size: var(--text-xs); box-shadow: var(--shadow-overlay); white-space: nowrap; }

/* ---------- menus (DS-6): a native popover opened by a button with popovertarget, which gives open/close, Esc,
   outside click and focus return. It opens below its button (ds.js places it; without ds.js it opens centred). It
   lives in the top layer but inherits from the header, so it resets the chrome's colours. ---------- */
.menu { min-width: 220px; max-width: min(320px, calc(100vw - 2 * var(--gutter))); margin: 0; padding: var(--space-1);
        border: var(--line) solid var(--border); border-radius: var(--radius-md); background: var(--surface);
        color: var(--text); box-shadow: var(--shadow-overlay); font-size: var(--text-sm);
        --status-outline: var(--text); --category-fill: var(--surface-ink); --category-ground: var(--surface);
        --badge-ring: var(--surface); --dot-ring: var(--surface); --dot-fill: var(--mark-strong); }
.app-header .menu :focus-visible, .app-nav .menu :focus-visible, .menu :focus-visible { outline-color: var(--focus); }
.menu > .label-caps { padding: var(--space-2) var(--space-3) var(--space-1); }
.menu > .divider { margin: var(--space-1) 0; }
/* the person menu's head (v0.5.3): who is signed in, under its "Angemeldet als". The whole name wraps, the role goes
   below it; on phones the header shows only the avatar, so this is where the name can be read */
.menu-user { display: grid; grid-template-columns: minmax(0, 1fr); padding: 0 var(--space-3) var(--space-2);
             line-height: var(--leading-tight); overflow-wrap: anywhere; }
.menu-user-name { font-weight: var(--weight-semibold); }
.menu-user-role { color: var(--text-muted); font-size: var(--text-xs); }
.menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: var(--control-h);
             padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent;
             color: inherit; font-size: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.menu-item:hover { background: var(--surface-sunken); }
/* the current or chosen item: the Balken and the tint, plus weight */
.menu-item[aria-current]:not([aria-current="false"]), .menu-item[aria-pressed="true"] {
  background: var(--selected-bg); box-shadow: inset var(--bar) 0 0 var(--selected-mark); font-weight: var(--weight-semibold);
  border-top-left-radius: var(--radius-bar); border-bottom-left-radius: var(--radius-bar); }

/* ---------- overlays ---------- */
.popover { background: var(--surface); border: var(--line) solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); }
.sheet { background: var(--surface); border-radius: var(--radius-md) var(--radius-md) 0 0; box-shadow: var(--shadow-overlay); }
.sheet-handle { width: 40px; height: 4px; background: var(--handle); margin: var(--space-2) auto; }

/* ---------- lists of items ---------- */
/* an item with a type, a title, its state and actions (DS-66): the state and action columns have fixed widths, so the
   marks line up from row to row (principle 3). Set them per list with --item-state-w and --item-actions-w. On phones
   the title is a stretched link (the row is the action) and the buttons go. */
.item-row { position: relative; display: grid; align-items: center; gap: var(--space-2) var(--space-4);
            grid-template-columns: auto minmax(0, 1fr) var(--item-state-w, 176px) var(--item-actions-w, 176px);
            padding: var(--space-3) var(--space-4); border-bottom: var(--line) solid var(--border); background: var(--surface); }
/* a block, so a title that wraps takes its own line height, not the row's */
.item-row-title { display: block; color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: none; }
.item-row-title:hover { text-decoration: underline; }
.item-row-meta { color: var(--text-muted); font-size: var(--text-xs); }
.item-row-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.item-row.is-locked .item-row-title, .item-row.is-locked .item-row-meta { color: var(--text-muted); }
/* in a narrow list the title is a stretched link (the row opens the item) and the buttons go; put item rows in .list */
.list:has(> .item-row) { container-type: inline-size; }
@container (max-width: 759px) {
  .item-row { grid-template-columns: auto minmax(0, 1fr); }
  .item-row-state { grid-column: 2; }
  .item-row-actions { display: none; }
  .item-row-title::after { content: ""; position: absolute; inset: 0; }
}
/* a start-page tile (DS-65): an icon field, a label, one line, a count as a tag in the corner; 4 per row, 2 on phones */
.tiles { display: grid; gap: var(--space-3);
         grid-template-columns: repeat(auto-fill, minmax(max(130px, calc((100% - 3 * var(--space-3)) / 4)), 1fr)); }
.tile { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: var(--space-2);
        min-width: 0;   /* shrinks in its grid cell, so a long German word wraps (v0.4.2) */
        padding: var(--space-4); border: var(--line) solid var(--border); border-radius: var(--radius-md);
        background: var(--surface); color: var(--text); text-decoration: none; }
.tile:hover { border-color: var(--border-strong); }
.tile:hover .tile-label { text-decoration: underline; }
.tile-label { font-weight: var(--weight-semibold); overflow-wrap: break-word; hyphens: auto; }
.tile-text { color: var(--text-muted); font-size: var(--text-xs); }
.tile > .tag { position: absolute; top: var(--space-3); right: var(--space-3); }
/* a dense list item with a lead figure (DS-29): two lines, about 60 px; the figure is a .stat at the end */
.list-item--dense { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-3);
                    min-height: 60px; padding: var(--space-2) var(--space-4); }
.list-item--dense > .lead { grid-row: 1 / span 2; grid-column: 2; }
.lead { align-items: flex-end; text-align: right; }
.lead > .stat-value { font-size: var(--text-lg); }
/* a list item that is a button: no button look */
button.list-item { width: 100%; border: 0; border-bottom: var(--line) solid var(--border); color: inherit; font: inherit;
                   text-align: left; }
/* a search hit (DS-12): title, kind and facts, a flag, snippets with the hits marked, page jumps and a foot */
.hit-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3) var(--space-4);
            border: var(--line) solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.hit-card-title { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); }
a.hit-card-title, .hit-card-title > a { color: var(--link); text-decoration: none; }
a.hit-card-title:hover, .hit-card-title > a:hover { text-decoration: underline; }
.hit-card-facts .status { color: var(--text); }
.hit-card-facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); color: var(--text-muted);
                  font-size: var(--text-xs); }
.hit-card-snippet { font-size: var(--text-sm); hyphens: auto; }
.hit-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); font-size: var(--text-xs); }
.hit-card-jump { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--link); font-size: var(--text-sm);
                 font-weight: var(--weight-semibold); }
/* a table row as a card, for lists of cards (DS-75): top line, title as a stretched link, facts, a foot whose buttons
   sit above the link */
.record { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2);
          padding: var(--space-3) var(--space-4); border: var(--line) solid var(--border); border-radius: var(--radius-md);
          background: var(--surface); }
.record:hover { border-color: var(--border-strong); }
.record-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--text-xs); }
.record-title { color: var(--text); font-weight: var(--weight-semibold); text-decoration: none; }
.record-title::after { content: ""; position: absolute; inset: 0; }
.record-foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* a list with a reading pane (DS-68): side by side when the container is wide enough, the list alone when not (the
   app then opens the item as its own page). A container query, so it works in any column. */
.split { container-type: inline-size; }
.split-body { display: grid; grid-template-columns: minmax(0, 1fr); border: var(--line) solid var(--border);
              border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.split-list { min-width: 0; }
.split-pane { display: none; min-width: 0; padding: var(--space-5); border-left: var(--line) solid var(--border); }
.list-item-preview { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                     color: var(--text-muted); font-size: var(--text-xs); }
@container (min-width: 760px) {
  .split-body { grid-template-columns: clamp(300px, 35%, 400px) minmax(0, 1fr); }
  .split-pane { display: block; }
}

/* ---------- content ---------- */
/* a disclosure (DS-9) on <details>: the chevron turns when it opens; framed, as a control, or plain */
.disclosure > summary { list-style: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure-teaser { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-h-sm); cursor: pointer;
                     font-weight: var(--weight-medium); }
.disclosure-teaser > .icon { transition: rotate var(--duration-fast) var(--ease); }
.disclosure[open] > .disclosure-teaser > .icon { rotate: 90deg; }
.disclosure-body { padding: var(--space-2) 0 var(--space-2) calc(var(--icon-sm) + var(--space-2)); }
/* --flush: the body starts at the left edge, e.g. a table under a chart (v0.4.2) */
.disclosure--flush > .disclosure-body { padding-left: 0; }
.disclosure--framed { border: var(--line) solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.disclosure--framed > .disclosure-teaser { min-height: var(--control-h); padding: 0 var(--space-4); }
.disclosure--framed > .disclosure-body { padding: 0 var(--space-4) var(--space-4); }
.disclosure--control > .disclosure-teaser { display: inline-flex; padding: 0 var(--space-3); border: var(--line) solid var(--border-strong);
                                            border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); }
/* a copy field (DS-11): a label, a value in the mono font, a copy button; ds.js copies and confirms in the toast */
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-1) var(--space-3);
              padding: var(--space-3) var(--space-4); border: var(--line) solid var(--border); border-radius: var(--radius-md);
              background: var(--surface); }
.copy-field > .field-label { grid-column: 1 / -1; }
.copy-value { font-family: var(--font-mono); font-size: var(--text-xs); overflow-wrap: anywhere; }
/* a stepper (DS-14): a value between two quiet buttons, e.g. the page or the zoom; a reached end is aria-disabled */
.stepper { display: inline-flex; align-items: center; gap: var(--space-1); }
.stepper-value { min-width: 7ch; font-size: var(--text-sm); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; text-align: center; }
/* a page sheet (DS-16): white paper in every theme, a hairline edge, 100 % = A4 at 96 dpi; .paper--text for text */
.paper-stage { overflow: auto; padding: var(--space-4); background: var(--surface-sunken); }
.paper { width: 100%; max-width: var(--paper-max); margin: 0 auto; background: var(--paper); color: var(--on-paper);
         outline: var(--line) solid var(--paper-edge); }
.paper > img { display: block; width: 100%; height: auto; }
.paper--text { padding: var(--space-12) var(--space-12); font-size: var(--text-md); line-height: var(--leading-normal); }
.paper--text > * + * { margin-top: var(--space-3); }
.paper-stage.is-zoomed > .paper { width: calc(var(--paper-max) * var(--zoom, 1.5)); max-width: none; }
/* feedback (DS-18): a question and two buttons with line icons and labels (no emoji), then the thanks or a form */
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4);
            border: var(--line) solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: var(--text-sm); }
.feedback-thanks { display: flex; align-items: center; gap: var(--space-2); }
.feedback-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); width: 100%; }
/* running text (DS-27): 16 px in any density, the reading width, spacing for headings and lists */
.prose { max-width: var(--measure); font-size: var(--text-md); line-height: var(--leading-normal); }
.prose > * + * { margin-top: var(--space-3); }
.prose > h2, .prose > h3 { margin-top: var(--space-6); }
.prose > h2 { font-size: var(--text-xl); }
.prose > h3 { font-size: var(--text-lg); }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: var(--space-6); }
.prose li + li { margin-top: var(--space-1); }
/* a quotation (v0.4.2) on <blockquote>: a grey rule, not the Balken (which marks titles and the selection), upright
   text; the source in a .quote-source line */
.quote { margin: 0; padding-left: var(--space-4); border-left: calc(2 * var(--line)) solid var(--border-strong); }
.quote-source { margin-top: var(--space-1); color: var(--text-muted); font-size: var(--text-sm); }
/* preformatted text (DS-97): a prompt, raw output, a log, a screen-reader preview. It wraps and scrolls past 24 lines. */
.code-block { max-height: 24lh; margin: 0; padding: var(--space-3) var(--space-4); overflow: auto; border-radius: var(--radius-sm);
              background: var(--surface-sunken); color: var(--text); font-family: var(--font-mono); font-size: var(--text-xs);
              line-height: var(--leading-normal); white-space: pre-wrap; overflow-wrap: anywhere; }
/* a legend (DS-33) on <details>, so phones can fold it: marks with labels and counts, a basis switch, a foot */
.legend { padding: var(--space-3);
          border: var(--line) solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: var(--text-sm); }
/* <details> puts everything after the summary into one box, so the space between parts is a margin, not a gap */
.legend > * + * { margin-top: var(--space-2); }
.legend > summary { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; font-weight: var(--weight-semibold);
                    list-style: none; }
.legend > summary::-webkit-details-marker { display: none; }
.legend > summary > .icon { transition: rotate var(--duration-fast) var(--ease); }
.legend[open] > summary > .icon { rotate: 90deg; }
.legend-list { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); margin: 0;
               padding: 0; list-style: none; }
.legend-list > li { display: contents; }
.legend-count { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.legend-list--tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.legend-foot { color: var(--text-muted); font-size: var(--text-xs); }
/* a table frame (DS-34), and a table that stacks into one block per row below 760 px: the first cell becomes the
   title, the others show their column name from data-label */
.table-wrap { overflow-x: auto; border: var(--line) solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.table-wrap > .table:not(:has(> tfoot)) > tbody > tr:last-child > :is(td, th) { border-bottom: 0; }
/* (v0.5.2) a table that scrolls in its frame, at most 70 % of the window high, with its head and total row in view.
   A sticky cell loses its border, so the total row's rule is a shadow. */
.table-wrap--scroll { max-height: 70dvh; overflow: auto; }
.table-wrap--scroll > .table > thead th { position: sticky; top: 0; z-index: 1; }
.table-wrap--scroll > .table > tfoot td { position: sticky; bottom: 0; background: var(--surface);
                                          box-shadow: inset 0 2px 0 var(--border-strong); }

/* ---------- filters (DS-7, DS-13, DS-28) ---------- */
/* a group of filter chips with its label (role="group" + aria-labelledby); --inline puts them on one line */
.chip-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
.chip-group--inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* square chips, e.g. page jumps */
.chip--square { justify-content: center; min-width: var(--control-h-sm); padding: 0; font-variant-numeric: tabular-nums; }
[data-density="compact"] .chip--square { padding: 0; }
/* the filter bar: rows of groups and fields; --one-row on wide screens; on phones it folds behind "Filter (n aktiv)" */
.filter-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3) var(--gutter);
              border-bottom: var(--line) solid var(--border); background: var(--surface); }
.filter-bar-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); }
@media (min-width: 1100px) {
  .filter-bar--one-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); }
}
.filter-bar .select { width: auto; min-width: 160px; max-width: 100%; }
.filter-bar .input, .filter-bar .search { width: 240px; max-width: 100%; }
/* (v0.5.2) short fields: about six characters (a postcode, a year, days), or the field's own width (a date) */
.input.input--short, .filter-bar .input.input--short { width: calc(6ch + 2 * var(--space-3) + 2 * var(--line)); }
.input.input--auto, .filter-bar .input.input--auto { width: auto; }
.filter-toggle { display: none; justify-self: start; }

/* ---------- forms, continued (DS-56) ---------- */
/* a radio group on <fieldset>: the native radio stays round (principle 5) */
.radio-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); min-width: 0; margin: 0; padding: 0; border: 0; }
.radio-group > legend { margin-bottom: var(--space-1); padding: 0; color: var(--text-muted); font-size: var(--text-xs);
                        font-weight: var(--weight-semibold); }
/* the choices in one row, e.g. Ja / Nein in a table cell (v0.4.2) */
.radio-group--inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); }
/* a honeypot field for public forms (v0.4.2): out of sight. Give its input tabindex="-1" and autocomplete="off" and its
   wrapper aria-hidden="true", so neither keyboard nor screen-reader users meet it */
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- files (v0.4.4, D3): a drop zone and a list of files ---------- */
/* a drop zone on a <label>: the file input lies invisible over the whole zone, so a click, the keyboard and a drop all
   reach the browser's own file picker without a script; a .btn-styled span ("Dateien wählen") is its visible face.
   ds.js adds the drag-over state (.is-over) and names the chosen files in .drop-zone-hint. */
.drop-zone { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--space-2);
             padding: var(--space-8) var(--space-4); border: 2px dashed var(--border-strong); border-radius: var(--radius-md);
             background: var(--surface); color: var(--text); font-size: var(--text-sm); text-align: center; cursor: pointer; }
.drop-zone > .icon { width: var(--icon-lg); height: var(--icon-lg); color: var(--text-muted); stroke-width: var(--icon-stroke-lg); }
.drop-zone-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.drop-zone-hint { color: var(--text-muted); font-size: var(--text-xs); }
.drop-zone:hover, .drop-zone.is-over { border-color: var(--selected-mark); background: var(--selected-bg); }
.drop-zone:has(> .drop-zone-input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop-zone:has(> .drop-zone-input:disabled) { opacity: 0.45; cursor: not-allowed; }
/* a file in a .list: its icon, the name with a meta line, the state (a status, or a progress bar with its value as
   text) and an action. The state column has a set width (--file-state-w), so the marks line up; below 760 px the
   state moves under the name. */
.file-item { display: grid; grid-template-columns: auto minmax(0, 1fr) var(--file-state-w, 200px) auto;
             grid-template-areas: "icon name state action"; align-items: center; gap: var(--space-1) var(--space-3);
             padding: var(--space-3) var(--space-4); border-bottom: var(--line) solid var(--border); background: var(--surface); }
.file-item > .icon { grid-area: icon; color: var(--text-muted); }
.file-item-name { display: grid; grid-area: name; grid-template-columns: minmax(0, 1fr); min-width: 0; font-size: var(--text-sm);
                  font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.file-item-meta { color: var(--text-muted); font-size: var(--text-xs); font-weight: var(--weight-regular); }
.file-item > :is(.status, .file-item-progress) { grid-area: state; }
.file-item > .btn { grid-area: action; }
.file-item-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2);
                      color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
/* a switch: a square track and knob (principle 5) and a state label next to it; ds.js keeps the label current */
.switch { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-h-sm); font-size: var(--text-sm);
          cursor: pointer; }
.switch > input { position: relative; flex: none; width: 36px; height: 20px; margin: 0; border: var(--line) solid var(--border-strong);
                  background: var(--surface); cursor: pointer; appearance: none; }
.switch > input::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--border-strong);
                          transition: translate var(--duration-fast) var(--ease); }
.switch > input:checked { border-color: var(--control-accent); background: var(--control-accent); }
.switch > input:checked::before { translate: 16px 0; background: var(--surface); }
.switch-state { color: var(--text-muted); font-size: var(--text-xs); }
/* loading: a text line and a bar, never a spinner (principle 5); mark the busy region with aria-busy */
.loading { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--text-sm); }
.progress--indeterminate > .progress-value { width: 30%; animation: ds-indeterminate 1.4s var(--ease) infinite; }
@keyframes ds-indeterminate { from { left: -30%; } to { left: 100%; } }
.btn[aria-busy="true"] { cursor: progress; }

/* ---------- overlays on <dialog> (DS-30, DS-56d, DS-64, DS-70): showModal() keeps the focus inside, Esc closes,
   the focus returns to the button that opened it, and ::backdrop is the scrim. ds.js adds data-dialog-open and
   data-dialog-close buttons and closes drawers and sheets on a click on the scrim. ---------- */
.dialog, .drawer, .side-sheet { padding: 0; border: 0; background: var(--surface); color: var(--text);
                                box-shadow: var(--shadow-overlay); }
.dialog::backdrop, .drawer::backdrop, .side-sheet::backdrop { background: var(--scrim); }
/* a dialog: a decision or a short form in the middle of the page; a sheet from below on phones */
.dialog { width: min(560px, calc(100vw - 2 * var(--gutter))); max-height: calc(100dvh - 2 * var(--gutter));
          border: var(--line) solid var(--border); border-radius: var(--radius-md); }
.dialog[open], .drawer[open], .side-sheet[open] { display: flex; flex-direction: column; }
.overlay-head { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: 0 var(--space-2) 0 var(--space-5);
                border-bottom: var(--line) solid var(--border); }
.overlay-title { flex: 1; min-width: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.overlay-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--space-5); }
.overlay-head, .overlay-foot { flex: none; }
.overlay-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5);
                border-top: var(--line) solid var(--border); }
/* the phone menu (DS-64): a drawer from the left, its head in the chrome colour */
.drawer { width: var(--drawer-w); max-width: none; height: 100dvh; max-height: none; margin: 0; inset: 0 auto 0 0; }
.drawer > .overlay-head { background: var(--chrome-bg); color: var(--chrome-text); border-bottom-color: transparent;
                          --status-outline: var(--chrome-text); --focus: var(--chrome-focus); }
.drawer > .overlay-body { padding: var(--space-2) 0; }
.drawer > .overlay-foot { justify-content: flex-start; }
.drawer .context-switch { width: 100%; justify-content: space-between; padding: 0 var(--space-4); }
/* a side sheet (DS-70, the assistant panel): from the right on wide screens, from below on phones */
.side-sheet { width: min(var(--sheet-w), 100vw); max-width: none; height: 100dvh; max-height: none; margin: 0; inset: 0 0 0 auto; }
.side-sheet > .sheet-handle { display: none; }

/* a navigation list (DS-64, DS-67): the current item carries the Balken and the tint */
.nav-list { margin: 0; padding: 0; list-style: none; }
.nav-item { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-h); padding: 0 var(--space-4);
            color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: none; }
.nav-item:hover { background: var(--surface-hover); }
.nav-item .count { margin-left: auto; color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.nav-item[aria-current]:not([aria-current="false"]) { background: var(--selected-bg); box-shadow: inset var(--bar) 0 0 var(--selected-mark);
                                                     font-weight: var(--weight-semibold); }

/* a detail panel (DS-30): a head, a body that scrolls and a pinned row of actions; below 760 px it becomes a sheet at
   the bottom of the screen that leaves the page usable (not modal), with the handle as decoration */
.detail-panel { display: flex; flex-direction: column;
                max-height: 100%; min-height: 0; border: var(--line) solid var(--border); border-radius: var(--radius-md);
                background: var(--surface); }
.detail-panel > .sheet-handle { display: none; }

/* section navigation (DS-67): a sticky list of the page's sections with counts; ds.js marks the one in view */
.section-nav { position: sticky; top: var(--space-4); align-self: start; }

/* tabs that don't fit (DS-73): the app moves the last ones into a "Mehr" menu after the tablist */
.tabs-wrap { display: flex; align-items: flex-end; gap: var(--space-1); border-bottom: var(--line) solid var(--border); }
.tabs-wrap > .tabs { flex: 1; min-width: 0; border-bottom: 0; }
.tabs-more { border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--text-sm);
             font-weight: var(--weight-medium); cursor: pointer; }

/* ---------- records (v0.4.5, D3): a timeline, a case track, comments, a mail row, numbered steps ---------- */
/* a timeline on <ol>: one event per row, the time, the status mark of what it meant, what happened and who. The mark
   is aria-hidden, so the text says what the mark says (principle 3). A longer detail folds into a .disclosure in
   .timeline-what. Below 760 px the time moves above the text. */
.timeline { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.timeline-item { display: grid; grid-template-columns: var(--timeline-time-w, 7rem) auto minmax(0, 1fr);
                 grid-template-areas: "time mark what"; align-items: start; gap: var(--space-1) var(--space-3);
                 font-size: var(--text-sm); }
.timeline-time { grid-area: time; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline-item > .status-mark { grid-area: mark; margin-top: calc((1lh - 14px) / 2); }
.timeline-what { grid-area: what; min-width: 0; overflow-wrap: anywhere; }
.timeline-who { display: block; color: var(--text-muted); font-size: var(--text-xs); }
/* (v0.5.2) date and time on one line ("26.10.2026, 23:08"), for apps whose CSP drops an inline --timeline-time-w */
.timeline--datetime { --timeline-time-w: 9.5rem; }
/* a case track on <ol>: done steps carry the Balken and a tick, the current one (aria-current="step") also the tint,
   the steps ahead are muted; a hidden word says "erledigt". Below 760 px it is a list with the bar on the left.
   Not the pager (.stepper). */
.track { display: flex; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.track-step { display: flex; flex: 1 1 0; align-items: center; gap: var(--space-1); min-width: 0; padding: var(--space-2) var(--space-3);
              border-bottom: var(--bar) solid var(--border); color: var(--text-muted); font-size: var(--text-sm); }
.track-step.is-done { border-bottom-color: var(--selected-mark); color: var(--text); }
.track-step[aria-current]:not([aria-current="false"]) { border-bottom-color: var(--selected-mark); background: var(--selected-bg);
                                                       color: var(--text); font-weight: var(--weight-semibold); }
/* comments: the avatar (people are circles), the name and the time, then the text, which keeps its line breaks */
.comments { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.comment { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-3); font-size: var(--text-sm); }
.comment-meta { color: var(--text-muted); font-size: var(--text-xs); }
.comment-author { color: var(--text); font-weight: var(--weight-semibold); }
.comment-body { margin-top: var(--space-1); white-space: pre-line; overflow-wrap: anywhere; }
/* a mail on a framed .disclosure: the subject, then recipient and time, a status if the app has one; the plain-text
   body below */
.mail > .disclosure-teaser { flex-wrap: wrap; gap: var(--space-1) var(--space-3); padding-block: var(--space-2); }
.mail-subject { flex: 1 1 12rem; min-width: 0; font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.mail-meta { margin-left: auto; color: var(--text-muted); font-size: var(--text-xs); font-weight: var(--weight-regular); }
.mail-body { white-space: pre-line; overflow-wrap: anywhere; }
/* numbered steps on <ol>, e.g. "So geht es weiter": the number in a square field (a colour area, so square) */
.steps-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); margin: 0; padding: 0; list-style: none;
              counter-reset: steps; }
.steps-list > li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-3);
                   counter-increment: steps; }
.steps-list > li::before { content: counter(steps); display: flex; align-items: center; justify-content: center; width: 28px;
                           height: 28px; background: var(--brand-subtle); color: var(--text); font-size: var(--text-sm);
                           font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }

/* ---------- the assistant (DS-70 to DS-72) ---------- */
/* chat bubbles: frames with 8 px corners, never pills */
.bubble { max-width: 85%; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-sm);
          overflow-wrap: anywhere; }
.bubble--assistant { justify-self: start; background: var(--surface-sunken); }
.bubble--me { justify-self: end; background: var(--brand-subtle); }
.chat { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.chat-input { display: flex; align-items: flex-end; gap: var(--space-2); }
.chat-input > .textarea { flex: 1; min-height: var(--control-h); }
.assistant-note { color: var(--text-muted); font-size: var(--text-xs); }
/* the welcome view (DS-71): a greeting, the context with the Balken as a line, what it can do, example questions */
.assistant-welcome { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.assistant-context { padding: var(--space-1) 0 var(--space-1) var(--space-3); box-shadow: inset var(--bar) 0 0 var(--selected-mark);
                     font-size: var(--text-sm); }
.capability { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-3);
              font-size: var(--text-sm); }
/* the label next to the floating button (DS-72, NAIMA option A) */
.assistant-label { position: fixed; right: calc(var(--gutter) + 56px + var(--space-3)); bottom: calc(var(--gutter) + 12px);
                   z-index: var(--z-float); padding: var(--space-1) var(--space-3); border-radius: var(--radius-sm);
                   background: var(--surface-ink); color: var(--text-on-ink); font-size: var(--text-sm);
                   font-weight: var(--weight-semibold); box-shadow: var(--shadow-overlay); }
/* an icon in a square field (DS-65, DS-71, DS-72): a colour area, so square. The assistant's icon sits in one
   everywhere except the floating button and its own panel, which keep the circle (Martin, 2026-10-09). */
.icon-field { display: inline-grid; flex: none; grid-template-columns: minmax(0, 1fr); place-items: center;
              width: 48px; height: 48px; background: var(--brand-subtle); color: var(--brand-strong); }
.icon-field > .icon { width: var(--icon-lg); height: var(--icon-lg); stroke-width: var(--icon-stroke-lg); }
.icon-field--sm { width: 36px; height: 36px; }
.icon-field--sm > .icon { width: var(--icon); height: var(--icon); stroke-width: var(--icon-stroke); }
.icon-field--lg { width: 56px; height: 56px; }
.icon-field--ink { background: var(--surface-ink); color: var(--brand-bright); }

/* ---------- people: circles ---------- */
.avatar { width: 32px; height: 32px; border-radius: var(--radius-round); display: inline-grid;
          grid-template-columns: minmax(0, 1fr); place-items: center;
          background: var(--surface-sunken); color: var(--text); font-size: var(--text-xs); font-weight: var(--weight-semibold); flex: none; }
.avatar--brand { background: var(--brand); color: var(--brand-on); }
.avatar--sm { width: 22px; height: 22px; }   /* in dense rows and chat heads (DS-38); initials stay 12 px */
/* the assistant's avatar in its own panel: the circle with the brand ring (DS-70) */
.avatar--assistant { width: 36px; height: 36px; background: var(--surface-ink); color: var(--text-on-ink);
                     box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
/* the assistant is a "someone", so it is a circle too */
.assistant-button { position: fixed; right: var(--gutter); bottom: var(--gutter); width: 56px; height: 56px;
                    border-radius: var(--radius-round); border: 0; background: var(--surface-ink); color: var(--text-on-ink);
                    box-shadow: var(--shadow-overlay); display: grid; grid-template-columns: minmax(0, 1fr);
                    place-items: center; cursor: pointer; z-index: var(--z-float); }
.assistant-button::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; box-shadow: 0 0 0 3px var(--brand); }
.assistant-button:focus-visible { outline-offset: 8px; }

/* ---------- states: after every component, so they win over the components' own backgrounds and corners ---------- */
/* selection marks a card or row with the Balken on its left edge, plus the tint */
.is-selected { background: var(--selected-bg); box-shadow: inset var(--bar) 0 0 var(--selected-mark); border-color: var(--selected-mark);
               border-top-left-radius: var(--radius-bar); border-bottom-left-radius: var(--radius-bar); }
.is-selected:hover { background: var(--selected-bg); }

/* ---------- phones (below 760 px): after every component, so these win over their base rules ---------- */
@media (max-width: 759px) {
  /* the header keeps one row: the subtitle goes, the name truncates, an action with an icon shows only the icon (its
     label stays for screen readers). Put nothing in the subtitle that the page doesn't also show. */
  .app-header { gap: var(--space-3); }
  .app-sub { display: none; }
  .app-header .context-switch, .app-header .vsep:has(+ .context-switch) { display: none; }
  .header-action:has(> .icon) { width: var(--control-h-sm); padding: 0; }
  .header-action:has(> .icon) > .header-action-label { position: absolute; width: 1px; height: 1px; overflow: hidden;
                                                        clip: rect(0 0 0 0); white-space: nowrap; }
  .header-action:has(> .icon) > .count-badge { left: auto; right: -2px; top: -2px; }
  .header-action:has(> .icon) > .dot { left: auto; right: 8px; top: 8px; }
  .header-user > .icon { display: none; }
  .work-area { grid-template-columns: minmax(0, 1fr); }
  .file-item { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon name action" ". state ."; }
  .timeline-item { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "mark time" "mark what"; }
  .track { flex-direction: column; gap: 0; }
  .track-step { border-bottom: 0; border-left: var(--bar) solid var(--border); }
  .track-step.is-done, .track-step[aria-current]:not([aria-current="false"]) { border-left-color: var(--selected-mark); }
  .page-title--lg { font-size: var(--text-2xl); }
  .paper--text { padding: var(--space-6) var(--space-5); }
  .stats--strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-3); }
  .stats--strip > .stat > .stat-value { font-size: var(--text-3xl); }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .segmented > :is(button, a) { padding: 0 var(--space-3); }   /* a switch in a head fits down to 320 px (DS-111) */
  .dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .side-sheet { width: 100%; height: auto; max-height: 85dvh; inset: auto 0 0 0; border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .side-sheet > .sheet-handle, .detail-panel > .sheet-handle { display: block; }
  .detail-panel { position: fixed; inset: auto 0 0 0; z-index: var(--z-sheet); max-height: 60dvh; border: 0;
                  border-radius: var(--radius-md) var(--radius-md) 0 0; box-shadow: var(--shadow-overlay); }
  .section-nav { position: static; }
  .section-nav > .nav-list { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; }
  .section-nav > .nav-list > li { flex: none; }
  .section-nav .nav-item { flex: none; padding: 0 var(--space-3); border: var(--line) solid var(--border-strong);
                           border-radius: var(--radius-sm); min-height: var(--control-h-sm); white-space: nowrap; }
  .assistant-label { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-toggle { display: inline-flex; }
  .filter-bar.is-collapsed > .filter-bar-row { display: none; }
  .table--stack > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--stack, .table--stack > :is(tbody, tfoot), .table--stack > :is(tbody, tfoot) > tr,
  .table--stack > :is(tbody, tfoot) > tr > :is(td, th) { display: block; }
  .table--stack > :is(tbody, tfoot) > tr { padding: var(--space-3) var(--space-4); border-bottom: var(--line) solid var(--border); }
  .table--stack > :is(tbody, tfoot) > tr > :is(td, th) { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
                                                justify-items: start; gap: var(--space-3); padding: var(--space-1) 0; border: 0;
                                                text-align: left; }
  .table--stack > :is(tbody, tfoot) > tr > :is(td, th)::before { content: attr(data-label); content: attr(data-label) / "";
                                                        color: var(--text-muted);
                                                        font-size: var(--text-xs); font-weight: var(--weight-regular); }
  .table--stack > :is(tbody, tfoot) > tr > :is(td, th):first-child { display: block; font-weight: var(--weight-semibold); }
  .table--stack > :is(tbody, tfoot) > tr > :is(td, th):first-child::before { content: none; }
  .table--stack > :is(tbody, tfoot) > tr > :is(td, th):empty { display: none; }
  .table-wrap > .table--stack > :last-child > tr:last-child { border-bottom: 0; }   /* the frame draws the last line */
  .table--stack > tbody > tr > th[scope="row"] { padding: var(--space-1) 0; border: 0; }   /* a row head stacks as the title */
  .table--stack > :is(tbody, tfoot) > tr > :is(td, th) > * { grid-column: 2; }   /* a message stays under its control */
}

/* ---------- touch: every small control reaches --target-min (44 px) on touch screens ---------- */
/* min-height wins over the components' own height; min-width widens icon-only and very short controls */
@media (pointer: coarse) {
  .header-action, .btn--sm, .chip, .check, .back-link, .nav-item, .menu-item, .hit-card-jump, .switch, .disclosure-teaser,
  .segmented > a, .chips--wrap .chip, .section-nav .nav-item, .legend > summary { min-height: var(--target-min); }
  .header-action, .btn--icon, .chip--square { min-width: var(--target-min); }
  a.app-name { line-height: var(--target-min); }
  a.app-brand { min-height: var(--target-min); }
  .segmented > button { height: var(--target-min); }
}

@media (prefers-reduced-motion: reduce) {
  .progress--indeterminate > .progress-value { left: 0; width: 100%; opacity: 0.4; animation: none; }
}

/* ---------- print (v0.4.3, D4): an app page on A4 without its chrome; .hide-print hides anything else (tools) ---------- */
@page { size: A4; margin: 16mm 16mm 18mm; }
@media print {
  body { background: var(--surface); -webkit-print-color-adjust: exact; print-color-adjust: exact; orphans: 3; widows: 3; }
  .table th, .table--nowrap :is(td, th) { white-space: normal; }   /* on paper, heads and cells wrap (v0.5.2) */
  body > :is(.app-header, .app-nav, .stage-note, .skip-link, .toast-region), .assistant-button, .assistant-label,
  .hide-print { display: none !important; }
  .page { max-width: none; padding: 0; }
  .work-area { display: block; }
  .work-area-aside { margin-top: var(--space-6); }
  .paper-stage { padding: 0; background: none; }
  .paper { max-width: none; outline: 0; }
  .table-wrap, .split-body { overflow: visible; }   /* a wide table prints whole instead of cut off */
  .card, .alert, .kv, .table tr, .hit-card, .record, .item-row, figure { break-inside: avoid; }
  .page-title, .section-title, .card-title, .panel-head { break-after: avoid; }
}


/* ---------- Windows high contrast (forced colours) ---------- */
/* Forced colours drop box shadows, backgrounds and background images, and many of the system's cues are made of
   them. Here they come back as borders, outlines and bars in system colours; selection uses Highlight, as Windows
   does. Checked with Chrome's emulation, light and dark palette. Last in the file, so it wins. */
@media (forced-colors: active) {
  /* frames first, so the selection's bar below wins on a selected hit card */
  .tile, .record, .hit-card, .copy-field, .feedback, .legend { border-color: CanvasText; }
  .drop-zone.is-over { border-style: solid; border-color: Highlight; }
  .track-step.is-done, .track-step[aria-current]:not([aria-current="false"]) { border-color: Highlight; }
  .steps-list > li::before { outline: var(--line) solid; }
  .level-step { outline: var(--line) solid CanvasText; outline-offset: -1px; }
  .level-step.is-on { background: CanvasText; }
  /* selection and state */
  .is-selected, .list-item.is-selected, .menu-item[aria-current]:not([aria-current="false"]), .menu-item[aria-pressed="true"] {
    border-left: var(--bar) solid Highlight; }
  .menu, .dialog, .drawer, .side-sheet, .detail-panel { border: var(--line) solid CanvasText; }
  .input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-width: 2px; }
  .nav-item[aria-current]:not([aria-current="false"]) { border-left: var(--bar) solid Highlight; }
  .icon-field { outline: var(--line) solid; }
  .segmented > a[aria-current]:not([aria-current="false"]) { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .switch > input::before { forced-color-adjust: none; background: CanvasText; }
  .switch > input:checked { forced-color-adjust: none; background: Highlight; border-color: Highlight; }
  .switch > input:checked::before { background: Canvas; }
  .chip[aria-pressed="true"], .chip[aria-checked="true"], .chip[aria-current]:not([aria-current="false"]) { border: 2px solid Highlight; }
  .segmented > button[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; } /* no text backplate */
  /* bars and fills without text keep a colour */
  .chip[aria-pressed="true"]::before, .tab[aria-selected="true"]::after, .tab[aria-current]:not([aria-current="false"])::after, .app-nav > a[aria-current]::after,
  .progress > .progress-value, .progress > span { forced-color-adjust: none; background: Highlight; }
  .chip[aria-pressed="true"]::before { border-color: Highlight; }
  .sheet-handle { forced-color-adjust: none; background: CanvasText; }
  /* edges that were only a background or a shadow */
  .app-header { border-bottom: var(--line) solid CanvasText; }
  .alert { border: var(--line) solid CanvasText; border-left-width: var(--bar); }
  .toast, .tooltip, .sheet, .progress, .assistant-button, .bubble, .assistant-label { border: var(--line) solid CanvasText; }
  mark, .mark { forced-color-adjust: none; background: Mark; color: MarkText; }
  .tag, .avatar, .count-badge { outline: var(--line) solid; outline-offset: calc(-1 * var(--line)); }
  .dot { forced-color-adjust: none; background: CanvasText; }
  /* the drawn arrow is a background image: the native control draws its own */
  .select { appearance: auto; }
  /* marks follow the palette: outlines and category fills in system colours; status fills keep their hue */
  .status-mark .outline, .category-mark .outline { stroke: CanvasText; }
  .status-mark .fill-neutral, .category-mark .fill-ground { fill: Canvas; }
  .status-mark .fill-info, .category-mark .fill-category { fill: CanvasText; }
  .status-mark .info-glyph { stroke: Canvas; }
}
