/* Owner: F (access and administration). Login and the second step of the login, Mein Zugang, Bestand und Abruf,
   Freigabe, Benutzer, Protokoll (spec §5.1, §5.12–§5.16; reference W/design/final/mockup/css/verwaltung.css).
   Layer "pages", tokens only. States only through attributes (aria-*, data-aktiv, data-ton, hidden). The page head,
   the meta line and the panel belong to layout.css (C); the pages react to the panel width (@container haupt). */
@layer pages {

  /* ═══ Shared by the pages of F ═══ */
  .verwaltung { display: grid; gap: 32px; min-width: 0; }
  .verwaltung > * { min-width: 0; }
  .verwaltung > .abschnitt + .abschnitt, .verwaltung .abschnitt + .abschnitt { margin-top: 0; }
  .verwaltung--schmal > * { max-width: 760px; }
  .verwaltung > .fussnote { margin-top: -12px; }
  .seitenmeldung:empty { display: none; }
  .zweit { display: block; font-size: var(--fs-12); line-height: 16px; color: var(--text-3); font-weight: 400; white-space: normal; }
  /* the visible reason why the actions in the head wait ("Ein Lauf ist aktiv.") */
  .seitenkopf__aktionen .aktionsgrund { flex-basis: 100%; text-align: right; font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
  .seitenkopf__aktionen:has(> .aktionsgrund) { justify-content: flex-end; }   /* the buttons stay at the right edge */
  .seitenkopf__aktionen .knopf--umbruch { min-height: var(--h-md); padding-block: 5px; }
  @container haupt (max-width: 640px) {
    .seitenkopf__aktionen .aktionsgrund { text-align: left; }
    .seitenkopf__aktionen:has(> .aktionsgrund) { justify-content: flex-start; }
  }

  /* ═══ Login (spec §5.1): frame colour with a fine 32-px grid, the brand, the card ═══ */
  .anmeldung {
    position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px;
    background-color: var(--bg); isolation: isolate;
  }
  .anmeldung::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background-image:
      linear-gradient(var(--border-strong) 1px, transparent 1px),
      linear-gradient(90deg, var(--border-strong) 1px, transparent 1px);
    background-size: 32px 32px; background-position: center center;
    -webkit-mask-image: radial-gradient(ellipse 46% 52% at 50% 46%, var(--text) 0%, transparent 100%);
    mask-image: radial-gradient(ellipse 46% 52% at 50% 46%, var(--text) 0%, transparent 100%);
    opacity: 0.55;
  }
  .anmeldung__spalte { width: min(400px, 100%); display: grid; gap: 20px; position: relative; }
  .anmeldung__spalte:has(.anmeldeform--breit) { width: min(760px, 100%); }
  .anmeldung__marke { display: grid; justify-items: center; gap: 12px; text-align: center; }
  .anmeldung__name { display: block; font-size: var(--fs-22); line-height: 28px; font-weight: 650; letter-spacing: -0.02em; color: var(--text); }
  .anmeldung__unter { display: block; margin: 2px auto 0; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); max-width: 34ch; }
  .anmeldekarte {
    padding: 24px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-pop);
  }
  .anmeldeform { display: grid; gap: 16px; min-width: 0; }
  .anmeldeform__titel { justify-self: start; font-size: var(--fs-16); line-height: 24px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
  .anmeldeform__titel:focus { outline: none; }
  .anmeldeform__titel:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
  .anmeldeform__text { margin-top: -8px; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); }
  .anmeldeform__fehler:empty { display: none; }
  .anmeldeform .knopf--primaer { margin-top: 4px; }
  .anmeldeform__neben { display: flex; justify-content: center; margin-top: -8px; }
  .anmeldung__hilfe { font-size: var(--fs-13); line-height: 20px; color: var(--text-2); text-align: center; text-wrap: balance; }
  .anmeldung__fuss { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
  .anmeldung__fuss span { display: inline-flex; align-items: center; gap: 6px; }
  .anmeldung__fuss .icon { width: 14px; height: 14px; }
  /* the code of the app: large digits with some air between them */
  .feld-gruppe--code input { font-size: var(--fs-18); letter-spacing: 0.18em; font-variant-numeric: tabular-nums; }
  .feld-gruppe--code input::placeholder { letter-spacing: 0.18em; }

  /* Setting up the second step: three numbered steps, the QR code always black on white (its white quiet zone is the
     tile), the key in groups of four. Two columns from 1024 px – fits 1280 × 800 without scrolling. */
  .zf { display: grid; gap: 18px; grid-template-areas: "schritte" "qr" "code"; counter-reset: zf-schritt; }
  .zf__schritte { grid-area: schritte; list-style: none; display: grid; gap: 14px; margin: 0; padding: 0; }
  .zf__schritte--code { grid-area: code; }
  .zf__schritt { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 12px; align-items: start; counter-increment: zf-schritt; }
  .zf__schritt::before {
    content: counter(zf-schritt); grid-row: 1 / span 3; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px;
    border-radius: var(--r-full); background: var(--chip); color: var(--text); font-size: var(--fs-12); line-height: 1; font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  .zf__schritt-titel { font-size: var(--fs-14); line-height: 22px; font-weight: 500; color: var(--text); }
  .zf__schritt-text { font-size: var(--fs-13); line-height: 20px; color: var(--text-2); }
  .zf__code { display: grid; gap: 12px; margin-top: 10px; }
  .zf__code .anmeldeform__neben { margin-top: -4px; }
  .zf__qr { grid-area: qr; display: grid; justify-items: center; align-content: start; gap: 10px; min-width: 0; }
  .zf__kachel { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; line-height: 0; max-width: 100%; }
  .qr { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
  .zf__schluesselzeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; max-width: 100%; }
  .zf__schluessel {
    font-family: var(--font-mono); font-size: var(--fs-14); line-height: 20px; letter-spacing: 0.02em;
    color: var(--text); user-select: all; overflow-wrap: anywhere; text-align: center;
  }
  .zf__eintrag { font-size: var(--fs-13); line-height: 20px; color: var(--text-2); text-align: center; overflow-wrap: anywhere; }
  .zf__eintrag b { font-weight: 600; color: var(--text); }
  /* "In Authenticator-App öffnen" (otpauth:) only where the app is on the same device: phones and touch screens */
  @media (min-width: 760px) and (pointer: fine) { .zf__app { display: none; } }
  /* touch: "Anmelden" and the eye of the password field are 44-px targets like the drawer (audit §6.1/§6.7); the
     large field grows by its border so that the eye fits inside */
  @media (pointer: coarse) {
    .anmeldung .knopf--gross { height: var(--h-xl); }
    .anmeldung .feld--gross { height: calc(var(--h-xl) + 2px); }
    .anmeldung .feld__knopf { width: var(--h-xl); height: var(--h-xl); margin-right: -10px; }
  }
  @media (min-width: 1024px) {
    .anmeldeform--breit .zf { grid-template-columns: minmax(0, 1fr) minmax(285px, 340px); grid-template-areas: "schritte qr" "code qr"; column-gap: 32px; align-items: start; }
    .anmeldeform--breit .zf__qr { padding-top: 2px; }
    /* the wide step fits 1280 × 800: the brand in one row above it */
    .anmeldung:has(.anmeldeform--breit) { padding-block: 24px; }
    .anmeldung__spalte:has(.anmeldeform--breit) { gap: 16px; }
    .anmeldung__spalte:has(.anmeldeform--breit) .anmeldung__marke { grid-auto-flow: column; justify-content: center; align-items: center; gap: 14px; text-align: left; }
    .anmeldung__spalte:has(.anmeldeform--breit) .anmeldung__unter { max-width: none; margin: 0; }
  }
  /* the session dialog (401): the same steps in the body of a dialog */
  .dialog--anmeldung .anmeldeform { gap: 14px; }
  .dialog--anmeldung .anmeldung__hilfe { text-align: left; text-wrap: wrap; }
  .dialog--anmeldung:has(.anmeldeform--breit) { width: min(640px, calc(100vw - 32px)); }

  /* ═══ Mein Zugang (spec §5.16) ═══ */
  .profil { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
  .profil__text { display: grid; gap: 4px; min-width: 0; }
  .profil__name { font-size: var(--fs-15); line-height: 22px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
  .profil__unter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); }
  .profil__benutzer { color: var(--text-2); overflow-wrap: anywhere; }
  .kontoliste { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; padding: 14px 16px; font-size: var(--fs-13); line-height: 20px; }
  .kontoliste dt { color: var(--text-3); white-space: nowrap; }
  .kontoliste dd { color: var(--text); overflow-wrap: anywhere; }
  .formular { display: grid; gap: 16px; max-width: 420px; }
  .formular__fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .einstellung { display: grid; gap: 8px; justify-items: start; }
  .einstellung .segment-gruppe { display: grid; }
  .einstellung .feld-hilfe { max-width: 60ch; }
  /* strength of a new password: four bars of 3 px */
  .staerke { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
  .staerke span { height: 3px; border-radius: 2px; background: var(--surface-active); }
  .staerke span.an { background: var(--success-dot); }

  /* ═══ Benutzer (spec §5.14) ═══ */
  .person { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .person__name { display: grid; line-height: 18px; min-width: 0; }
  .person__name b { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
  .person__name span { font-size: var(--fs-12); line-height: 16px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
  .tabelle--nutzer td { height: 56px; vertical-align: middle; }
  .tabelle--nutzer td:first-child, .tabelle--nutzer th:first-child { padding-left: 16px; }
  .tabelle--nutzer td:last-child, .tabelle--nutzer th:last-child { padding-right: 10px; }
  .tabelle--nutzer .zweit { margin-top: 2px; }
  .tabelle--nutzer .k-person { max-width: 260px; }
  /* Below 760 px panel width (also 200 % zoom on a laptop): row cards with labelled values, no sideways scrolling */
  @container haupt (max-width: 760px) {
    .tabelle--nutzer thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .tabelle--nutzer, .tabelle--nutzer tbody { display: block; }
    .tabelle--nutzer tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 10px 12px 14px; border-bottom: 1px solid var(--border); }
    .tabelle--nutzer tbody tr:last-child { border-bottom: 0; }
    .tabelle--nutzer td { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; height: auto; padding: 0; border: 0; white-space: normal; }
    .tabelle--nutzer td:first-child { padding-left: 0; max-width: none; }
    .tabelle--nutzer td:nth-child(1) { grid-column: 1; grid-row: 1; }
    .tabelle--nutzer td:last-child { grid-column: 2; grid-row: 1; padding-right: 0; }
    .tabelle--nutzer td:not(:first-child):not(:last-child) { grid-column: 1 / -1; }
    .tabelle--nutzer td[data-label]::before { content: attr(data-label); min-width: 11ch; font-size: var(--fs-12); color: var(--text-3); }
    .tabelle--nutzer .zweit { display: inline; margin: 0; }
    .tabelle--nutzer tbody tr:hover td { background: none; }
  }
  /* dialogs: role, switch row, hand-over note, success panel */
  .dialoginhalt { display: grid; gap: 16px; min-width: 0; }
  .rollenwahl { display: grid; }
  .segment--breit { display: flex; width: 100%; }
  .segment--breit label { flex: 1; justify-content: center; height: 32px; font-size: var(--fs-14); }
  .schalterzeile { min-height: 36px; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); align-items: flex-start; padding-top: 8px; }
  .schalterzeile .schalter { margin-top: 1px; }
  .uebergabe {
    display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-13); line-height: 20px; color: var(--text-2);
  }
  .uebergabe .icon { margin-top: 2px; color: var(--text-3); }
  .erfolg { display: grid; gap: 14px; justify-items: start; }
  .erfolg__icon {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-full);
    background: var(--success-subtle); color: var(--success-text); border: 1px solid var(--success-border);
  }
  .erfolg__icon .icon { width: 20px; height: 20px; stroke-width: 2.25; }
  .erfolg__titel { font-size: var(--fs-15); line-height: 22px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
  .erfolg__titel:focus { outline: none; }
  .erfolg__schritte { display: grid; gap: 6px; padding-left: 20px; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); }
  .erfolg__schritte li::marker { color: var(--text-3); font-variant-numeric: tabular-nums; }
  .erfolg .feld-gruppe { width: 100%; }
  .erfolg__aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
  .befristen { display: grid; gap: 12px; }
  .befristen__schnell { display: flex; flex-wrap: wrap; gap: 8px; }

  /* ═══ Bestand und Abruf (spec §5.12) ═══ */
  .dienste { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
  .dienst { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; min-width: 0; }
  .dienst__kopf { display: flex; align-items: center; gap: 8px; }
  .dienst__kopf .icon { color: var(--text-3); }
  .dienst__kopf h2 { font-size: var(--fs-14); line-height: 20px; font-weight: 600; letter-spacing: -0.006em; }
  .dienst__zustand { display: flex; align-items: center; gap: 8px; font-size: var(--fs-13); line-height: 20px; font-weight: 500; color: var(--text); }
  .dienst__zeit, .dienst__text { font-size: var(--fs-13); line-height: 20px; color: var(--text-2); overflow-wrap: anywhere; }
  .dienst__zahl { font-size: var(--fs-13); color: var(--text-2); }
  .dienst__zahl b { font-size: var(--fs-22); line-height: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); margin-right: 2px; }
  .dienst__wert { color: var(--text); font-weight: 500; }
  .dienst__aktion { margin-top: auto; padding-top: 6px; }
  /* the run: step, duration, progress bar (4 px indigo), result */
  .lauf { display: grid; gap: 10px; padding: 14px 16px; }
  .lauf__kopf { display: flex; align-items: center; gap: 10px; }
  .lauf__kopf > .icon { color: var(--success-text); flex: none; }
  .lauf__kopf[data-zustand="laeuft"] > .icon { color: var(--accent-text); }
  .lauf__kopf[data-ton="gefahr"] > .icon { color: var(--danger-text); }
  .lauf__titel { font-size: var(--fs-14); line-height: 20px; font-weight: 500; color: var(--text); }
  .lauf__schritt { font-size: var(--fs-13); line-height: 20px; color: var(--text-2); overflow-wrap: anywhere; }
  .lauf__leer { font-size: var(--fs-13); color: var(--text-3); }
  .lauf__balken { position: relative; height: 4px; border-radius: 2px; background: var(--surface-active); overflow: hidden; }
  .lauf__fuellung { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; background: var(--accent); transition: width var(--dur-3) var(--ease-out); }
  .lauf__balken:not([aria-valuenow]) .lauf__fuellung { width: 30%; animation: laufband 1.4s var(--ease-in-out) infinite; }
  @keyframes laufband { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
  @media (prefers-reduced-motion: reduce) { .lauf__balken:not([aria-valuenow]) .lauf__fuellung { animation: none; width: 100%; opacity: 0.35; } }
  .lauf__ergebnis { display: grid; gap: 2px; padding-left: 18px; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); }
  .lauf__ergebnis li::marker { color: var(--text-3); }
  .lauf + .klappe { margin-top: 8px; }
  .konsole {
    max-height: 320px; overflow: auto; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface-sunken); color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-13); line-height: 20px;
    letter-spacing: 0.02em; white-space: pre-wrap; overflow-wrap: anywhere;
  }
  .konsole:empty { display: none; }
  .konsole--klein { max-height: 160px; font-size: var(--fs-12); line-height: 18px; margin-top: 4px; }
  /* the drop zone – the only dashed surface besides the empty filter slot */
  .ablagezone {
    display: grid; justify-items: center; gap: 8px; padding: 22px 16px; text-align: center;
    border: 1px dashed var(--border-input); border-radius: var(--r-md); background: var(--surface-2);
    transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
  }
  .ablagezone[data-aktiv] { background: var(--accent-subtle); border-color: var(--accent-line); border-style: solid; }
  .ablagezone[aria-busy="true"] { cursor: progress; }
  .ablagezone__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
  .ablagezone__icon .icon { width: 20px; height: 20px; }
  .ablagezone[data-aktiv] .ablagezone__icon { color: var(--accent-text); border-color: var(--accent-line); }
  .ablagezone__text { display: grid; gap: 2px; }
  .ablagezone__titel { font-size: var(--fs-14); line-height: 20px; font-weight: 500; color: var(--text); }
  .ablagezone__typen { font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }
  .ablage__ergebnis { display: grid; gap: 8px; margin-top: 10px; }
  /* rebuilding the index: set apart, a sentence on duration and load */
  .gefahrbereich {
    display: grid; justify-items: start; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md);
    font-size: var(--fs-13); line-height: 20px; color: var(--text-2);
  }
  .gefahrbereich p { max-width: 75ch; }
  .technik { display: grid; grid-template-columns: minmax(120px, auto) minmax(0, 1fr); gap: 10px 20px; padding: 4px 0 4px 32px; font-size: var(--fs-13); line-height: 20px; }
  .technik dt { color: var(--text-3); }
  .technik dd { color: var(--text-2); display: grid; gap: 2px; overflow-wrap: anywhere; }
  @container haupt (max-width: 600px) {
    .technik { grid-template-columns: minmax(0, 1fr); gap: 2px; padding-left: 0; }
    .technik dd + dt { margin-top: 10px; }
  }

  /* ═══ Freigabe (spec §5.13) ═══ */
  .regeln__satz { font-size: var(--fs-14); line-height: 22px; color: var(--text); }
  .regeln__liste { display: grid; gap: 2px; margin-top: 6px; padding-left: 18px; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); max-width: 90ch; }
  .regeln__liste li::marker { color: var(--text-3); }
  .regeln__gruende { margin-top: 12px; }
  .regeln__gruende .pille { white-space: normal; height: auto; min-height: 20px; }
  .freigabe-werkzeuge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
  .freigabe-werkzeuge .segment { flex: none; }
  .freigabe-werkzeuge .filterleiste { flex: 0 1 auto; }
  .freigabe-suche { width: min(240px, 100%); }
  .trefferzeile { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 10px; font-size: var(--fs-13); line-height: 20px; color: var(--text-2); }
  .trefferzeile b { color: var(--text); font-weight: 600; }
  .seitenmeldung + .box, .seitenmeldung:not([hidden]) { margin-bottom: 12px; }
  /* fixed layout: the subject takes what the other columns leave, long texts end in an ellipsis instead of widening */
  .tabelle--freigabe { table-layout: fixed; }
  .tabelle--freigabe th.c-nr { width: 82px; }
  .tabelle--freigabe th.c-datum { width: 142px; }
  .tabelle--freigabe th.c-wer { width: 18%; }
  .tabelle--freigabe th.c-status { width: 106px; }
  .tabelle--freigabe th.c-grund { width: 216px; }
  .tabelle--freigabe th.c-aktion { width: 134px; }
  .tabelle--freigabe td:first-child, .tabelle--freigabe th:first-child { padding-left: 16px; }
  .tabelle--freigabe td:last-child, .tabelle--freigabe th:last-child { padding-right: 12px; }
  .tabelle--freigabe .k-wer, .tabelle--freigabe .k-betreff, .tabelle--freigabe .k-grund { overflow: hidden; text-overflow: ellipsis; }
  .tabelle--freigabe td.k-aktion { padding-block: 6px; }
  .tabelle--freigabe .k-wer { color: var(--text-2); }
  .tabelle--freigabe .k-wer .pfeil { padding: 0 4px; }
  .tabelle--freigabe .k-betreff .zeile__link { color: var(--text); font-weight: 500; }
  /* the link ends at its cell (cut with an ellipsis): a box as wide as the text would reach the row's buttons and
     leave too little room around the targets (axe target-size, 2.5.8) */
  .tabelle--freigabe .k-betreff .zeile__link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabelle--freigabe .k-betreff .zeile__link.text-2 { color: var(--text-2); font-weight: 400; }
  .tabelle--freigabe .k-grund .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 18px; }
  .tabelle--freigabe .k-grund-kurz { display: none; }
  .k-knoepfe { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .tabelle .ueber { position: relative; z-index: 1; }
  .tabelle tr.leerzeile td { white-space: normal; height: auto; }
  .tabelle tbody tr.leerzeile:hover td { background: none; }
  /* The subject keeps at least ≈ 200 px at every panel width (spec §5.13: its link opens the preview):
     > 1180 px  all columns;
     1001–1180  the reason goes under the pill (1180 × 800 and 1366 × 768 without the pane);
     641–1000   two lines per row – #Nr · subject / date · from → to, the state with its reason and the action at the
                right (beside the reading pane at 1366–1920 px, tablets, 1024 px without the pane);
     ≤ 640      row cards (#Nr · date · state / subject / who / reason · action). */
  @container haupt (max-width: 1180px) {
    .tabelle--freigabe th.c-grund, .tabelle--freigabe td.k-grund { display: none; }
    .tabelle--freigabe .k-grund-kurz { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
    .tabelle--freigabe th.c-wer { width: 16%; }
    .tabelle--freigabe th.c-status { width: 196px; }
    .tabelle--freigabe td.k-status { white-space: normal; padding-block: 6px; }
  }
  @container haupt (max-width: 1000px) {
    .tabelle--freigabe thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .tabelle--freigabe, .tabelle--freigabe tbody { display: block; }
    /* fixed tracks, so the subjects and pills of all rows start at the same x */
    .tabelle--freigabe tr {
      display: grid; grid-template-columns: 54px max-content minmax(0, 1fr) 140px minmax(104px, max-content);
      align-items: center; gap: 2px 12px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border);
    }
    .tabelle--freigabe tbody tr:last-child { border-bottom: 0; }
    .tabelle--freigabe td, .tabelle--freigabe td:first-child, .tabelle--freigabe td:last-child { display: block; height: auto; padding: 0; border: 0; min-width: 0; max-width: none; }
    .tabelle--freigabe td[colspan] { grid-column: 1 / -1; white-space: normal; }   /* loading, empty state */
    .tabelle--freigabe td.k-nr { grid-column: 1; grid-row: 1; }
    .tabelle--freigabe td.k-betreff { grid-column: 2 / 4; grid-row: 1; }
    .tabelle--freigabe td.k-datum { grid-column: 2; grid-row: 2; font-size: var(--fs-13); line-height: 18px; }
    /* position: the cell also clips its hidden " an " (absolute), which otherwise reaches past the row */
    .tabelle--freigabe td.k-wer { position: relative; grid-column: 3; grid-row: 2; font-size: var(--fs-13); line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tabelle--freigabe td.k-status { grid-column: 4; grid-row: 1 / 3; padding: 0; }
    .tabelle--freigabe td.k-status .k-grund-kurz { overflow-wrap: anywhere; }
    .tabelle--freigabe td.k-aktion { grid-column: 5; grid-row: 1 / 3; padding: 0; }
    .tabelle--freigabe .k-knoepfe { flex-direction: column; align-items: flex-end; }   /* "Sperren" over "Regel anwenden" */
    .tabelle--freigabe tbody tr:hover td { background: none; }
    .tabelle--freigabe tbody tr:hover { background: var(--surface-hover); }
    .tabelle--freigabe tr[aria-current="true"] { background: var(--accent-subtle); box-shadow: inset 2px 0 0 var(--accent-line); }
    .tabelle--freigabe tr[aria-current="true"] td { background: none; box-shadow: none; }
  }
  @container haupt (max-width: 640px) {
    /* on a phone the worklist comes first, the rules (reference) after it */
    .freigabe-regeln { order: 2; }
    /* the segment spans the width; word above count, so four options fit down to 320 px */
    .freigabe-werkzeuge .segment { display: flex; width: 100%; }
    .freigabe-werkzeuge .segment label {
      flex: 1 1 0; flex-direction: column; justify-content: center; gap: 0; height: auto; min-height: 40px; padding: 3px 2px;
      line-height: 16px; text-align: center; white-space: normal; overflow-wrap: anywhere;
    }
    .freigabe-werkzeuge .segment .icon { display: none; }
    /* row cards: the grid of the two-line rows above with other tracks */
    .tabelle--freigabe tr { grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 12px 10px 14px; }
    .tabelle--freigabe td, .tabelle--freigabe td:first-child, .tabelle--freigabe td:last-child { white-space: normal; }
    .tabelle--freigabe td.k-nr { grid-column: 1; grid-row: 1; }
    .tabelle--freigabe td.k-datum { grid-column: 2; grid-row: 1; align-self: center; font-size: var(--fs-13); color: var(--text-2); }
    .tabelle--freigabe td.k-status { grid-column: 3; grid-row: 1; padding: 0; }
    .tabelle--freigabe td.k-status .k-grund-kurz { display: none; }
    .tabelle--freigabe td.k-betreff { grid-column: 1 / -1; grid-row: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tabelle--freigabe td.k-wer { grid-column: 1 / -1; grid-row: 3; }
    .tabelle--freigabe td.k-grund { display: block; grid-column: 1 / 3; grid-row: 4; align-self: center; min-width: 0; }
    .tabelle--freigabe td.k-aktion { grid-column: 3; grid-row: 4; }
    .tabelle--freigabe .k-knoepfe { flex-direction: row; align-items: center; }
    .freigabe-suche { width: 100%; }
  }

  /* The release dialog asks for whom (ui/freigaberegel.js – also opened from the mail page and the reading pane):
     every reader, or the accounts ticked below the second choice. */
  .freigabe-fuer { display: grid; gap: 10px; justify-items: start; }
  .freigabe-fuer legend { font-size: var(--fs-13); font-weight: 600; color: var(--text); margin-bottom: 8px; }
  .freigabe-fuer .wahl { align-items: flex-start; }
  .freigabe-fuer input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 1px 0 0; flex: none; }
  .freigabe-fuer__zugaenge { display: grid; gap: 8px; padding-left: 24px; justify-items: start; }

  /* ═══ Protokoll (spec §5.15): day groups with sticky heads, one line per entry, the raw record below ═══ */
  .protokoll-filter .werkzeuge__trenner { height: 20px; margin: 0 2px; }
  .protokoll { display: grid; gap: 20px; }
  .protokoll:empty { display: none; }
  .protokolltag__kopf {
    position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: 8px; height: 36px;
    margin-bottom: 6px; background: var(--surface); font-size: var(--fs-13); line-height: 20px; font-weight: 600; color: var(--text);
  }
  .protokolltag__zahl { font-weight: 500; color: var(--text-3); }
  .protokolltag__zahl::before { content: "·"; margin-right: 8px; }
  .protokolltag__liste > .pzeile + .pzeile { border-top: 1px solid var(--border); }
  .pzeile > summary {
    position: relative; display: grid; grid-template-columns: 44px 18px minmax(130px, 190px) minmax(140px, 240px) minmax(0, 1fr) 16px;
    align-items: center; gap: 0 12px; min-height: var(--row); padding: 0 12px 0 16px; cursor: pointer; font-size: var(--fs-13); line-height: 20px;
    color: var(--text-2);
  }
  .pzeile > summary:hover { background: var(--surface-hover); }
  .pzeile > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  .pzeile[open] > summary { background: var(--surface-2); }
  .pzeile__zeit { color: var(--text); font-weight: 500; }
  .pzeile__icon { display: grid; place-items: center; color: var(--text-3); }
  .pzeile__icon .icon { width: 16px; height: 16px; }
  .pzeile__wer { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .pzeile__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
  .pzeile__aktion { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pzeile__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pzeile__text .mailref { vertical-align: 0; }
  .pzeile__frage { color: var(--text); }
  .pzeile__fehler { color: var(--danger-text); }
  /* a question: only the question is cut – its duration "(18,9 s)" stays in the row; an error keeps at least its
     start "(Fehler: …" and takes at most half of the row */
  .pzeile__text:has(> .pzeile__frage) { display: flex; align-items: baseline; gap: 4px; }
  .pzeile__text > .pzeile__frage { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pzeile__text > .pzeile__frage ~ .tnum { flex: none; }
  .pzeile__text > .pzeile__frage ~ .pzeile__fehler { flex: 0 1 auto; min-width: 9ch; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pzeile__pfeil { width: 14px; height: 14px; color: var(--text-3); transition: transform var(--dur-2) var(--ease-out); }
  .pzeile[open] .pzeile__pfeil { transform: rotate(90deg); }
  /* security events: shield-x and the action in red, the words say it as well */
  .pzeile[data-ton="gefahr"] .pzeile__icon, .pzeile[data-ton="gefahr"] .pzeile__aktion { color: var(--danger-text); }
  .pzeile__roh { display: grid; gap: 8px; padding: 10px 16px 14px 90px; border-top: 1px solid var(--border); background: var(--surface-2); }
  .pzeile__roh dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: var(--fs-12); line-height: 18px; }
  .pzeile__roh dt { color: var(--text-3); }
  .pzeile__roh dd { color: var(--text-2); overflow-wrap: anywhere; }
  .pzeile__daten { font-family: var(--font-mono); font-size: var(--fs-12); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
  .pzeile__links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-3); }
  .protokoll__fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; }
  @container haupt (max-width: 760px) {
    .protokoll-filter .werkzeuge__trenner { display: none; }
    .pzeile > summary { grid-template-columns: 44px 18px minmax(0, 1fr) 16px; grid-template-rows: auto auto auto; row-gap: 2px; padding-block: 8px; }
    .pzeile__zeit { grid-column: 1; grid-row: 1; }
    .pzeile__icon { grid-column: 2; grid-row: 1; }
    .pzeile__aktion { grid-column: 3; grid-row: 1; white-space: normal; }
    .pzeile__pfeil { grid-column: 4; grid-row: 1; }
    .pzeile__wer { grid-column: 3 / -1; grid-row: 2; }
    .pzeile__text { grid-column: 3 / -1; grid-row: 3; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
    .pzeile__text:empty { display: none; }
    /* a question wraps over two lines at most; the duration stays beside its last line */
    .pzeile__text:has(> .pzeile__frage) { display: flex; align-items: last baseline; }
    .pzeile__text > .pzeile__frage { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
    .pzeile__text > .pzeile__frage ~ .pzeile__fehler { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
    .pzeile__roh { padding-left: 16px; }
  }
  /* below the sticky phone header (--kopf-hoehe of layout.css: 48 px under 760 px, 0 on low screens) */
  .protokolltag__kopf { top: var(--kopf-hoehe, 0px); }

  /* ═══ Contrast mode ═══ */
  @media (forced-colors: active) {
    .lauf__fuellung, .staerke span.an { background: Highlight; forced-color-adjust: none; }
    .ablagezone[data-aktiv] { outline: 2px solid Highlight; outline-offset: -2px; }
    .zf__schritt::before { border: 1px solid CanvasText; }
    .zf__kachel { forced-color-adjust: none; }
    .pzeile[data-ton="gefahr"] .pzeile__aktion { text-decoration: underline; }
  }
}

@media print {
  @layer print {
    .anmeldung::before, .ablagezone, .gefahrbereich, .protokoll__fuss, .freigabe-werkzeuge { display: none; }
    .protokolltag__kopf { position: static; }
    .pzeile__pfeil { display: none; }
    .tabelle--freigabe .k-wer, .tabelle--freigabe .k-betreff { max-width: none; white-space: normal; }
  }
}
