/* LNXAVFeedbackExtern — user interface
 * ======================================================================
 *
 * Hand written, no framework, no build step: IONOS Webhosting Premium has
 * neither Node.js nor a bundler, so every asset is checked in ready to
 * serve (PLAN.md, "Frontend"; .claude/rules/ionos-deployment.md).
 *
 * Token system: every recurring value (spacing, font sizes, colours, radii,
 * shadows, transitions, widths) is declared as a custom property in :root
 * and referenced through var(--...). One change takes effect everywhere,
 * and values can be overridden per colour mode without touching a single
 * selector.
 *
 * Colour mode: the palette exists exactly ONCE. Every colour token is
 * declared twice — first the light value on its own, then the same value
 * inside light-dark(). A browser without light-dark() discards the second
 * line as invalid and keeps the first one; the portal stays light and fully
 * usable there. Without that fallback var(--...) would resolve to nothing
 * and the page would be unreadable. Which branch applies is decided solely
 * by color-scheme (section 1b).
 *
 * Class names are German on purpose (PLAN.md, "Frontend"): they match the
 * sister project D:\Repo\NTSFTP so both interfaces stay recognisable.
 * Comments and identifiers outside CSS follow the project rule and are
 * English.
 *
 * Breakpoint convention (deliberately NOT custom properties):
 *   The media query engine does not evaluate custom properties —
 *   `@media (min-width: var(--anything))` is invalid. Breakpoints are
 *   therefore written as plain numbers inside the @media rules and only
 *   documented here:
 *     - mobile first, min-width: 600px / 700px / 900px / 1200px
 *       (700px only for the job history of the admin area, section 11)
 *     - additionally (pointer: coarse) for touch operation
 *     - additionally (prefers-reduced-motion: reduce) for motion
 *
 * Outline of this file (PLAN.md, "Gliederung von app.css"). Sections 12 and
 * 15 belong to later phases and are intentionally absent; section 10 was
 * pulled forward with the legal texts (TASK-017), section 16 came with the
 * cookie notice (TASK-018), sections 6 to 9 and 14 came with the
 * questionnaire mask (TASK-013), and section 11 came with the admin area
 * (TASK-027, TASK-028):
 *    1.  Tokens (:root)                        9.  Free text + service areas
 *    1b. Colour mode                          10.  Static pages
 *    2.  Foundations                          11.  Admin
 *    3.  Header, navigation, footer           12.  Error pages
 *    4.  Building blocks                      13.  Utility classes
 *    5.  Messages                             14.  Input, motion, contrast
 *    6.  Forms                                15.  Print
 *    7.  Questionnaire — frame/question       16.  Cookie notice
 *    8.  Questionnaire — rating tiles
 */

/* === 1. Tokens ========================================================= */

