/* Owner: B (design system). Reusable building blocks and the evidence primitives (paper, index card, marks, key
   sentence, MailRef) – spec §4, §12.1; the JS builders are in js/ui/komponenten.js, the contract for the pages in
   W/umsetzung/komponenten.md. States only via attributes (aria-*, data-zustand, data-ton, data-aktiv, data-hervor,
   data-ganz, data-markierung, hidden). No colour values here – tokens only. Never select [data-ui] (test hooks).
   The transition block of the 0.7 classes is gone (T26): every page builds the markup of the spec. */

@layer components {

  /* ── Skip link: the first tab stop, visible on focus ── */
  .sprunglink {
    position: fixed; left: 12px; top: -120px; z-index: var(--z-skip); padding: 8px 12px;   /* far enough up that its shadow does not show */
    background: var(--surface-raised); color: var(--text); font-weight: 500;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm); box-shadow: var(--shadow-pop);
  }
  .sprunglink:focus { top: 12px; }

  /* ── Text links: underlined only in running text ── */
  .link { color: var(--accent-text); font-weight: 500; text-decoration: none; }
  .link:hover { text-decoration: underline; text-underline-offset: 3px; }
  .antwort a:not([class]), .kartei__text a:not([class]) {
    color: var(--accent-text);
    text-decoration: underline 1px;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-underline-offset: 3px;
  }
  .antwort a:not([class]):hover, .kartei__text a:not([class]):hover { text-decoration-color: currentColor; }
  .pfeil { color: var(--text-3); padding: 0 2px; }
  .zeit { color: var(--text-3); }

  /* ── Buttons: 36 (default) / 32 (klein) / 28 (mini) / 24 (xs) – icon 16 + word, at most one primary per page ── */
  .knopf {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--h-lg); padding: 0 14px; border: 1px solid transparent; border-radius: var(--r-sm);
    font-size: var(--fs-14); line-height: 20px; font-weight: 500; white-space: nowrap; color: var(--text);
    cursor: pointer; text-decoration: none; max-width: 100%;
    transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
  }
  .knopf .icon { color: currentColor; }
  .knopf--primaer { background: var(--accent); color: var(--text-on-solid); }
  .knopf--primaer:hover { background: var(--accent-hover); }
  .knopf--primaer:active { background: var(--accent-pressed); }
  .knopf--sekundaer { background: var(--surface); border-color: var(--border-input); }
  .knopf--sekundaer:hover { background: var(--surface-hover); }
  .knopf--sekundaer:active { background: var(--surface-active); }
  .knopf--sekundaer[aria-pressed="true"] { background: var(--accent-subtle); border-color: var(--accent-line); }
  .knopf--ghost { color: var(--text-2); }
  .knopf--ghost .icon { color: var(--text-3); }
  .knopf--ghost:hover { background: var(--surface-hover); color: var(--text); }
  .knopf--ghost:active { background: var(--surface-active); }
  .knopf--ghost[aria-pressed="true"] { background: var(--accent-subtle); color: var(--text); }
  .knopf--gefahr { background: var(--danger-solid); color: var(--text-on-solid); }
  .knopf--gefahr:hover { background: var(--danger-solid-hover); }
  .knopf--gefahr-text { color: var(--danger-text); }
  .knopf--gefahr-text:hover { background: var(--danger-subtle); }
  .knopf--klein { height: var(--h-md); padding: 0 10px; font-size: var(--fs-13); gap: 6px; }
  .knopf--mini { height: var(--h-sm); padding: 0 8px; font-size: var(--fs-13); gap: 5px; }
  .knopf--xs { height: var(--h-xs); padding: 0 6px; font-size: var(--fs-12); gap: 4px; border-radius: 5px; }
  .knopf--xs .icon { width: 14px; height: 14px; }
  .knopf--gross { height: 40px; padding: 0 16px; }
  .knopf--breit { width: 100%; }
  /* Long labels may wrap instead of widening the page (reflow at 320 px) */
  .knopf--umbruch { white-space: normal; height: auto; min-height: var(--h-xs); padding-block: 3px; text-align: left; justify-content: flex-start; }
  .knopf__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .knopf--umbruch .knopf__text { overflow: visible; }
  .knopf .zahl { color: var(--text-3); }
  .knopf--primaer .zahl, .knopf--gefahr .zahl { color: inherit; }
  .knopf[aria-disabled="true"], .knopf:disabled {
    background: var(--surface-2); color: var(--text-3); border-color: var(--border); cursor: not-allowed;
  }
  .knopf[aria-disabled="true"] .icon, .knopf:disabled .icon { color: var(--text-3); }
  .knopf[aria-busy="true"] { cursor: progress; }
  .knopf[aria-busy="true"] .icon-loader-circle, .dreht { animation: drehen 1s linear infinite; }
  .knopf .kbd { margin-left: 4px; }
  .knopf--primaer .kbd { background: transparent; border-color: color-mix(in srgb, var(--text-on-solid) 45%, transparent); color: var(--text-on-solid); }

  /* ── Icon button: 32 px (28, 24; 44 touch) – always aria-label with the shortcut + tooltip ── */
  .ikon {
    display: inline-grid; place-items: center; width: var(--h-md); height: var(--h-md);
    border-radius: var(--r-sm); color: var(--text-2); position: relative; flex: none;
    transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
  }
  .ikon:hover { background: var(--surface-hover); color: var(--text); }
  .ikon:active { background: var(--surface-active); }
  .ikon--klein { width: var(--h-sm); height: var(--h-sm); }
  .ikon--mini { width: var(--h-xs); height: var(--h-xs); border-radius: 5px; }
  .ikon--mini .icon { width: 14px; height: 14px; }
  .ikon--mini::before { content: ""; position: absolute; inset: -2px; }
  .ikon--touch { width: var(--h-xl); height: var(--h-xl); }
  .ikon--touch .icon { width: 20px; height: 20px; }
  .ikon[aria-disabled="true"] { color: var(--text-3); opacity: 0.55; cursor: not-allowed; }
  .ikon[aria-disabled="true"]:hover { background: none; }
  .ikon[aria-pressed="true"] { background: var(--accent-subtle); color: var(--accent-text); }
  .ikon[aria-busy="true"] { cursor: progress; }
  .ikon[aria-busy="true"] .icon-loader-circle { animation: drehen 1s linear infinite; }
  .ikon__zahl {
    position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-full);
    display: inline-grid; place-items: center; font-size: var(--fs-12); line-height: 1; font-weight: 600;
    font-variant-numeric: tabular-nums; background: var(--danger-subtle); color: var(--danger-text);
    box-shadow: inset 0 0 0 1px var(--danger-border);
  }
  .werkzeuge { display: flex; align-items: center; gap: 2px; min-width: 0; }
  .werkzeuge__trenner { width: 1px; height: 18px; margin: 0 6px; background: var(--border-strong); flex: none; }

  /* ── Keyboard hint ── */
  .kbd {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
    border: 1px solid var(--border-strong); border-radius: var(--r-xs); background: var(--surface);
    color: var(--text-2); font: 500 var(--fs-12)/1 var(--font-ui); letter-spacing: 0; white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .kbd--still { background: var(--chip); border-color: transparent; }
  .kbd + .kbd { margin-left: 2px; }
  @media (pointer: coarse) { .kbd--fein { display: none; } }

  /* ── Form fields: 36 px (login 40), border >= 3:1, label 13/500, help 12 px ── */
  .feld-gruppe { display: grid; gap: 6px; align-content: start; min-width: 0; }
  .feld-label { font-size: var(--fs-13); line-height: 20px; font-weight: 500; color: var(--text); }
  .feld-hilfe { font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
  .feld-hilfe--ok { color: var(--success-text); display: inline-flex; gap: 4px; align-items: center; }
  .feld-hilfe--fehler { color: var(--danger-text); display: inline-flex; gap: 4px; align-items: center; }
  .feld-hilfe .icon { width: 12px; height: 12px; stroke-width: 2.25; }
  .feld {
    display: flex; align-items: center; gap: 8px; height: var(--h-lg); padding: 0 10px;
    background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--r-sm);
    color: var(--text); min-width: 0;
  }
  .feld:hover { border-color: var(--text-3); }
  .feld:focus-within { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
  .feld > .icon { color: var(--text-3); }
  .feld input, .feld select {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0;
    font-size: var(--fs-14); color: inherit;
  }
  .feld input::placeholder, .feld textarea::placeholder { color: var(--text-3); opacity: 1; }
  .feld--klein { height: var(--h-md); }
  .feld--gross { height: 40px; }
  .feld[aria-invalid="true"], .feld:has(input[aria-invalid="true"]) { border-color: var(--danger-border); }
  .feld[aria-disabled="true"], .feld:has(input:disabled) { background: var(--surface-2); color: var(--text-3); }
  .feld .kbd { flex: none; }
  .feld__knopf { margin-right: -6px; }
  .feld--select { padding-right: 6px; position: relative; }
  .feld--select select { appearance: none; cursor: pointer; padding-right: 22px; margin-right: -22px; }
  .feld--select .icon:last-child { color: var(--text-3); pointer-events: none; width: 14px; height: 14px; }
  .feld--mono input { font-family: var(--font-mono); font-size: var(--fs-14); letter-spacing: 0.02em; }
  /* Date: the field shows its own calendar icon on the left; the browser's indicator is hidden – a click on the field
     opens the picker (datumFeld() calls showPicker), the keyboard works as usual */
  .feld input[type="date"] { min-width: 0; cursor: text; }
  .feld input[type="date"]::-webkit-calendar-picker-indicator { display: none; }

  /* ── Segmented control = radio group (fieldset + legend), arrow keys come with the radios ── */
  .segment {
    display: inline-flex; max-width: 100%; padding: 2px; gap: 2px; border-radius: var(--r-md);
    background: var(--surface-active); border: 0;
  }
  .segment label {
    position: relative; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; min-width: 0;
    border-radius: var(--r-sm); border: 1px solid transparent; font-size: var(--fs-13); font-weight: 500;
    color: var(--text-2); cursor: pointer; white-space: nowrap;
  }
  .segment input { position: absolute; opacity: 0; pointer-events: none; }
  .segment label:hover { color: var(--text); }
  .segment label:has(input:checked) { background: var(--surface); color: var(--text); border-color: var(--accent-line); }
  .segment label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 0; }
  .segment .icon { width: 14px; height: 14px; }
  .segment .zahl { color: var(--text-3); font-variant-numeric: tabular-nums; }
  .segment-legende { font-size: var(--fs-13); font-weight: 500; color: var(--text); margin-bottom: 6px; }

  /* ── Checkbox and switch ── */
  .wahl { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); color: var(--text); cursor: pointer; }
  .wahl input[type="checkbox"]:not(.schalter) {
    appearance: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--border-input); border-radius: 4px;
    background: var(--surface); display: inline-grid; place-items: center; flex: none; cursor: pointer;
  }
  .wahl input[type="checkbox"]:not(.schalter)::after {
    content: ""; width: 8px; height: 4px; border: 2px solid var(--text-on-solid); border-top: 0; border-right: 0;
    transform: translateY(-1px) rotate(-45deg); opacity: 0;
  }
  .wahl input[type="checkbox"]:not(.schalter):checked { background: var(--accent); border-color: var(--accent-line); }
  .wahl input[type="checkbox"]:not(.schalter):checked::after { opacity: 1; }
  .schalter {
    appearance: none; position: relative; width: 32px; height: 18px; margin: 0; border-radius: 999px; flex: none;
    background: var(--surface-active); border: 1px solid var(--border-input); cursor: pointer;
    transition: background-color var(--dur-2) var(--ease-out);
  }
  .schalter::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--text-3); transition: transform var(--dur-2) var(--ease-out), background-color var(--dur-2);
  }
  .schalter:checked { background: var(--accent); border-color: var(--accent-line); }
  .schalter:checked::after { transform: translateX(14px); background: var(--text-on-solid); }

  /* ── Status pill (audit appendix B): dot or icon + word, never colour alone; tone from statusTon() ── */
  .pille {
    display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px 0 7px;
    border-radius: var(--r-full); background: var(--neutral-subtle); color: var(--neutral-text);
    font-size: var(--fs-12); line-height: 16px; font-weight: 500; white-space: nowrap; vertical-align: middle;
    letter-spacing: 0;
  }
  .pille::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--neutral-dot); flex: none; }
  .pille:has(> .icon)::before { display: none; }
  .pille > .icon { margin-left: -1px; width: 12px; height: 12px; stroke-width: 2.25; }
  .pille[data-ton="strittig"] { background: var(--rose-subtle); color: var(--rose-text); }
  .pille[data-ton="strittig"]::before { background: var(--rose-dot); }
  .pille[data-ton="offen"] { background: var(--info-subtle); color: var(--info-text); }
  .pille[data-ton="offen"]::before { background: var(--info-border); }
  .pille[data-ton="gut"] { background: var(--success-subtle); color: var(--success-text); }
  .pille[data-ton="gut"]::before { background: var(--success-dot); }
  .pille[data-ton="gefahr"] { background: var(--danger-subtle); color: var(--danger-text); }
  .pille[data-ton="gefahr"]::before { background: var(--danger-border); }
  .pille[data-ton="info"] { background: var(--info-subtle); color: var(--info-text); }
  .pille[data-ton="info"]::before { background: var(--info-border); }
  a.pille:hover { box-shadow: inset 0 0 0 1px currentColor; }
  .pille--ohne-punkt::before { display: none; }
  .pille--ohne-punkt { padding: 0 8px; }
  .pillen { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

  /* ── Deadline mark (spec §4.2): exactly one state from fristStatus() – word + icon + countdown ── */
  .fristmarke {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px 0 7px;
    border: 1px solid var(--border-input); border-radius: var(--r-sm); white-space: nowrap;
    background: var(--surface); color: var(--text-2);
    font-size: var(--fs-12); line-height: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0;
  }
  .fristmarke .icon { width: 14px; height: 14px; stroke-width: 2; }
  .fristmarke[data-zustand="ueberfaellig"] { background: var(--danger-solid); color: var(--text-on-solid); border-color: var(--danger-solid); }
  .fristmarke[data-zustand="bald"] { background: var(--danger-subtle); color: var(--danger-text); border-color: var(--danger-border); }
  .fristmarke[data-zustand="laeuft"] { background: var(--surface); color: var(--text-2); border-color: var(--border-input); }
  .fristmarke[data-zustand="klaeren"] { background: var(--info-subtle); color: var(--info-text); border-color: var(--info-border); }
  .fristmarke[data-zustand="erledigt"] { background: var(--success-subtle); color: var(--success-text); border-color: var(--success-border); }
  .fristmarke[data-zustand="verstrichen"] { background: var(--neutral-solid); color: var(--neutral-solid-text); border-color: var(--neutral-solid); }
  .fristmarke--klein { height: 20px; padding: 0 6px 0 5px; gap: 4px; }
  .fristmarke--klein .icon { width: 12px; height: 12px; stroke-width: 2.25; }

  /* ── MailRef: the mail number as an object (#53) – the citation unit of the app ── */
  .mailref {
    display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px;
    background: var(--chip); color: var(--text); text-decoration: none; white-space: nowrap;
    font: 500 var(--fs-13)/20px var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: 0;
    position: relative; vertical-align: baseline;
    transition: background-color var(--dur-1) var(--ease-out);
  }
  a.mailref:hover { background: var(--chip-hover); text-decoration: none; }
  .mailref__raute { color: var(--text-3); margin-right: 1px; }
  .mailref .icon { margin-left: 4px; color: var(--text-3); width: 12px; height: 12px; stroke-width: 2.25; }
  .mailref__neu { width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--accent-line); flex: none; }
  .mailref--gross { height: 28px; padding: 0 8px; border-radius: var(--r-sm); font: 600 var(--fs-20)/28px var(--font-ui); letter-spacing: -0.01em; vertical-align: 1px; }
  .mailrefs { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
  .mailrefs .mailref, .mailrefs .mailref-gruppe { flex: none; }
  /* Copy affordance: the MailRef and a mini button ("#53 kopieren") join into one chip on hover or focus */
  .mailref-gruppe { display: inline-flex; align-items: center; vertical-align: baseline; white-space: nowrap; }
  .mailref__kopie {
    display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 0 5px 5px 0; position: relative;
    background: var(--chip-hover); color: var(--text-3);
  }
  .mailref__kopie::before { content: ""; position: absolute; inset: -2px; }
  .mailref__kopie:hover { color: var(--text); }
  .mailref__kopie .icon { width: 12px; height: 12px; stroke-width: 2.25; }
  .mailref-gruppe:not(:hover):not(:focus-within) > .mailref__kopie { display: none; }
  .mailref-gruppe:is(:hover, :focus-within) > .mailref { background: var(--chip-hover); border-radius: 5px 0 0 5px; }
  .mailref__schloss { display: inline-flex; align-items: center; margin-left: 4px; color: var(--text-3); vertical-align: -2px; }
  .mailref__schloss .icon { width: 13px; height: 13px; stroke-width: 2; }

  /* ── Evidence marks in answers (audit appendix C): amber pill = document, neutral ring = catalogue ── */
  .marke {
    position: relative; display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px 0 5px;
    margin: 0 1px 0 4px; font: 600 var(--fs-12)/1 var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: 0;
    vertical-align: 2px; white-space: nowrap; cursor: pointer;
    transition: box-shadow var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
  }
  .marke::before { content: ""; position: absolute; inset: -3px -1px; }
  .marke .icon { width: 12px; height: 12px; stroke-width: 2.25; }
  .marke--dok { background: var(--doc-chip); color: var(--doc-chip-text); border: 1px solid var(--doc-chip-border); border-radius: var(--r-full); }
  .marke--kat { background: var(--surface); color: var(--cat-text); border: 1px solid var(--cat-ring); border-radius: var(--r-xs); }
  .marke--kat:hover { background: var(--cat-surface); }
  .marke[aria-current="true"] { outline: 2px solid var(--focus); outline-offset: 2px; }
  .marke--muster { cursor: default; }
  .marke--klein { height: 18px; margin: 0; padding: 0 5px 0 4px; }
  /* A mark group: the last word before the marks and the marks never break apart (spec §4.3) */
  .markengruppe { white-space: nowrap; }

  /* ── Box (flat container, e0) ── */
  .box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: clip; }
  .box > .liste > li + li, .box__teil + .box__teil { border-top: 1px solid var(--border); }
  .box__teil { padding: 14px 16px; }
  .box__fuss {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 40px; padding: 8px 16px;
    border-top: 1px solid var(--border); font-size: var(--fs-13); color: var(--text-2);
  }

  /* ── Clickable row: one real link stretched over the row, exactly 1 tab stop ──
     The focus ring is drawn on the stretched ::after, so it shows on every row type (li, tr, div) – inside, never clipped. */
  .zeile, .tabelle tbody tr { position: relative; }
  .zeile:hover { background: var(--surface-hover); }
  .zeile__link { color: var(--text); font-weight: 500; text-decoration: none; }
  .zeile__link::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
  .zeile__link:focus-visible { outline: none; }
  .zeile__link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
  .zeile .ueber { position: relative; z-index: 1; }
  .zeile[aria-current="true"] { background: var(--accent-subtle); box-shadow: inset 2px 0 0 var(--accent-line); }

  /* ── Section heading above a box: icon 16, title 14/600, count, "Alle … →" ── */
  .abschnitt + .abschnitt { margin-top: 32px; }
  .abschnitt__kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 28px; margin-bottom: 8px; }
  .abschnitt__kopf h2, .abschnitt__kopf h3 { font-size: var(--fs-14); line-height: 20px; font-weight: 600; letter-spacing: -0.006em; }
  .abschnitt__kopf .icon { color: var(--text-3); }
  .abschnitt__zahl { font-size: var(--fs-13); color: var(--text-3); font-variant-numeric: tabular-nums; }
  .abschnitt__mehr { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-13); font-weight: 500; color: var(--accent-text); white-space: nowrap; }
  .abschnitt__mehr:hover { text-decoration: underline; text-underline-offset: 3px; }
  .abschnitt__mehr .icon { width: 14px; height: 14px; color: currentColor; }
  .abschnitt__hinweis { margin: -4px 0 10px; font-size: var(--fs-13); color: var(--text-2); }

  /* ── Catalogue label in meta lines ("KATALOG Zusammenstellung der Familie · Stand …") ── */
  .etikett {
    display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); line-height: 16px; font-weight: 500;
    color: var(--cat-eyebrow);
  }
  .etikett__art { font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; margin-right: 6px; }
  .etikett > .icon { margin-right: 0; width: 14px; height: 14px; }

  /* ── Tags (neutral labels): "zitiert" / "lag vor" / catalogue role ── */
  .tag {
    display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px;
    border: 1px solid var(--border-strong); font-size: var(--fs-12); line-height: 16px; color: var(--text-2);
    white-space: nowrap; font-weight: 500; letter-spacing: 0; max-width: 100%;
  }
  .tag .icon { width: 12px; height: 12px; stroke-width: 2.25; flex: none; }
  /* A long tag (an origin with a file name – schild() sets it from 33 characters on) wraps inside its card instead
     of running out of it; file names break anywhere (spec §2.5, §7 reflow) */
  .tag--umbruch { white-space: normal; height: auto; min-height: 20px; padding-block: 1px; align-items: flex-start; overflow-wrap: anywhere; min-width: 0; }
  .tag--umbruch .icon { margin-top: 2px; }
  .tag--katalog { border-color: var(--cat-ring); color: var(--cat-text); background: var(--cat-surface); }
  .tag--zitiert { border-color: var(--border-input); color: var(--text); font-weight: 600; }
  .tag--zitiert .icon { stroke-width: 2.5; }
  .tag--lagvor { border-color: var(--border); color: var(--text-3); }

  /* Reading text (serif: .antwort, .dokument, .auszug, .vmail__zitat, .vorschau__kern) always sets
     color: var(--paper-text), font-weight: var(--text-weight), lining-nums and hyphens: manual – an automatically
     inserted hyphen would look like original text in a quotation. */

  /* ── Paper: document material (evidence card, document sheet) – the only flat surface with a shadow (e1) ── */
  .beleg {
    background: var(--paper); border: 1px solid var(--paper-border); border-radius: var(--r-md);
    box-shadow: var(--shadow-paper); scroll-margin-top: 16px; min-width: 0;
    transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
  }
  .beleg[aria-current="true"] { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow-paper); }
  .beleg[data-hervor] { background: var(--accent-subtle); }

  /* Excerpt: 3 px amber edge, a breath of passage colour fading out, only the key sentence filled; 6 lines on screen.
     No vertical padding: the clamp ends exactly at the last visible line, so the fill of a key sentence on the
     hidden next line never shows as a sliver below it (spec §4.3). */
  .auszug {
    margin-top: 8px; padding: 0 0 0 12px; border-left: 3px solid var(--mark-edge);
    background: linear-gradient(90deg, var(--mark-passage), transparent 78%);
    font-family: var(--font-text); font-weight: var(--text-weight); font-size: var(--fs-15); line-height: 24px;
    font-variant-numeric: lining-nums; color: var(--paper-text); letter-spacing: 0; hyphens: manual; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden;
  }
  .auszug[data-ganz] { display: block; -webkit-line-clamp: unset; line-clamp: none; }
  .auszug--ohne-kern { background: none; }

  /* Key sentence: fill + 2 px dark amber bottom edge (second, non-colour cue) */
  mark.kern {
    background: var(--mark-key); color: var(--mark-key-text); border-radius: 3px;
    box-shadow: inset 0 -2px 0 var(--mark-edge);
    padding: 0.06em 0.14em 0.1em; margin: 0 -0.14em;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
  }
  /* Passage in a long document: pen stroke on the lower line half; the edge sits in the gutter */
  .strich {
    background: linear-gradient(transparent 60%, var(--mark-passage) 60% 94%, transparent 94%);
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
  }
  .stelle-block { border-left: 3px solid var(--mark-edge); margin-left: -19px; padding-left: 16px; scroll-margin-block: 96px; }
  /* Literal search hit: the exact match, no guessed key sentence – light fill with a thin edge */
  mark.treffer {
    background: var(--mark-passage); color: var(--paper-text); border-radius: 2px; box-shadow: inset 0 -1px 0 var(--mark-edge);
    padding: 0 0.1em; margin: 0 -0.1em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  }
  mark.kern, mark.treffer, .strich, .stelle-block { scroll-margin-block: 96px; }
  [data-markierung="aus"] mark.treffer { background: none; box-shadow: none; }
  [data-markierung="aus"] mark.kern { background: none; box-shadow: none; color: inherit; padding: 0; margin: 0; }
  [data-markierung="aus"] .strich { background: none; }
  [data-markierung="aus"] .stelle-block { border-left-color: transparent; }

  /* ── Index card: catalogue evidence (flat, tinted, Inter, never amber) ── */
  .kartei { background: var(--cat-surface); border: 1px solid var(--cat-border); border-radius: var(--r-sm); min-width: 0; }
  .kartei[aria-current="true"] { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
  .kartei__eyebrow {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-height: 30px; padding: 6px 12px;
    border-bottom: 1px solid var(--cat-border); background: var(--cat-head); border-radius: var(--r-sm) var(--r-sm) 0 0;
    font-size: var(--fs-12); line-height: 16px; font-weight: 500; color: var(--cat-eyebrow);
  }
  .kartei__eyebrow .icon { color: var(--cat-eyebrow); width: 14px; height: 14px; }
  .kartei__art { font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; }
  .kartei__koerper { padding: 12px 14px 14px; display: grid; gap: 8px; }
  .kartei__kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
  .kartei__typ { font-size: var(--fs-12); color: var(--cat-eyebrow); font-weight: 500; }
  .kartei__titel { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
  a.kartei__titel:hover { text-decoration: underline; text-underline-offset: 3px; }
  .kartei__text { font-size: var(--fs-14); line-height: 22px; color: var(--cat-text); overflow-wrap: anywhere; }
  .kartei__text--gross { font-size: var(--fs-15); line-height: 24px; color: var(--text); }
  .kartei__text--gross .mailref { vertical-align: 1px; }
  .kartei__label { font-weight: 600; color: var(--cat-eyebrow); margin-right: 6px; }
  .kartei__belegt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--cat-eyebrow); }
  .kartei__belegt .icon { width: 14px; height: 14px; }

  /* ── Notices (info blue, danger red, catalogue, neutral; never yellow) ── */
  .hinweis {
    display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 2px 10px; align-items: start; align-content: start;
    padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2);
    font-size: var(--fs-13); line-height: 20px; color: var(--text-2);
  }
  .hinweis > .icon { margin-top: 2px; color: var(--text-3); }
  .hinweis__titel { font-weight: 600; color: var(--text); }
  .hinweis__text > * + * { margin-top: 2px; }
  .hinweis[data-ton="info"] { background: var(--info-subtle); border-color: var(--info-border); color: var(--text); }
  .hinweis[data-ton="info"] > .icon { color: var(--info-text); }
  .hinweis[data-ton="gefahr"] { background: var(--danger-subtle); border-color: var(--danger-border); color: var(--text); }
  .hinweis[data-ton="gefahr"] > .icon { color: var(--danger-text); }
  .hinweis[data-ton="katalog"] { background: var(--cat-surface); border-color: var(--cat-border); color: var(--text); }
  .hinweis[data-ton="katalog"] > .icon { color: var(--cat-eyebrow); }
  .hinweis__aktion { align-self: center; }
  .hinweis__aktion--unten { grid-column: 2 / -1; justify-self: start; margin-top: 6px; }
  .hinweis__details { margin-top: 4px; }
  .hinweis__details > summary { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; color: var(--text-2); }
  .hinweis__details > summary .icon { width: 14px; height: 14px; transition: transform var(--dur-2) var(--ease-out); }
  .hinweis__details[open] > summary .icon { transform: rotate(90deg); }
  .hinweis__details pre { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-12); line-height: 16px; color: var(--text-2); }
  /* Footnote below a list (rules, limits) */
  .fussnote { display: flex; align-items: flex-start; gap: 8px; margin-top: 20px; font-size: var(--fs-13); color: var(--text-2); max-width: 90ch; }
  .fussnote .icon { margin-top: 3px; color: var(--text-3); flex: none; width: 14px; height: 14px; }

  /* ── Empty state: icon, title, sentence, always one next action ── */
  .leer { display: grid; justify-items: center; gap: 6px; padding: 32px 16px; text-align: center; }
  .leer__icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 6px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
  .leer__icon .icon { width: 20px; height: 20px; }
  .leer__titel { font-weight: 600; color: var(--text); }
  .leer__text { max-width: 44ch; font-size: var(--fs-13); color: var(--text-2); }
  .leer .knopf { margin-top: 8px; }

  /* ── Skeleton in the shape of the result (the container carries aria-busy="true") ── */
  .skelett {
    display: block; height: 12px; border-radius: 4px;
    background: linear-gradient(90deg, var(--surface-active) 0%, var(--surface-hover) 50%, var(--surface-active) 100%);
    background-size: 200% 100%; animation: schimmer 1.6s linear infinite;
  }
  .skelett--zeile { height: 14px; }
  .skelett--titel { height: 18px; }
  .skelett--w90 { width: 90%; } .skelett--w75 { width: 75%; } .skelett--w60 { width: 60%; } .skelett--w40 { width: 40%; } .skelett--w25 { width: 25%; }
  .skelettliste { display: grid; gap: 10px; padding: 4px 0; }
  @media (prefers-reduced-motion: reduce) { .skelett { background: var(--surface-active); animation: none; } }

  /* ── Disclosure: <summary> = arrow + .klappe__titel (+ .zahl). The arrow hangs in the 32-px gutter, the title wraps
        next to it, the count moves to the next line as a whole – always aligned with the title, never below the arrow ── */
  .klappe > summary {
    position: relative; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-height: 32px;
    padding: 6px 8px 6px 32px; margin: 0 -8px; border-radius: var(--r-sm);
    font-size: var(--fs-13); line-height: 20px; font-weight: 500; color: var(--text-2);
  }
  .klappe > summary > .klappe__pfeil { position: absolute; left: 8px; top: 8px; }
  .klappe__titel { min-width: 0; }
  .klappe__titel > .icon { margin-right: 6px; vertical-align: -3px; }
  .klappe > summary:hover { background: var(--surface-hover); color: var(--text); }
  .klappe > summary:focus-visible { outline-offset: -2px; }
  .klappe > summary .icon { color: var(--text-3); transition: transform var(--dur-2) var(--ease-out); }
  .klappe[open] > summary .klappe__pfeil, .monatsgruppe[open] > summary .klappe__pfeil { transform: rotate(90deg); }
  .klappe .zahl { color: var(--text-3); font-variant-numeric: tabular-nums; }
  .klappe__inhalt { padding: 4px 0 8px; }

  /* ── Breadcrumb: 13 px, 6-px chevron, the last step is the current page ── */
  .brotkrume ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; list-style: none; font-size: var(--fs-13); color: var(--text-2); }
  .brotkrume li { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
  .brotkrume li + li::before {
    content: ""; width: 6px; height: 6px; margin: 0 4px 0 2px; border-right: 1.5px solid var(--text-3); border-top: 1.5px solid var(--text-3);
    transform: rotate(45deg); flex: none;
  }
  .brotkrume a { color: var(--text-2); }
  .brotkrume a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
  .brotkrume [aria-current="page"] { color: var(--text); font-weight: 500; }

  /* ── Tabs: 36 px, 2-px accent edge under the selected one ── */
  .reiter { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); }
  .reiter a, .reiter button {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; margin-bottom: -1px;
    border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 500; font-size: var(--fs-13);
  }
  .reiter a:hover, .reiter button:hover { color: var(--text); }
  .reiter [aria-selected="true"], .reiter [aria-current="page"] { color: var(--text); border-bottom-color: var(--accent-line); }
  .reiter :focus-visible { outline-offset: -2px; }
  .reiter .icon { width: 14px; height: 14px; }

  /* ── Tooltip (inverted, 12 px, with kbd) – positioned by komponenten.js via CSSOM (left/top), never wider than
        the viewport; .tip--statisch: a static sample for the component gallery (W/umsetzung/galerie), not used by
        the pages ── */
  .tip {
    position: fixed; left: 0; top: 0; z-index: var(--z-popover); display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px;
    border-radius: var(--r-sm); background: var(--tip-bg); color: var(--tip-text); border: 1px solid var(--tip-border);
    font-size: var(--fs-12); line-height: 16px; font-weight: 500; letter-spacing: 0; box-shadow: var(--shadow-pop);
    width: max-content; max-width: min(320px, calc(100vw - 16px)); pointer-events: none;
    transition: opacity var(--dur-2) var(--ease-out), translate var(--dur-2) var(--ease-out);
  }
  .tip--statisch { position: static; }
  .tip .kbd { background: transparent; color: var(--tip-text); border-color: color-mix(in srgb, var(--tip-text) 35%, transparent); height: 18px; }
  .tip__text { min-width: 0; }
  .tip__grund { display: block; font-weight: 400; }

  /* ── Menu "…" (role=menu): positioned by komponenten.js via CSSOM ── */
  .menue {
    min-width: 220px; max-width: calc(100vw - 16px); padding: 4px; border-radius: var(--r-lg); background: var(--surface-raised);
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); z-index: var(--z-popover); color: var(--text);
  }
  .menue--schwebend {
    position: fixed; left: 0; top: 0; max-height: calc(100dvh - 16px); overflow-y: auto;
    transition: opacity var(--dur-2) var(--ease-out), translate var(--dur-2) var(--ease-out);
  }
  .menue__punkt {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 8px; border-radius: var(--r-sm);
    font-size: var(--fs-14); color: var(--text); white-space: nowrap; text-align: left; text-decoration: none;
  }
  .menue__punkt .icon { color: var(--text-3); }
  .menue__punkt:hover, .menue__punkt[data-aktiv] { background: var(--surface-hover); }
  .menue__punkt:focus-visible { outline-offset: -2px; }
  .menue__punkt[aria-checked="true"] .menue__haken { visibility: visible; }
  .menue__haken { visibility: hidden; margin-left: auto; color: var(--accent-text); }
  .menue__punkt .kbd, .menue__punkt .menue__zusatz { margin-left: auto; }
  .menue__zusatz { color: var(--text-3); font-size: var(--fs-12); }
  .menue__text { min-width: 0; }
  .menue__grund { display: block; font-size: var(--fs-12); line-height: 16px; color: var(--text-3); white-space: normal; }
  .menue__punkt:has(.menue__grund) { height: auto; min-height: 32px; padding-block: 6px; white-space: normal; align-items: flex-start; }
  .menue__punkt:has(.menue__grund) .icon { margin-top: 2px; }
  .menue__punkt--gefahr, .menue__punkt--gefahr .icon { color: var(--danger-text); }
  .menue__punkt[aria-disabled="true"], .menue__punkt[aria-disabled="true"] .icon { color: var(--text-3); cursor: not-allowed; }
  .menue__trenner { height: 1px; margin: 4px -4px; background: var(--border); }
  .menue__gruppe { padding: 8px 8px 4px; font-size: var(--fs-12); font-weight: 500; color: var(--text-3); }

  /* ── Dialog (<dialog>, showModal: top layer, inert background, Esc closes) ── */
  .dialog {
    width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; border-radius: var(--r-xl);
    background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-dialog); color: var(--text);
    overflow: auto; transition: opacity var(--dur-2) var(--ease-out);
  }
  .dialog--breit { width: min(600px, calc(100vw - 32px)); }
  .dialog::backdrop { background: var(--scrim); }
  .dialog__kopf { display: flex; align-items: flex-start; gap: 12px; padding: 18px 16px 4px 20px; }
  .dialog__kopf h2 { font-size: var(--fs-16); line-height: 24px; letter-spacing: -0.01em; }
  .dialog__kopf h2:focus { outline: none; }
  .dialog__unter { margin-top: 2px; font-size: var(--fs-13); color: var(--text-2); }
  .dialog__kopf .ikon { margin-left: auto; margin-top: -2px; }
  .dialog__koerper { display: grid; gap: 16px; padding: 14px 20px 20px; }
  .dialog__fuss {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px 12px 20px;
    border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl);
  }
  .dialog__fuss .feld-hilfe { margin-right: auto; display: inline-flex; align-items: center; gap: 4px; }
  .dialog__fuss .feld-hilfe .icon { width: 12px; height: 12px; }
  .raster-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px 16px; }

  /* ── Toasts (bottom right; phone: bottom centre above the composer) – undo >= 10 s, pause on hover/focus ── */
  .toasts {
    position: fixed; right: 16px; bottom: 16px; z-index: var(--z-toast); display: grid; gap: 8px; justify-items: end;
    width: min(440px, calc(100vw - 32px)); pointer-events: none;
  }
  .toasts:empty { display: none; }
  .toast {
    display: flex; align-items: center; gap: 10px; min-width: min(320px, 100%); max-width: 440px; padding: 10px 10px 10px 14px;
    border-radius: var(--r-lg); background: var(--surface-raised); border: 1px solid var(--border-strong); color: var(--text);
    box-shadow: var(--shadow-pop); font-size: var(--fs-13); position: relative; overflow: hidden; z-index: var(--z-toast);
    pointer-events: auto; transition: opacity var(--dur-3) var(--ease-out), translate var(--dur-3) var(--ease-out);
  }
  .toast > .icon { color: var(--success-text); }
  .toast__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .toast__zeit { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent-line); transform-origin: left center; }
  .toast__zeit--laeuft { animation: ablauf linear forwards; }
  .toast:is(:hover, :focus-within) .toast__zeit--laeuft { animation-play-state: paused; }
  @media (prefers-reduced-motion: reduce) { .toast__zeit { display: none; } }
  @media (max-width: 759px) {
    .toasts { left: 16px; right: 16px; width: auto; justify-items: center; }
    :root:has(.composer) .toasts { bottom: calc(var(--composer-h) + 16px); }
  }

  /* ── Hover card for marks / MailRefs (DOM, role=tooltip, no interactive parts, only loaded data) ── */
  .vorschau {
    position: fixed; left: 0; top: 0;
    width: min(360px, calc(100vw - 16px)); padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface-raised);
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); display: grid; gap: 6px; z-index: var(--z-popover);
    color: var(--text); transition: opacity var(--dur-2) var(--ease-out), translate var(--dur-2) var(--ease-out);
  }
  .vorschau--statisch { position: static; width: auto; max-width: 360px; min-width: 0; }   /* gallery sample, like .tip--statisch */
  .vorschau__kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--fs-12); line-height: 16px; color: var(--text-2); }
  .vorschau__kopf .icon { width: 14px; height: 14px; color: var(--text-3); }
  .vorschau__betreff { font-weight: 600; font-size: var(--fs-13); overflow-wrap: anywhere; }
  .vorschau__kern {
    font-family: var(--font-text); font-size: var(--fs-14); line-height: 22px; font-weight: var(--text-weight); color: var(--paper-text);
    hyphens: manual; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden;
  }
  .vorschau__fuss { font-size: var(--fs-12); color: var(--text-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

  /* Overlays appear with opacity and a short way (spec §2.9); without @starting-style they simply appear */
  @starting-style {
    .tip { opacity: 0; translate: 0 4px; }
    .menue--schwebend { opacity: 0; translate: 0 -4px; }
    .vorschau { opacity: 0; translate: 0 4px; }
    .toast { opacity: 0; translate: 0 8px; }
    .dialog[open] { opacity: 0; }
  }

  /* ── Avatar (initials, aria-hidden – the name stands next to it) ── */
  .avatar {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
    background: var(--info-subtle); color: var(--accent-text); font-size: var(--fs-12); font-weight: 600; letter-spacing: 0;
  }
  .avatar--gross { width: 32px; height: 32px; }
  .avatar--neutral { background: var(--neutral-subtle); color: var(--text-2); }

  /* ── Status dot with text (never colour alone) ── */
  .punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral-dot); }
  .punkt--ok { background: var(--success-dot); }
  .punkt--gefahr { background: var(--danger-solid); }
  .status { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
  a.status { text-decoration: none; }
  a.status:hover .status__text { text-decoration: underline; text-underline-offset: 3px; }

  /* ── Table: sticky head, numbers right-aligned and tabular (row cards below 640 px: page CSS) ── */
  .tabelle { width: 100%; font-size: var(--fs-14); }
  .tabelle th {
    position: sticky; top: var(--kopf-hoehe, 0px); z-index: var(--z-sticky); height: 34px; padding: 0 12px; background: var(--surface-2);
    border-bottom: 1px solid var(--border); font-size: var(--fs-12); font-weight: 500; color: var(--text-3);
    white-space: nowrap; letter-spacing: 0;
  }
  .tabelle td {
    height: var(--row); padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
    color: var(--text-2); vertical-align: middle;
  }
  .tabelle tbody tr:last-child td { border-bottom: 0; }
  .tabelle tbody tr:hover td { background: var(--surface-hover); }
  .tabelle .rechts { text-align: right; }
  .tabelle .zahl { font-variant-numeric: tabular-nums; }
  .tabelle .schnitt { max-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .tabelle tr[aria-current="true"] td { background: var(--accent-subtle); }
  .tabelle tr[aria-current="true"] td:first-child { box-shadow: inset 2px 0 0 var(--accent-line); }
  /* Focus and jump targets stop below the sticky head (its height is in --klebkopf of base.css, added to
     scroll-padding-top; WCAG 2.4.11); below 560 px of height nothing sticks (spec §3.2) */
  @media (max-height: 559px) { .tabelle th { position: static; } }

  /* ── Filter chips: empty slot (dashed), active (accent + own × button), on/off (aria-pressed) ── */
  .filterleiste { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .chip {
    display: inline-flex; align-items: center; gap: 6px; height: var(--h-md); padding: 0 10px; border-radius: var(--r-sm);
    border: 1px solid var(--border-input); background: var(--surface); font-size: var(--fs-13); color: var(--text-2);
    white-space: nowrap; font-weight: 500; max-width: 100%;
  }
  .chip .icon { color: var(--text-3); width: 14px; height: 14px; }
  .chip:hover { background: var(--surface-hover); color: var(--text); }
  .chip__wert { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
  .chip[data-aktiv], .chip[aria-pressed="true"] { background: var(--accent-subtle); border-color: var(--accent-line); color: var(--text); }
  .chip[data-aktiv] .icon, .chip[aria-pressed="true"] .icon { color: var(--accent-text); }
  /* Empty slot "add a restriction" – the only dashed line besides the drop zone */
  .chip--leer { border-style: dashed; background: transparent; color: var(--text-2); }
  .chip--klein { height: 28px; padding: 0 8px; gap: 5px; font-size: var(--fs-12); }
  .chip--klein .icon { width: 14px; height: 14px; }
  .chip__x { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; border-radius: 4px; color: var(--text-2); position: relative; }
  .chip__x::before { content: ""; position: absolute; inset: -3px; }
  .chip__x:hover { background: var(--accent-subtle-hover); color: var(--text); }
  .chipgruppe { display: inline-flex; max-width: 100%; }
  .chip--teil { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
  .chip--x { width: 32px; padding: 0; justify-content: center; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; flex: none; }
  .chip--klein.chip--x { width: 28px; }
  .chip--klein.chip--x .icon { width: 12px; height: 12px; }
  .chipgruppe[data-aktiv] .chip { background: var(--accent-subtle); border-color: var(--accent-line); color: var(--text); }
  .chipgruppe[data-aktiv] .chip .icon { color: var(--accent-text); }
  .chipgruppe[data-aktiv] .chip--x { border-left: 1px solid var(--accent-line); }

  /* ── Command palette (<dialog>, combobox + listbox; built by C) ── */
  .palette {
    width: min(640px, calc(100vw - 24px)); margin: 12vh auto auto; border-radius: var(--r-xl); overflow: hidden;
    background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-dialog); color: var(--text);
  }
  .palette::backdrop { background: var(--scrim); }
  .palette__feld { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--border); }
  .palette__feld .icon { color: var(--text-3); }
  .palette__feld input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: var(--fs-16); color: var(--text); }
  .palette__liste { list-style: none; max-height: 420px; overflow: auto; padding: 6px; }
  .palette__gruppe { padding: 10px 10px 4px; font-size: var(--fs-12); font-weight: 500; color: var(--text-3); }
  .palette__eintrag { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; border-radius: var(--r-sm); color: var(--text); cursor: pointer; }
  .palette__eintrag .icon { color: var(--text-3); }
  .palette__eintrag > span:first-of-type { min-width: 0; overflow-wrap: anywhere; }
  .palette__eintrag[aria-selected="true"] { background: var(--accent-subtle); box-shadow: inset 2px 0 0 var(--accent-line); }
  .palette__eintrag[aria-selected="true"] .icon { color: var(--accent-text); }
  .palette__unter { display: block; font-size: var(--fs-12); line-height: 16px; color: var(--text-3); overflow-wrap: anywhere; }
  .palette__zusatz { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; }
  .palette__fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 40px; padding: 6px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-12); color: var(--text-3); }
  .palette__fuss span { display: inline-flex; align-items: center; gap: 6px; }

  /* ── Brand mark: "#" on an ink tile – the mail number is the app's citation unit. No amber (Q24). ── */
  .bildmarke { width: 24px; height: 24px; flex: none; display: block; }
  .bildmarke--gross { width: 40px; height: 40px; }
  .bildmarke__grund { fill: var(--text); }
  .bildmarke__linie { fill: none; stroke: var(--surface); stroke-width: 1.9; stroke-linecap: round; }

  @keyframes schimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
  @keyframes drehen { to { transform: rotate(360deg); } }
  @keyframes blinken { 50% { opacity: 0; } }
  @keyframes ablauf { from { transform: scaleX(1); } to { transform: scaleX(0); } }

  /* ── Windows contrast mode: every state shows via border, outline or icon (spec §10) ── */
  @media (forced-colors: active) {
    .zeile[aria-current="true"], .tabelle tr[aria-current="true"] td:first-child, .palette__eintrag[aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
    .segment label:has(input:checked), .chip[data-aktiv], .chip[aria-pressed="true"], .chipgruppe[data-aktiv] .chip { outline: 2px solid Highlight; outline-offset: -2px; }
    .knopf[aria-pressed="true"], .ikon[aria-pressed="true"], .menue__punkt[data-aktiv] { outline: 2px solid Highlight; outline-offset: -2px; }
    mark.kern { forced-color-adjust: none; background: Mark; color: MarkText; text-decoration: underline 2px; text-underline-offset: 3px; }
    mark.treffer { forced-color-adjust: none; background: Mark; color: MarkText; }
    .strich { text-decoration: underline dotted 1px; text-underline-offset: 4px; }
    .auszug, .stelle-block { border-left-color: CanvasText; }
    .marke--dok { forced-color-adjust: none; background: Mark; color: MarkText; border: 1px solid MarkText; }
    .marke--kat { border: 1px dashed CanvasText; border-radius: 2px; }
    .marke[aria-current="true"] { outline: 2px solid Highlight; }
    .beleg[aria-current="true"], .kartei[aria-current="true"] { outline: 2px solid Highlight; }
    .pille, .fristmarke, .tag, .ikon__zahl, .mailref, .kbd { border: 1px solid CanvasText; }
    .tip, .menue, .vorschau, .toast, .dialog { border: 1px solid CanvasText; }
    .punkt { border: 1px solid CanvasText; }
    /* Switch: backgrounds become Canvas, so the knob would vanish and on/off look the same – the knob keeps
       CanvasText, "on" fills the track with Highlight (position and fill: two cues, R22) */
    .schalter { border-color: CanvasText; }
    .schalter::after { forced-color-adjust: none; background: CanvasText; }
    .schalter:checked { forced-color-adjust: none; background: Highlight; border-color: Highlight; }
    .schalter:checked::after { background: HighlightText; }
    [data-markierung="aus"] mark.kern, [data-markierung="aus"] mark.treffer { forced-color-adjust: auto; background: none; color: inherit; text-decoration: none; }
    [data-markierung="aus"] .strich { text-decoration: none; }
    [data-markierung="aus"] .stelle-block { border-left-color: transparent; }
  }
}