:root {
    /* --- Brand anchors: never inverted, independent of the colour mode ---
     * These three come straight from the nts corporate design and are the
     * only colour tokens declared once: a light-dark() pair would imply
     * that a mode may change them. It may not.
     */
    --marke-blau: #003366;
    --marke-blau-2: #314F6F;
    --marke-grau: #575756;

    /* --- Logo: follows the colour mode so no white box appears on a dark
     * background. No filter: invert() — that turns #003366 into a garish
     * orange and would violate the corporate design. */
    --logo-blau: #003366;
    --logo-blau: light-dark(#003366, #ffffff);
    --logo-zusatz: #000000;
    --logo-zusatz: light-dark(#000000, #e6ebf2);

    /* --- Surfaces --------------------------------------------------------- */
    --grund: #f5f7fa;
    --grund: light-dark(#f5f7fa, #0e141b);
    --grund-versenkt: #eef1f6;              /* hover, table head */
    --grund-versenkt: light-dark(#eef1f6, #121a23);
    --flaeche: #ffffff;
    --flaeche: light-dark(#ffffff, #161e27);

    /* --- Borders ------------------------------------------------------------
     * --rand is purely decorative (card frames, separators) and carries no
     * contrast guarantee. Controls (form frames, buttons) use --rand-stark;
     * both modes stay above the 3:1 required by WCAG 1.4.11.
     */
    --rand: #d5dce5;                        /* decorative only */
    --rand: light-dark(#d5dce5, #2b3643);
    --rand-stark: #7d8794;                  /* light 3.64:1 - dark 3.72:1 */
    --rand-stark: light-dark(#7d8794, #6b7885);

    /* --- Text ---------------------------------------------------------------- */
    --text: #1a2430;                        /* light 15.7:1 - dark 15.5:1 */
    --text: light-dark(#1a2430, #e6ebf2);
    --text-schwach: #575756;                /* light 7.24:1 (= CD grey) - dark 8.24:1 */
    --text-schwach: light-dark(#575756, #a3aebd);

    /* --- Accent ----------------------------------------------------------------
     * #003366 reaches only 1.49:1 on a dark background and is unusable as an
     * accent there. The dark mode value #8fb8e6 (8.96:1) is derived from the
     * same blue ramp, it is not a second corporate colour. The untouched brand
     * value stays available as --marke-blau and is used for the logo only.
     */
    --akzent: #003366;                      /* light 12.61:1 - dark 8.96:1 */
    --akzent: light-dark(#003366, #8fb8e6);
    --akzent-stark: #0a4680;                /* hover */
    --akzent-stark: light-dark(#0a4680, #b3d1f0);
    --akzent-schwach: #dde7f2;              /* tint */
    --akzent-schwach: light-dark(#dde7f2, #1b2b3d);
    --akzent-text: #ffffff;                 /* text on --akzent */
    --akzent-text: light-dark(#ffffff, #0e141b);

    /* --- Focus ---------------------------------------------------------------- */
    --fokus: #003366;
    --fokus: light-dark(#003366, #8fb8e6);

    /* --- Status: success / error / notice --------------------------------------
     * Text colours are chosen for their own background, not for --flaeche:
     * a message paints its surface itself (section 5).
     */
    --erfolg-grund: #e6f4ea;
    --erfolg-grund: light-dark(#e6f4ea, #142a1d);
    --erfolg-text: #1a5c33;                 /* light 7.05:1 - dark 9.18:1 */
    --erfolg-text: light-dark(#1a5c33, #8fd9a8);
    --fehler-grund: #fdeaea;
    --fehler-grund: light-dark(#fdeaea, #33191b);
    --fehler-text: #a4232a;                 /* light 6.36:1 - dark 8.46:1 */
    --fehler-text: light-dark(#a4232a, #f4a7ab);
    --hinweis-grund: #fdf6e3;
    --hinweis-grund: light-dark(#fdf6e3, #2e2617);
    --hinweis-text: #6b5518;                /* light 6.63:1 - dark 9.76:1 */
    --hinweis-text: light-dark(#6b5518, #e8cf8a);

    /* --- Spacing ----------------------------------------------------------------
     * Six steps, no in-between values: anything without an exact match is
     * rounded up to the next step, never down.
     */
    --abstand-1: 0.25rem;   /* 4px */
    --abstand-2: 0.5rem;    /* 8px */
    --abstand-3: 0.75rem;   /* 12px */
    --abstand-4: 1rem;      /* 16px */
    --abstand-5: 1.5rem;    /* 24px */
    --abstand-6: 2rem;      /* 32px */

    /* --- Typography ---------------------------------------------------------------
     * --text-m is 16px on purpose: iOS zooms into an input field on focus when
     * its font size is below that.
     */
    --text-s: 0.8125rem;    /* 13px */
    --text-m: 1rem;         /* 16px */
    --text-l: 1.0625rem;    /* 17px */
    --text-xl: 1.375rem;    /* 22px */
    --text-xxl: 3.5rem;     /* 56px */
    --zeilenhoehe: 1.5;
    --zeilenhoehe-eng: 1.25;
    --fett-halb: 600;
    --fett: 700;

    /* --- Radius ---------------------------------------------------------------- */
    --radius-klein: 4px;
    --radius: 6px;
    --radius-gross: 10px;
    --radius-rund: 999px;

    /* --- Shadows -----------------------------------------------------------------
     * Only the colour is a token of its own, the geometry stays fixed:
     * light-dark() is not valid inside the box-shadow shorthand, it is
     * resolved per component value.
     */
    --schatten-farbe: rgba(26, 36, 48, 0.12);
    --schatten-farbe: light-dark(rgb(16 24 40 / 0.10), rgb(0 0 0 / 0.55));
    --schatten-1: 0 1px 2px var(--schatten-farbe);
    --schatten-2: 0 2px 8px var(--schatten-farbe);
    --schatten-3: 0 8px 24px var(--schatten-farbe);

    /* --- Motion ------------------------------------------------------------------- */
    --dauer-schnell: 120ms;
    --dauer: 200ms;

    /* --- Widths --------------------------------------------------------------------- */
    --breite-inhalt: 1100px;
    --breite-formular: 520px;
    --breite-karte: 400px;
}

/* === 1b. Colour mode ====================================================
 *
 * color-scheme does the entire switching: light-dark() resolves against the
 * computed color-scheme value. The portal follows the operating system
 * setting and nothing else — there is no manual switch, no script and no
 * stored preference. That is the deliberate difference to the sister project
 * (PLAN.md, "Token-System und Farbmodus"): this site is public and has
 * exactly one job, a switch would be surface without purpose.
 *
 * The @supports guard is required: without it a browser that understands
 * color-scheme but not light-dark() would paint its native controls and
 * scrollbars dark while our tokens stayed on the light values — dark
 * scrollbars on a light page.
 */
@supports (color: light-dark(#000, #fff)) {
    :root { color-scheme: light dark; }
}

/* === 2. Foundations ===================================================== */

* { box-sizing: border-box; }

/* html at 100% instead of a fixed pixel size on body: browser zoom keeps
 * working, and the body font size stays at --text-m (16px), which keeps iOS
 * from zooming into form fields on focus. */
html { font-size: 100%; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;

    /* System fonts only. No web font, no CDN, no data: URL — the content
     * security policy in public/.htaccess gets by without a single
     * exception because everything is served from our own host. */
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: var(--text-m);
    line-height: var(--zeilenhoehe);
    color: var(--text);
    background: var(--grund);
}

a { color: var(--akzent); }
a:hover { color: var(--akzent-stark); }

/* :focus-visible instead of :focus: the ring appears reliably for keyboard
 * operation (required by WCAG 2.4.7) but stays away on a mouse click. It is
 * declared here rather than with the form styles (section 6) because the
 * layout itself — skip link, navigation, footer — must be usable by
 * keyboard from the first page on. */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--fokus);
    outline-offset: 2px;
}

/* === 3. Header, navigation, footer ======================================
 *
 * No burger menu: there are exactly four navigation links. A burger would
 * need a focus trap, aria-expanded, escape and outside-click handling —
 * a lot of machinery to hide four links that can just as well stay
 * visible. On narrow screens the header breaks into two rows instead.
 */
.kopf {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "marke"
        "navigation";
    align-items: center;
    gap: var(--abstand-2) var(--abstand-5);
    padding: var(--abstand-2) var(--abstand-4);
    background: var(--flaeche);
    border-bottom: 1px solid var(--rand);
    box-shadow: var(--schatten-1);
}

.kopf .marke { grid-area: marke; }
.kopf .navigation { grid-area: navigation; }

@media (min-width: 900px) {
    .kopf {
        grid-template-columns: auto 1fr;
        grid-template-areas: "marke navigation";
        padding: var(--abstand-3) var(--abstand-5);
    }
}

.marke {
    display: flex;
    align-items: center;
    font-weight: var(--fett-halb);
    font-size: var(--text-l);
    line-height: var(--zeilenhoehe-eng);
    color: var(--text);
    text-decoration: none;
}

/* --- Logo -------------------------------------------------------------------
 * Aspect ratio of the source files: 964 x 455 (~2.12:1).
 *
 * Two explicit rules instead of light-dark(): the function only accepts
 * <color>, not <image>. This is the only place in the stylesheet where the
 * palette has to be maintained twice.
 *
 * Careful when replacing the files: these paths do not go through asset(),
 * so they carry no ?v=. A new logo therefore needs a new file name
 * (logo-nts-2.png), otherwise the immutable cache keeps the old one.
 */
.marke-logo {
    display: block;
    width: 5.3rem;
    height: 2.5rem;
    background: center / contain no-repeat url("/assets/img/logo-nts.png");
}

@media (prefers-color-scheme: dark) {
    .marke-logo { background-image: url("/assets/img/logo-nts-hell.png"); }
}

.navigation { display: flex; flex-wrap: wrap; gap: var(--abstand-1); }

.navigation a {
    padding: var(--abstand-2) var(--abstand-3);
    color: var(--akzent);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background-color var(--dauer-schnell) ease;
}

.navigation a:hover { background: var(--grund-versenkt); text-decoration: underline; }

/* The current page is marked by aria-current in the markup, so the styling
 * hangs off that attribute: state lives in exactly one place and screen
 * reader and eye get the same information. */
.navigation a[aria-current="page"] {
    background: var(--akzent-schwach);
    font-weight: var(--fett-halb);
}

/* flex: 1 pushes the footer to the bottom of short pages (body is a column
 * flex container with min-height: 100vh). */
.inhalt {
    flex: 1;
    width: 100%;
    max-width: var(--breite-inhalt);
    margin: var(--abstand-5) auto;
    padding: 0 var(--abstand-4);
}

@media (min-width: 600px) {
    .inhalt { padding: 0 var(--abstand-5); }
}

.fuss {
    padding: var(--abstand-5);
    color: var(--text-schwach);
    font-size: var(--text-s);
    text-align: center;
    border-top: 1px solid var(--rand);
}

/* === 4. Building blocks =================================================
 *
 * Only what the layout and the pages of this phase actually use. Further
 * blocks — the narrow card of the admin login, list and table styles —
 * arrive with the phase that needs them, together with their consumer.
 */

.karte {
    padding: var(--abstand-5);
    margin-bottom: var(--abstand-5);
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    box-shadow: var(--schatten-1);
}

h1 { font-size: var(--text-xl); line-height: var(--zeilenhoehe-eng); margin: 0 0 var(--abstand-4); }
h2 { font-size: var(--text-l); line-height: var(--zeilenhoehe-eng); margin: 0 0 var(--abstand-3); }
h3 { font-size: var(--text-m); line-height: var(--zeilenhoehe-eng); margin: var(--abstand-5) 0 var(--abstand-2); }

/* === 5. Messages ========================================================
 *
 * Three variants: success, error, notice (templates/partials/meldung.php).
 *
 * Colour is never the only carrier of meaning: each variant additionally
 * shows a symbol drawn in CSS and a visible text marker in the markup
 * ("Erfolg:", "Fehler:", "Hinweis:"). The same rule applies to the rating
 * scale in phase 3.
 *
 * The symbols are geometry, not characters: a check mark taken from a font
 * (U+2714) switches to emoji rendering on Android and iOS and is missing
 * from several fallback fonts, and an SVG data: URL would weaken the
 * content security policy.
 */
.meldung {
    display: flex;
    align-items: flex-start;
    gap: var(--abstand-3);
    padding: var(--abstand-3) var(--abstand-4);
    margin: 0 0 var(--abstand-4);

    /* currentColor: the border inherits the text colour of the variant and
     * therefore keeps the same contrast in both colour modes — a fixed
     * --rand would disappear on the coloured surface (WCAG 1.4.11). */
    border: 1px solid currentColor;
    border-radius: var(--radius);
}

.meldung-text { margin: 0; }
.meldung-marke { font-weight: var(--fett-halb); }

/* flex: none keeps the symbol from being squeezed by a long message. */
.meldung::before {
    content: '';
    flex: none;
    margin-top: 0.3em;
}

.meldung--erfolg { background: var(--erfolg-grund); color: var(--erfolg-text); }
.meldung--fehler { background: var(--fehler-grund); color: var(--fehler-text); }
.meldung--hinweis { background: var(--hinweis-grund); color: var(--hinweis-text); }

/* Check mark: a box rotated by 45 degrees showing two of its borders. */
.meldung--erfolg::before {
    width: 0.45em;
    height: 0.8em;
    margin-right: 0.15em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

/* Cross: two gradient bars across the same box. */
.meldung--fehler::before {
    width: 0.8em;
    height: 0.8em;
    background:
        linear-gradient(45deg, transparent calc(50% - 1px), currentColor calc(50% - 1px),
            currentColor calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(-45deg, transparent calc(50% - 1px), currentColor calc(50% - 1px),
            currentColor calc(50% + 1px), transparent calc(50% + 1px));
}

/* Exclamation mark: bar, gap, dot — one gradient with hard stops. */
.meldung--hinweis::before {
    width: 0.25em;
    height: 0.8em;
    background: linear-gradient(currentColor 0 60%, transparent 60% 75%, currentColor 75% 100%);
    border-radius: var(--radius-klein);
}

/* === 6. Forms ===========================================================
 *
 * Everything the forms of this portal are built from: the search field of
 * /Feedback/FindFeedback, the free text of the questionnaire and the submit
 * button of all three pages.
 *
 * Two rules run through the whole section:
 *   - A control frame uses --rand-stark, never the decorative --rand: a field
 *     the eye cannot find is not a field (WCAG 1.4.11 asks for 3:1 against the
 *     surrounding surface, which --rand does not promise).
 *   - Nothing that is a primary target is smaller than 56px (PLAN.md,
 *     "Barrierefreiheit": deliberately above the 44px of WCAG 2.5.8).
 */

.formular { max-width: var(--breite-formular); }

.feld { margin-bottom: var(--abstand-5); }

/* display: block so the label owns its own line — an inline label beside a
 * full width field wraps into the field on a narrow phone. */
.feld-marke {
    display: block;
    margin-bottom: var(--abstand-2);
    font-weight: var(--fett-halb);
}

.feld-eingabe {
    display: block;
    width: 100%;

    /* 3.5rem = 56px. min-height, not height: a field whose text wraps has to
     * grow rather than clip. */
    min-height: 3.5rem;
    padding: var(--abstand-3);

    /* An input does not inherit the page font on its own, and a font size
     * below --text-m (16px) makes iOS zoom into the field on focus. */
    font: inherit;
    color: var(--text);
    background: var(--flaeche);
    border: 2px solid var(--rand-stark);
    border-radius: var(--radius);
}

.feld-eingabe::placeholder { color: var(--text-schwach); }

/* The hint below a field. It is referenced by aria-describedby in the markup,
 * so it is read out together with the field and is not decoration. */
.feld-hinweis {
    margin: var(--abstand-2) 0 0;
    color: var(--text-schwach);
    font-size: var(--text-s);
}

/* Focus for the controls. Declared here and not in section 2, which covers
 * link, button and summary only. */
.feld-eingabe:focus-visible,
.notiz:focus-visible {
    outline: 3px solid var(--fokus);
    outline-offset: 2px;
}

/* A field the server rejected. The frame alone would be colour as the only
 * carrier — the error summary of section 7 names the same field in words. */
.feld-eingabe[aria-invalid="true"],
.notiz[aria-invalid="true"] { border-color: var(--fehler-text); }

.knopf {
    display: inline-block;

    /* Full width below 600px: a thumb hits a wide button, and a lonely button
     * on the left edge of a phone screen reads as an afterthought. */
    width: 100%;
    min-height: 3.5rem;
    padding: var(--abstand-3) var(--abstand-5);

    font: inherit;
    font-weight: var(--fett-halb);
    text-align: center;

    color: var(--akzent-text);
    background: var(--akzent);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color var(--dauer-schnell) ease;
}

.knopf:hover { background: var(--akzent-stark); }

/* app.js locks the button after the first click (data-einmal). The lock has to
 * be visible, otherwise a second click looks like a page that stopped working.
 * cursor: default rather than not-allowed: the submission is running, it is
 * not forbidden. */
.knopf:disabled {
    opacity: 0.65;
    cursor: default;
}

@media (min-width: 600px) {
    .knopf { width: auto; }
}

/* === 7. Questionnaire — frame and question ==============================
 *
 * The frame around one line of the questionnaire and the error summary that
 * points back into it. The rating tiles themselves are section 8, free text
 * and service areas are section 9.
 *
 * The questionnaire form is the one form of the portal that is NOT limited to
 * --breite-formular: five rating tiles side by side need the full content
 * width, and squeezing them into 520px would drop the row back to one tile per
 * line even on a desktop screen.
 */
.fragebogen { max-width: none; }

/* .frage is a fieldset on two of the three question kinds. A fieldset carries
 * a browser frame, its own padding and — this is the one that bites — a
 * min-inline-size of min-content, which keeps a grid child inside it from ever
 * shrinking below its widest item. All three are reset here. */
.frage {
    min-inline-size: 0;
    margin: 0 0 var(--abstand-6);
    padding: 0;
    border: 0;

    /* The jump link of the error summary lands here. Without this the target
     * sits flush against the upper window edge and the customer cannot tell
     * where they were sent. */
    scroll-margin-top: var(--abstand-6);
}

/* A legend does not take part in the layout of its fieldset and ignores
 * width: 100%; float: left is the established way to make it behave like a
 * normal block. The elements below it start their own formatting context
 * (grid, block) and therefore sit under it, not beside it. */
.frage-text {
    display: block;
    float: left;
    width: 100%;
    margin: 0 0 var(--abstand-3);
    padding: 0;
    font-size: var(--text-m);
    font-weight: var(--fett-halb);
    line-height: var(--zeilenhoehe-eng);
}

/* Everything below the question text has to clear the float above it. Written
 * as "every child except the question text" rather than as a list of the three
 * known blocks: a hint paragraph or a fourth question kind added later would
 * otherwise slide up beside the legend, and that failure is invisible in the
 * markup. */
.frage > *:not(.frage-text) { clear: both; }

/* The fieldset carries tabindex="-1" so the jump link can move the focus onto
 * it. Two separate marks on purpose: :target survives the focus moving on — a
 * customer who jumps and then presses Tab still sees which question they were
 * sent to — while :focus is the immediate confirmation of the jump. */
.frage:target,
.frage:focus {
    outline: 3px solid var(--akzent);
    outline-offset: var(--abstand-3);
    border-radius: var(--radius);
}

.frage:target { background: var(--akzent-schwach); }

/* --- Error summary ---------------------------------------------------------
 * Rendered above the form after a rejected submission
 * (templates/partials/fehlerliste.php). role="alert" announces it, autofocus
 * and tabindex="-1" put the caret into it, and the links jump into the
 * questions — all of it without a line of JavaScript.
 *
 * Same colours as .meldung--fehler (section 5), but a block of its own: a
 * message is one sentence, this is a heading with a list, and it has to stand
 * out enough that nobody scrolls past it.
 */
.fehlerliste {
    padding: var(--abstand-4);
    margin: 0 0 var(--abstand-5);
    color: var(--fehler-text);
    background: var(--fehler-grund);
    border: 2px solid currentColor;
    border-radius: var(--radius);
}

.fehlerliste:focus-visible {
    outline: 3px solid var(--fokus);
    outline-offset: 2px;
}

.fehlerliste-kopf {
    margin: 0 0 var(--abstand-3);
    font-weight: var(--fett-halb);
}

.fehlerliste-punkte { margin: 0; padding-left: var(--abstand-5); }
.fehlerliste-punkte li + li { margin-top: var(--abstand-3); }

/* The link is the question text. It inherits the error colour instead of
 * taking --akzent: blue on the reddish surface would be the one element of the
 * block that does not belong to it. Underlined, so it stays recognisable as a
 * link without relying on colour. */
.fehlerliste-punkte a {
    color: inherit;
    font-weight: var(--fett-halb);
    text-decoration: underline;
}

/* display: block puts the sentence under the question text instead of behind
 * it: the link is the thing to follow, the sentence is the explanation. */
.fehlerliste-text { display: block; }

/* === 8. Questionnaire — rating tiles ====================================
 *
 * The core of this portal, and the place where the legacy system failed
 * hardest: there a chosen step was a tiny radio button in a grey circle on a
 * coloured tile, with no state rendering at all, and the click on the tile was
 * forwarded to the radio by a script of its own without anything changing on
 * screen (the class name is in PLAN.md, "Frontend").
 *
 * Here the <label> IS the tile and the radio is its first child, so the whole
 * tile is a click target natively — no script, and it keeps working with
 * JavaScript switched off.
 *
 * THE SELECTED STATE HANGS ON THE SIBLING COMBINATOR
 * `.note-schalter:checked ~ .note-hervorhebung` (CSS 2.1, available
 * everywhere) and NOT on :has(): Firefox learned :has() in version 121, and
 * Firefox ESR 115 and locked down corporate browsers do not know it at all.
 * :has() carries decoration only — enlargement and shadow — behind
 * @supports selector(:has(*)). Remove that block and ring and check mark are
 * still there.
 *
 * Three carriers of the selected state that do not depend on each other, so it
 * survives a grey scale print and every form of colour blindness:
 *   1. a 3px ring beside the tile,
 *   2. a check mark drawn in CSS,
 *   3. the tile growing by three percent.
 * The fill colour is the fourth carrier, never the only one.
 */

:root {
    /* --- The five steps (PLAN.md, "Die 5-stufige Bewertungsskala") ----------
     * Declared here rather than in section 1 because they belong to this
     * component and to nothing else; section 1 holds the tokens the whole
     * portal shares.
     *
     * The legacy values #088A08, #00FF00, #FFFF00, #FF8000 and #FF0000 are NOT
     * carried over: four of the five break the contrast requirement. Pure
     * green and pure yellow reach 1.71:1 and 1.37:1 against the white card and
     * are not a tile at all, and #FF0000 fails the text check with 4.00:1.
     * Traffic light semantics, order and labelling stay exactly as they were.
     *
     * Three tokens per step. Measured text on fill (light / dark):
     *   1 +++  7.45 / 8.05     2 ++  9.68 / 5.11     3 +  12.08 / 6.24
     *   4 --   6.88 / 6.21     5 --- 6.62 / 7.35
     *
     * THE 2px FRAME IS LOAD BEARING, NOT DECORATION. In light mode the fills
     * of steps 2 to 4 reach only 1.37 to 2.40:1 against the white card, in
     * dark mode all five stay between 2.09 and 3.29:1 against --flaeche. The
     * frame carries the boundary instead: 4.14 to 10.38:1 in light mode and
     * 5.08 to 8.17:1 in dark mode, every one of them above the 3:1 of
     * WCAG 1.4.11. It may never be dropped.
     *
     * --note-N-text is the same white in both modes on steps 1 and 5; the pair
     * is still written out so every colour token of the file has the same
     * shape and a later change to one mode cannot be forgotten.
     */
    --note-1-flaeche: #14622f;
    --note-1-flaeche: light-dark(#14622f, #165c31);
    --note-1-text: #ffffff;
    --note-1-text: light-dark(#ffffff, #ffffff);
    --note-1-rand: #0e4a24;                 /* light 10.38:1 - dark 5.78:1 */
    --note-1-rand: light-dark(#0e4a24, #4fa96c);

    --note-2-flaeche: #9bd67c;
    --note-2-flaeche: light-dark(#9bd67c, #4c7a1e);
    --note-2-text: #14202b;
    --note-2-text: light-dark(#14202b, #ffffff);
    --note-2-rand: #4f8b31;                 /* light 4.14:1 - dark 8.17:1 */
    --note-2-rand: light-dark(#4f8b31, #8fc45a);

    --note-3-flaeche: #f7dc5e;
    --note-3-flaeche: light-dark(#f7dc5e, #7a5c0a);
    --note-3-text: #14202b;
    --note-3-text: light-dark(#14202b, #ffffff);
    --note-3-rand: #8a6d0e;                 /* light 4.91:1 - dark 6.90:1 */
    --note-3-rand: light-dark(#8a6d0e, #c6a237);

    --note-4-flaeche: #ee9138;
    --note-4-flaeche: light-dark(#ee9138, #9b4a12);
    --note-4-text: #14202b;
    --note-4-text: light-dark(#14202b, #ffffff);
    --note-4-rand: #9a5514;                 /* light 5.70:1 - dark 5.82:1 */
    --note-4-rand: light-dark(#9a5514, #d98341);

    --note-5-flaeche: #b3231c;
    --note-5-flaeche: light-dark(#b3231c, #a32620);
    --note-5-text: #ffffff;
    --note-5-text: light-dark(#ffffff, #ffffff);
    --note-5-rand: #8e1b15;                 /* light 9.06:1 - dark 5.08:1 */
    --note-5-rand: light-dark(#8e1b15, #de6a62);

    /* Width of the load bearing tile frame. Referenced a second time by the
     * highlight layer, which has to reach across it. */
    --note-rahmen: 2px;

    /* Visible size of the native radio. 1.75rem = 28px; section 14 raises it
     * to 2rem = 32px under a coarse pointer. */
    --schalter-groesse: 1.75rem;
}

/* One tile per line below 600px, five equal columns above. Only the column
 * count changes, never the order of the elements in the DOM: the sibling
 * combinator that draws the selected state would break the moment the radio
 * stopped preceding the highlight layer. */
.notenreihe {
    display: grid;
    grid-template-columns: 1fr;

    /* The ring sits 2px outside the tile and is 3px wide, so a selected tile
     * claims five pixels beyond its own edge. 12px of gap leave room for two
     * of them and a visible gap in between. */
    gap: var(--abstand-3);
    padding: var(--abstand-1);
    margin: 0;
}

.note {
    /* Anchor for the absolutely positioned highlight layer. */
    position: relative;

    display: grid;
    grid-template-areas: "schalter zeichen";
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: var(--abstand-3);

    /* 3.5rem = 56px, the target size of PLAN.md, "Barrierefreiheit". */
    min-height: 3.5rem;
    padding: var(--abstand-2) var(--abstand-3);

    color: var(--text-note);
    background: var(--flaeche-note);
    border: var(--note-rahmen) solid var(--rand-note);
    border-radius: var(--radius);
    cursor: pointer;

    /* The whole tile is the click target; a stray drag must not select the
     * symbols instead of choosing the step. */
    -webkit-user-select: none;
    user-select: none;

    transition:
        transform var(--dauer) ease,
        box-shadow var(--dauer) ease;
}

/* The five steps differ in exactly three values. Everything else — geometry,
 * state, behaviour — is shared, which is why the mapping is five one line
 * rules instead of five copies of the block above. */
.note-1 { --flaeche-note: var(--note-1-flaeche); --text-note: var(--note-1-text); --rand-note: var(--note-1-rand); }
.note-2 { --flaeche-note: var(--note-2-flaeche); --text-note: var(--note-2-text); --rand-note: var(--note-2-rand); }
.note-3 { --flaeche-note: var(--note-3-flaeche); --text-note: var(--note-3-text); --rand-note: var(--note-3-rand); }
.note-4 { --flaeche-note: var(--note-4-flaeche); --text-note: var(--note-4-text); --rand-note: var(--note-4-rand); }
.note-5 { --flaeche-note: var(--note-5-flaeche); --text-note: var(--note-5-text); --rand-note: var(--note-5-rand); }

.note:hover { box-shadow: var(--schatten-2); }

/* --- The radio ------------------------------------------------------------
 * A REAL radio, deliberately WITHOUT appearance: none. Arrow key navigation
 * inside the name group, the screen reader announcement and the rendering in
 * the Windows contrast mode are all things the browser does better than any
 * rebuild, and a rebuilt control loses every one of them the moment a detail
 * is forgotten.
 *
 * accent-color: currentColor instead of a fixed var(--akzent): the radio takes
 * the text colour of its own tile and is therefore visible on all five fills.
 * #003366 would reach 1.69:1 on step 1 and disappear there; the text colour is
 * at least 4.5:1 on every step by construction (token block above).
 */
.note-schalter {
    grid-area: schalter;
    width: var(--schalter-groesse);
    height: var(--schalter-groesse);
    margin: 0;
    accent-color: currentColor;
    cursor: pointer;
}

.note-zeichen {
    grid-area: zeichen;
    font-size: var(--text-l);
    font-weight: var(--fett);
    line-height: var(--zeilenhoehe-eng);

    /* The labels of the two ends can be overridden per question through
     * BestNoteFrase / WorstNoteFrase and are then words, not symbols. A phrase
     * wraps at its spaces, and a word too long for the tile is hyphenated with
     * the German dictionary of the browser — which is why the page carries
     * lang="de". break-word is only the last resort, for a word that does not
     * fit even hyphenated or a browser without a dictionary. Before TASK-036
     * this was overflow-wrap: anywhere without hyphenation, which broke
     * "ausgezeichnet" into "ausgezei" and "chnet" without a hyphen. */
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;

    /* The symbol is centred and therefore as wide as its content, and
     * break-word — unlike a hyphenation point — does not make that content
     * any narrower. Without this cap a browser without a dictionary lets the
     * word run across the frame instead of breaking it. */
    max-width: 100%;
}

/* --- The highlight layer ---------------------------------------------------
 * A layer of its own instead of styling the tile itself, for one reason: the
 * ring has to sit BESIDE the tile, not on it. #003366 on the dark green of
 * step 1 or the red of step 5 would be invisible; two pixels further out lies
 * the card surface, where the same blue reaches 12.61:1 in light mode and
 * 8.14:1 in dark mode.
 *
 * The negative inset pulls the layer across the load bearing frame, so
 * outline-offset measures from the OUTER edge of the tile and the 2px gap
 * really shows the card behind it.
 *
 * pointer-events: none keeps the layer out of the way of the click that the
 * label forwards to the radio.
 */
.note-hervorhebung {
    position: absolute;
    inset: calc(-1 * var(--note-rahmen));
    border-radius: var(--radius);
    pointer-events: none;
}

/* Selection and focus share the ring on purpose: inside a radio group the two
 * travel together anyway, and they are told apart by the check mark and the
 * enlargement, which only the selection gets. */
.note-schalter:checked ~ .note-hervorhebung,
.note-schalter:focus-visible ~ .note-hervorhebung {
    outline: 3px solid var(--akzent);
    outline-offset: 2px;
}

/* Check mark: a box rotated by 45 degrees showing two of its borders, the same
 * construction as the success message in section 5. Not the Unicode character
 * U+2714 — it switches to emoji rendering on Android and iOS and is missing
 * from several fallback fonts — and not an SVG, because a data: URL would
 * force an exception into the content security policy.
 *
 * currentColor means the mark carries the text colour of its own tile and is
 * therefore at 4.5:1 or better on every step, without a sixth colour token.
 */
.note-schalter:checked ~ .note-hervorhebung::after {
    content: '';
    position: absolute;
    top: var(--abstand-2);
    right: var(--abstand-3);
    width: 0.6rem;
    height: 1.05rem;
    border-right: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(45deg);
}

/* --- Decoration on top, for browsers that have :has() ----------------------
 * The third carrier of the selected state. It needs :has() because the thing
 * that grows is the LABEL — the parent of the checked radio — and no sibling
 * combinator reaches upwards.
 *
 * Everything in this block is an addition. Delete it and the selected state is
 * still unambiguous through ring and check mark; that is exactly what a
 * Firefox ESR 115 sees, and it is the reason why the state itself never
 * entered this block.
 */
@supports selector(:has(*)) {
    .note:has(.note-schalter:checked) {
        transform: scale(1.03);
        box-shadow: var(--schatten-3);
    }
}

/* From 600px: five columns, symbol above and radio below, the way the legacy
 * mask arranged it and the way customers know it. The rearrangement runs
 * entirely through grid-template-areas — the DOM order stays untouched,
 * otherwise the ~ combinator above would stop matching. */
@media (min-width: 600px) {
    /* minmax(0, 1fr) and not a plain 1fr: a 1fr track never shrinks below the
     * min-content width of its tile, so one long word would widen its own
     * column and squeeze the other four. All five stay equally wide. */
    .notenreihe { grid-template-columns: repeat(5, minmax(0, 1fr)); }

    /* Less padding above the symbol than below the radio on purpose: the line
     * box of the symbol brings its own leading above the glyphs, the radio
     * brings none. 2 + 4 + 21.25 + 4 + 28 + 8 + 2 = 69.25px instead of the
     * former 91.5px; min-height stays the floor. */
    .note {
        grid-template-areas:
            "zeichen"
            "schalter";

        /* Same reason as the row above: a plain 1fr column inside the tile
         * would grow to the width of a long word and the cap on the symbol
         * would grow with it. */
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        align-content: center;
        gap: var(--abstand-1);
        padding: var(--abstand-1) var(--abstand-2) var(--abstand-2);
        text-align: center;
    }

    /* The check mark moves to the lower right corner, beside the centred
     * radio: that row is the one place in the tile a long BestNoteFrase or
     * WorstNoteFrase never reaches. In the upper corner it covered the first
     * line of a word like "ausgezeichnet". */
    .note-schalter:checked ~ .note-hervorhebung::after {
        top: auto;
        right: var(--abstand-2);
        bottom: var(--abstand-1);
    }
}

/* === 9. Free text and service areas =====================================
 *
 * The two remaining question kinds: the optional free text of /Feedback/Edit
 * and the eight service areas of /Feedback/Done.
 */

/* --- Free text -------------------------------------------------------------
 * field-sizing: content lets the browser grow the field with its content and
 * replaces the scripted autogrow of the legacy system. Behind @supports, because
 * the property is young: the fallback is a fixed field of four rows that the
 * customer can drag taller. app.js only touches the field where the browser
 * cannot do it itself (data-wachsen).
 *
 * resize: vertical and not both — horizontal resizing would let the field
 * stick out over the card.
 */
.notiz {
    display: block;
    width: 100%;
    min-height: 6rem;
    padding: var(--abstand-3);
    font: inherit;
    line-height: var(--zeilenhoehe);
    color: var(--text);
    background: var(--flaeche);
    border: 2px solid var(--rand-stark);
    border-radius: var(--radius);
    resize: vertical;
}

@supports (field-sizing: content) {
    .notiz {
        field-sizing: content;

        /* With field-sizing the rows attribute no longer governs the height;
         * these two keep the field from starting as a single line and from
         * growing past the screen. */
        min-height: 6rem;
        max-height: 60vh;
    }
}

/* --- Service areas ---------------------------------------------------------
 * Eight checkboxes, one per bit of AnswerMultipleChoice (1, 2, 4 ... 128). As
 * with the rating tiles the <label> is the whole row, so the click target is
 * the full line and not the 28px box.
 *
 * One column below 900px, two above: the labels are long ("Landespflege /
 * Umweltfachliche Baubegleitung"), and three columns would break every one of
 * them across three lines.
 */
.bereiche {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--abstand-2);
    margin: 0;
}

.bereich {
    display: flex;
    align-items: center;
    gap: var(--abstand-3);
    min-height: 3.5rem;
    padding: var(--abstand-2) var(--abstand-3);
    background: var(--flaeche);
    border: 2px solid var(--rand-stark);
    border-radius: var(--radius);
    cursor: pointer;

    /* Same reason as on the rating tile: the row is the click target. */
    -webkit-user-select: none;
    user-select: none;

    transition: background-color var(--dauer-schnell) ease;
}

.bereich:hover { background: var(--grund-versenkt); }

/* accent-color: var(--akzent) and not currentColor as on the rating tiles: the
 * box stands on --flaeche, where the brand blue reaches 12.61:1 in light mode
 * and the derived light blue 8.14:1 in dark mode. The mark inside the box is
 * drawn by the browser — no rebuild, and therefore no lost keyboard
 * behaviour. */
.bereich-schalter {
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0;
    accent-color: var(--akzent);
    cursor: pointer;
}

.bereich-schalter:focus-visible {
    outline: 3px solid var(--fokus);
    outline-offset: 2px;
}

/* A ticked area gets a heavier label, so a filled in row is recognisable from
 * a distance and not only by the mark inside the box. Sibling combinator
 * again, not :has() — same reason as in section 8. */
.bereich-schalter:checked ~ .bereich-text { font-weight: var(--fett-halb); }

.bereich-text { line-height: var(--zeilenhoehe-eng); }

@media (min-width: 900px) {
    .bereiche { grid-template-columns: 1fr 1fr; gap: var(--abstand-2) var(--abstand-4); }
}

/* === 10. Static pages ===================================================
 *
 * Reading typography for the two legal texts (templates/home/about.php,
 * templates/home/contact.php). They are the only pages of the portal that
 * consist of nothing but running text — several thousand words with no form
 * and no interaction — so they get their own measure instead of the full
 * content width.
 *
 * ~70ch: a line noticeably longer than that makes the eye lose the start of
 * the next line, which is precisely the failure mode of a privacy statement
 * nobody wants to read anyway. The value is a character measure, not a pixel
 * width, so it follows the font size and browser zoom.
 *
 * Deliberately NOT justified, unlike the old system (style="text-align:
 * justify" on every section): without hyphenation control the browser pulls
 * German compound nouns apart into rivers of white space. hyphens: auto plus
 * ragged right reads better and stays intact at every window width; the
 * language for the hyphenation dictionary comes from <html lang="de">.
 */

.textseite {
    max-width: 70ch;
    -webkit-hyphens: auto;              /* Safari still needs the prefix */
    hyphens: auto;
}

.textseite p { margin: 0 0 var(--abstand-4); }

/* More air above a section heading than below it, so a heading visually
 * belongs to the text that follows it rather than to the one above. The
 * first child needs no lead-in — the h1 of the page sits right above it. */
.textseite h2 { margin: var(--abstand-6) 0 var(--abstand-3); }
.textseite > :first-child { margin-top: 0; }
.textseite > :last-child { margin-bottom: 0; }

/* The introductory line under the h1 ("Ihre Informationsrechte nach Art. 12
 * ff DSGVO"). It is a lead-in, not a heading: turning it into an h2 would
 * put it on the same level as the numbered sections. */
.textseite-vorspann {
    font-size: var(--text-l);
    color: var(--text-schwach);
    margin: 0 0 var(--abstand-5);
}

.textseite ul { margin: 0 0 var(--abstand-4); padding-left: var(--abstand-5); }
.textseite li + li { margin-top: var(--abstand-2); }

/* Enumerations whose markers are part of the quoted wording — "(1)", "(2)",
 * "(3)" in the professional regulations of the Impressum. A second, browser
 * generated marker in front of them would read as double numbering. */
.textseite-liste-schlicht { list-style: none; padding-left: 0; }

/* address is italic by default in every browser; the postal blocks of the
 * legal notice are plain text, not emphasis. */
.textseite address { margin: 0 0 var(--abstand-4); font-style: normal; }

/* The cookie name is a literal value, marked up as code so it cannot be
 * mistaken for prose. No new colour token: surface and frame come from the
 * existing set. */
.textseite code {
    padding: 0 var(--abstand-1);
    font-size: var(--text-s);
    background: var(--grund-versenkt);
    border: 1px solid var(--rand);
    border-radius: var(--radius-klein);
}

/* === 11. Admin ==========================================================
 *
 * The admin area behind /Home/Admin. The ground work arrived with the login
 * (TASK-027): the narrow card of the login form, the head row of the
 * dashboard with its logout button, and a quieter second button. TASK-028
 * adds the card grid of the settings, the switch row and the job history.
 *
 * No colour of its own: surface, border and accent come from the tokens of
 * section 1, so the admin pages follow the colour mode without a second
 * palette.
 */

/* Two fields and one button do not need the full content width; stretched
 * across it, the fields turn into lines the eye has to travel along. */
.karte--schmal { max-width: var(--breite-karte); }

/* Heading and logout button on one row; on a narrow screen the button wraps
 * below the heading. The row owns the spacing, so the h1 gives up its own. */
.admin-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--abstand-3) var(--abstand-5);
    margin-bottom: var(--abstand-5);
}

.admin-kopf h1 { margin: 0; }

/* The secondary button: geometry and target size of .knopf (section 6), but
 * outlined instead of filled, so the one primary action of a page keeps
 * standing out. The frame is --akzent and not the decorative --rand: it is
 * the boundary of a control (WCAG 1.4.11). */
.knopf--zweitrangig {
    color: var(--akzent);
    background: var(--flaeche);
    border-color: var(--akzent);
}

.knopf--zweitrangig:hover { background: var(--akzent-schwach); }

/* --- Dashboard grid (TASK-028) ----------------------------------------------
 * One card per setting. One column below 900px, two above: the forms carry a
 * label, a field and a hint each, and three columns would squeeze the time
 * selection and the watermark field below a usable width. The grid owns the
 * gaps, so the cards give up their own bottom margin. */
.admin-raster {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--abstand-5);
    margin-bottom: var(--abstand-5);
}

.admin-raster > .karte { margin-bottom: 0; }

@media (min-width: 900px) {
    /* minmax(0, 1fr) and not 1fr: a long unbroken value (an address list,
     * a raw broken setting) must wrap inside its card instead of widening the
     * column. */
    .admin-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.admin-karte { overflow-wrap: anywhere; }
.admin-karte > :last-child { margin-bottom: 0; }

/* The current state of a setting, in words ("Derzeit: eingeschaltet"). */
.admin-zustand { margin: 0 0 var(--abstand-4); }
.admin-zustand strong { font-weight: var(--fett-halb); }

/* --- Switch row ---------------------------------------------------------------
 * The checkbox of the automatic job. Built like the service area rows of
 * section 9: the <label> is the whole row, so the click target is the line and
 * not the 28px box, and the box itself stays the native control. */
.schalter-zeile {
    display: flex;
    align-items: center;
    gap: var(--abstand-3);
    min-height: 3.5rem;
    padding: var(--abstand-2) var(--abstand-3);
    background: var(--flaeche);
    border: 2px solid var(--rand-stark);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color var(--dauer-schnell) ease;
}

.schalter-zeile:hover { background: var(--grund-versenkt); }

.schalter-zeile-kasten {
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0;
    accent-color: var(--akzent);
    cursor: pointer;
}

.schalter-zeile-kasten:focus-visible {
    outline: 3px solid var(--fokus);
    outline-offset: 2px;
}

/* A finger needs the same 60px as on the questionnaire (section 14). Declared
 * here because section 14 knows only the controls of the public pages. */
@media (pointer: coarse) {
    .schalter-zeile { min-height: 3.75rem; }
}

/* --- Job history ---------------------------------------------------------------
 * templates/admin/partials/job-runs.php. Mobile first: below 700px every run
 * is a card of its own, and each cell names its column through data-spalte,
 * because five columns do not fit a phone. From 700px on it is a real table.
 *
 * Why 700px (TASK-035, E4): run, start, end and status must not wrap inside a
 * word, which makes the table at least ~530px wide at --text-s (measured in
 * Chrome with Segoe UI). At 600px the card leaves only 502px; 627px would be
 * the bare minimum. 700px keeps a reserve for wider system fonts and longer
 * run numbers.
 *
 * display: block takes the table semantics away in several browsers; the
 * markup therefore carries explicit ARIA roles on every element. The head row
 * is only clipped, not removed, so it stays in the accessibility tree. */
.laeufe {
    display: block;
    width: 100%;
    border-collapse: collapse;
}

.laeufe tbody,
.laeufe tr { display: block; }

.laeufe thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.laeufe tr {
    padding: var(--abstand-3);
    margin-bottom: var(--abstand-3);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
}

.laeufe td {
    display: grid;
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: var(--abstand-3);
    padding: var(--abstand-1) 0;
    overflow-wrap: anywhere;
}

.laeufe td::before {
    content: attr(data-spalte);
    color: var(--text-schwach);
    font-weight: var(--fett-halb);
}

@media (min-width: 700px) {
    .laeufe { display: table; }

    .laeufe thead {
        display: table-header-group;
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        white-space: normal;
    }

    .laeufe tbody { display: table-row-group; }

    .laeufe tr {
        display: table-row;
        padding: 0;
        margin: 0;
        border: 0;
    }

    /* --text-s only here: the card layout keeps the body size (TASK-035, E2). */
    .laeufe th,
    .laeufe td {
        display: table-cell;
        padding: var(--abstand-2) var(--abstand-3);
        font-size: var(--text-s);
        text-align: left;
        vertical-align: top;
        border-bottom: 1px solid var(--rand);
    }

    .laeufe th {
        font-weight: var(--fett-halb);
        background: var(--grund-versenkt);
    }

    .laeufe td::before { content: none; }

    /* TASK-035, E3. overflow-wrap: anywhere lowers the minimum width of a cell
     * to one character, and the automatic table layout then hands almost all
     * the room to the long result text — the dates broke apart mid-number.
     * So in the table only the result may break anywhere; the status wraps
     * between words only, and run number, start and end never wrap. The
     * columns are addressed through data-spalte, which the card layout needs
     * anyway. */
    .laeufe td { overflow-wrap: normal; }

    .laeufe td[data-spalte="Lauf"],
    .laeufe td[data-spalte="Beginn"],
    .laeufe td[data-spalte="Ende"] { white-space: nowrap; }

    .laeufe td[data-spalte="Ergebnis"] { overflow-wrap: anywhere; }
}

/* The status badge. The word inside is the information; the colours of the
 * messages (section 5) only repeat it, and currentColor keeps the frame at the
 * contrast of the text in both colour modes. */
.lauf-status {
    display: inline-block;
    padding: 0 var(--abstand-2);
    font-weight: var(--fett-halb);
    border: 1px solid currentColor;
    border-radius: var(--radius-klein);
}

.lauf-status--erfolg { color: var(--erfolg-text); background: var(--erfolg-grund); }

.lauf-status--fehler,
.lauf-status--abgebrochen { color: var(--fehler-text); background: var(--fehler-grund); }

.lauf-status--laeuft,
.lauf-status--unbekannt { color: var(--hinweis-text); background: var(--hinweis-grund); }

/* === 13. Utility classes =================================================
 *
 * Deliberately few: a utility that duplicates a building block makes the
 * markup carry design decisions again, which is exactly what the token
 * system removed.
 */

/* Screen reader only: carries meaning that the eye takes from an icon or
 * the logo. clip-path instead of display: none — the latter would remove
 * the text from the accessibility tree as well. */
.nur-vorlesen {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Skip link: visible on keyboard focus only. */
.sprunglink {
    position: absolute;
    left: var(--abstand-2);
    top: calc(var(--abstand-2) * -10);
    z-index: 10;
    padding: var(--abstand-2) var(--abstand-4);
    color: var(--akzent-text);
    background: var(--akzent);
    border-radius: var(--radius);
    transition: top var(--dauer-schnell) ease;
}

.sprunglink:focus-visible { top: var(--abstand-2); }

/* main carries tabindex="-1" so the skip link really lands there; the ring
 * would be noise at that point, the jump itself is confirmation enough. */
.inhalt:focus { outline: none; }

/* === 14. Input method, motion, contrast mode ============================
 *
 * Three adjustments that are not about one component but about how the device
 * is operated. They come last on purpose: each one overrides values from the
 * sections above, and the cascade decides by source order.
 */

/* --- Coarse pointer --------------------------------------------------------
 * A finger is not a mouse pointer. (pointer: coarse) and not a width query:
 * a touch laptop at 1400px needs the larger targets just as much as a phone,
 * and a narrow browser window on a desktop does not.
 *
 * 3.75rem = 60px tile, 2rem = 32px radio — both above the 56px/28px of the
 * mouse case (PLAN.md, "Die Umfragemaske").
 *
 * The service area checkbox deliberately stays at 28px: its hit target is the
 * whole row, which grows to 60px here, and PLAN.md pins the box itself to that
 * size.
 */
@media (pointer: coarse) {
    :root { --schalter-groesse: 2rem; }

    .note,
    .bereich,
    .knopf,
    .feld-eingabe { min-height: 3.75rem; }
}

/* --- Reduced motion --------------------------------------------------------
 * Everything that MOVES is switched off; everything that is a STATE stays.
 * The selected tile therefore keeps its three percent, it simply arrives
 * without the animation — removing it would take away one of the three
 * carriers of the selected state from exactly the people who asked for less
 * motion, not for less information.
 *
 * 0.01ms instead of 0s: a duration of zero suppresses the transitionend event
 * in some engines, and a script waiting for it would never continue.
 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Windows contrast mode -------------------------------------------------
 * In forced-colors mode the system replaces every colour of the page with its
 * own palette, and our tile fills, frames and the ring go with them. What
 * would be lost without this block is the DISTINCTION: every frame would end
 * up in the same system colour and a selected tile would look like an
 * unselected one.
 *
 * The system keywords are therefore assigned explicitly: structure on
 * CanvasText, selection on Highlight. No forced-color-adjust: none anywhere —
 * that would push our own palette back in and defeat the whole mode.
 */
@media (forced-colors: active) {
    .note,
    .bereich,
    .notiz,
    .feld-eingabe,
    .fehlerliste { border-color: CanvasText; }

    .note-schalter:checked ~ .note-hervorhebung,
    .note-schalter:focus-visible ~ .note-hervorhebung { outline-color: Highlight; }

    /* The check mark is a border, not a text glyph, so it needs the colour
     * spelled out; currentColor would follow the text and become
     * indistinguishable from the symbol next to it. */
    .note-schalter:checked ~ .note-hervorhebung::after { border-color: Highlight; }

    .frage:target,
    .frage:focus { outline-color: Highlight; }
}

/* === 16. Cookie notice ==================================================
 *
 * A notice, not a consent dialogue (TASK-018,
 * templates/partials/cookie-hinweis.php): one button, no overlay, no
 * blocking. The questionnaire stays usable while the bar is visible, and
 * the bar disappears for the rest of the session once it is confirmed.
 *
 * position: sticky and NOT fixed. Fixed would take the bar out of the flow
 * and cover the footer permanently, even at the very bottom of the page.
 * Sticky keeps its place as the last element of the body: it rides along
 * the lower edge while there is something left to scroll and settles below
 * the footer once the end of the page is reached — nothing stays hidden.
 *
 * z-index below the skip link (10, section 13): the skip link has to stay
 * reachable as the first stop of the keyboard.
 *
 * No colour of its own: surface, border and accent come from the existing
 * tokens, so the bar follows the colour mode without a second palette.
 */
.cookie-hinweis {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--abstand-3) var(--abstand-5);
    padding: var(--abstand-3) var(--abstand-4);
    background: var(--flaeche);

    /* --rand-stark instead of the decorative --rand: this edge separates two
     * surfaces that overlap while scrolling and has to stay visible in both
     * colour modes (WCAG 1.4.11). */
    border-top: 1px solid var(--rand-stark);
}

/* flex-basis 20rem: the text keeps the button next to it from about 600px
 * on and drops below it on a narrow phone. ~70ch measure as on the legal
 * pages (section 10) — the same reading rule applies here. */
.cookie-hinweis-text {
    flex: 1 1 20rem;
    max-width: 70ch;
    margin: 0;
}

/* Full width below 600px so the button is easy to hit with a thumb; from
 * 600px it shrinks to its content and sits beside the text. */
.cookie-hinweis-formular { flex: none; width: 100%; }

.cookie-hinweis-knopf {
    width: 100%;

    /* 3.5rem = 56px hit area, the target size asked for in TASK-018 (AC11).
     * min-height rather than height so a translated or wrapped label does
     * not get cut off. */
    min-height: 3.5rem;
    padding: var(--abstand-3) var(--abstand-5);

    /* A button does not inherit the page font on its own. */
    font: inherit;
    font-weight: var(--fett-halb);

    color: var(--akzent-text);
    background: var(--akzent);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color var(--dauer-schnell) ease;
}

.cookie-hinweis-knopf:hover { background: var(--akzent-stark); }

@media (min-width: 600px) {
    .cookie-hinweis { padding: var(--abstand-3) var(--abstand-5); }
    .cookie-hinweis-formular { width: auto; }
    .cookie-hinweis-knopf { width: auto; }
}
