/* Grund: Schrift, Token, Grundtypografie. Jeder Farbwert steht hier einmal,
   als Paar aus hell und dunkel; außerhalb dieser Datei gibt es keinen.
   Welcher Wert gilt, sagt `color-scheme` am Wurzelelement. */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/IBMPlexSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); }

:root {
    color-scheme: light;

    /* Das Bedienfeld: Tinte auf Papier, warme Neutrale. Im Dunkeln Kreide auf
       Tafel, Vertieftes etwas heller als die Fläche. */
    --papier: light-dark(#f4f3ef, #1a1916);
    --flaeche: light-dark(#ffffff, #252420);
    --flaeche-2: light-dark(#eeece6, #2f2d29);
    --linie: light-dark(#dad7d0, #3b3934);
    --linie-2: light-dark(#948f85, #7b766c);
    --tinte: light-dark(#1c1b18, #ece9e2);
    --tinte-2: light-dark(#5b574f, #b3aea4);
    --tinte-3: light-dark(#8b867c, #8f8a80);
    --fokus: light-dark(#1c1b18, #ece9e2);

    /* Signale: nur für Zustände. */
    --warnung: light-dark(#7a4f00, #e9b65c);
    --warnung-grund: light-dark(#fff2d1, #3a2c0f);
    --fehler: light-dark(#962a1f, #f2927f);
    --fehler-grund: light-dark(#fbe9e5, #3f1b15);
    --erfolg: light-dark(#2b6436, #86c995);
    --erfolg-grund: light-dark(#e6f1e8, #18301e);

    --abblendung-tief: light-dark(rgba(28, 27, 24, 0.35), rgba(0, 0, 0, 0.6));
    --schatten: 0 1px 3px light-dark(rgba(28, 27, 24, 0.14), rgba(0, 0, 0, 0.55));
    --schatten-tief: 0 8px 32px light-dark(rgba(28, 27, 24, 0.2), rgba(0, 0, 0, 0.6));

    /* Die Bühne: das Dokument. Die Schriftfarben sind Werte der komverw-Karte. */
    --dok-grund: var(--papier);
    --dok-zeile: var(--flaeche);
    --dok-auswahl: light-dark(#d9d6ce, #45423c);
    --dok-treffer: light-dark(#d6336c, #ff789c);

    --xml-element: light-dark(#104281, #90c1ff);
    --xml-attribut: light-dark(#7a2e7a, #eb98e9);
    --xml-wert: light-dark(#1c5f30, #48cc95);
    --xml-sonder: light-dark(#783c00, #f2a33c);
    --xml-kommentar: var(--tinte-2);
    --xml-zeichen: var(--tinte-2);

    /* Der Vergleich: Blau und Orange, gerechnet gegen Farbsehschwäche. Verschoben
       ist keine Änderung am Inhalt und trägt darum keine Farbe. */
    --diff-neu: light-dark(#1d5fb0, #7fb6f5);
    --diff-neu-grund: light-dark(#e2edf9, #1b2a3c);
    --diff-neu-wort: light-dark(#bcd7f5, #2b4a70);
    --diff-weg: light-dark(#a8460f, #f5a06f);
    --diff-weg-grund: light-dark(#fbeade, #37231a);
    --diff-weg-wort: light-dark(#f6cbae, #633a22);
    --diff-verschoben: var(--tinte-2);
    --diff-verschoben-grund: var(--flaeche-2);
    --diff-leer: var(--flaeche-2);

    /* Rundungen: drei Stufen. */
    --rund-klein: 3px;
    --rund: 4px;
    --rund-gross: 6px;

    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Fünf Stufen und das Dokument, keine Überschriftenhierarchie. */
    --zahl: 26px;
    --titel: 15px;
    --text: 14px;
    --klein: 12.5px;
    --bezeichner: 11px;
    --dokument: 13px;
    --dokumentzeile: 20px;
}

/* Die Wahl des Geräts: „automatisch“ setzt `light dark`, „hell“ und „dunkel“
   setzen je einen Wert. Gedruckt wird immer hell. */
:root[data-darstellung="automatisch"] { color-scheme: light dark; }
:root[data-darstellung="dunkel"] { color-scheme: dark; }
@media print { :root { color-scheme: light; } }

/* Die Bausteine. Kein Farbwert in dieser Datei: alle Farben kommen aus den Token.
   Teil 1 ist aus komverw übernommen, Maß für Maß. Teil 2 ist neu für das Dokument. */

/* Die Vorschauen bekommen die Schriften als --font-sans und --font-mono. */
:root {
    --sans: var(--font-sans, "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
    --mono: var(--font-mono, "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace);
}
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

/* ---------- Teil 1: Grund ---------- */

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--papier);
    color: var(--tinte);
    font: var(--text) / 1.45 var(--sans);
    font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
code, .mono { font-family: var(--mono); font-size: 0.93em; }
:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Der Bezeichner: eine Form, und sie steht hier. Ein <button> erbt weder
   text-transform noch letter-spacing, darum steht er mit in der Liste. */
h2, .feld > h2 > button, .bez, .kachel-name {
    font-family: inherit;
    font-size: var(--bezeichner);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tinte-2);
}
h2 { margin: 0 0 8px; }
h1 { margin: 0; font-size: var(--titel); font-weight: 600; }

select, input, textarea {
    font: inherit;
    color: var(--tinte);
    background: var(--flaeche);
    border: 1px solid var(--linie-2);
    border-radius: var(--rund);
}
select { inline-size: 100%; padding: 4px 6px; max-inline-size: 100%; }
input[type="text"], input[type="password"] { padding: 4px 6px; }
input[inputmode="numeric"] { inline-size: 5rem; text-align: end; }
input[type="checkbox"], input[type="radio"] { margin: 0; accent-color: var(--tinte); }
::placeholder { color: var(--tinte-3); }

/* ---------- Feld ---------- */
.feld { background: var(--flaeche); border-block-end: 1px solid var(--linie); }
.feld > h2 { margin: 0; }
.feld > h2 > button {
    display: flex; align-items: center; gap: 8px;
    inline-size: 100%; margin: 0; padding: 10px 16px;
    line-height: 1.45; background: none; border: 0; text-align: start; cursor: pointer;
}
.feld > h2 > button:hover { color: var(--tinte); }
.feld > h2 > button:focus-visible { outline-offset: -3px; }
.feld > h2 > button[aria-expanded="true"] .pfeil { transform: rotate(180deg); }
.feld > h2 > button .marke { margin-inline-start: auto; text-transform: none; letter-spacing: 0; }
.feld-inhalt { display: flex; flex-direction: column; gap: 10px; padding: 2px 16px 16px; }
.feld-inhalt form { display: flex; flex-direction: column; gap: 10px; }
.feld-inhalt form > .knopf.primaer { margin-block-start: 6px; }

/* ---------- Knopf: ein primärer je Feld; gefährlich ist zweistufig ---------- */
.knopf {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    margin: 0; padding: 6px 12px;
    font: inherit; font-weight: 500; line-height: 1.3;
    color: var(--tinte); background: var(--flaeche);
    border: 1px solid var(--linie-2); border-radius: var(--rund);
    text-decoration: none; cursor: pointer;
}
.knopf:hover { border-color: var(--tinte); }
.knopf.primaer { color: var(--flaeche); background: var(--tinte); border-color: var(--tinte); }
.knopf.primaer:hover { background: var(--tinte-2); border-color: var(--tinte-2); }
.knopf.gefaehrlich { color: var(--fehler); border-color: var(--fehler); }
.knopf.gefaehrlich.sicher { color: var(--flaeche); background: var(--fehler); }
.knopf.still { color: var(--tinte-2); border-color: transparent; padding-inline: 6px; background: transparent; }
.knopf.symbol { inline-size: 1.5rem; block-size: 1.5rem; padding: 0; justify-content: center; }
.knopf.symbol .ikon { inline-size: 14px; block-size: 14px; }
.knopf.symbol[disabled] { color: var(--linie); border-color: var(--linie); background: transparent; cursor: default; }
.knopf.symbol[disabled]:hover { border-color: var(--linie); background: transparent; }
.knopf.still:hover { color: var(--tinte); background: var(--flaeche-2); }
.knopf[aria-pressed="true"]:not(.still) { color: var(--flaeche); background: var(--tinte); border-color: var(--tinte); }
.knopf.still[aria-pressed="true"] { color: var(--tinte); background: var(--flaeche-2); }
.knopf:disabled { color: var(--tinte-3); background: var(--flaeche-2); border-color: var(--linie); cursor: default; }
.feld-inhalt .knopf { inline-size: 100%; }
.reihe { display: flex; flex-wrap: wrap; gap: 6px; }
.reihe > .knopf { flex: 1 1 auto; inline-size: auto; }

/* ---------- Ikon ---------- */
.ikon { inline-size: 16px; block-size: 16px; flex: none; fill: currentColor; }
.feld > h2 > button .ikon { inline-size: 14px; block-size: 14px; }
.feld > h2 > button .pfeil { inline-size: 12px; block-size: 12px; }
.wahl label .ikon { inline-size: 14px; block-size: 14px; color: var(--tinte-2); }
.marke .ikon { inline-size: 12px; block-size: 12px; }
.modus .ikon { inline-size: 18px; block-size: 18px; }

/* ---------- Eingabe, Wahl, Einzelheit ---------- */
.eingabe { display: flex; align-items: center; gap: 10px; font-size: var(--klein); }
.eingabe > span { flex: 1; color: var(--tinte-2); }
.eingabe > span.nach { flex: none; }
.eingabe input { font-size: var(--text); }
.wahl { display: flex; flex-direction: column; gap: 5px; font-size: var(--klein); }
.wahl label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.wahl label:has(input:disabled) { color: var(--tinte-2); cursor: default; }
.wahl input:disabled { opacity: 0.45; }
/* Ein Formular wie die Angaben eines Fahrzeugs: Beschriftung links in fester
   Breite, das Feld nimmt den Rest, die Knöpfe darunter in einer Reihe. */
.angaben { display: flex; flex-direction: column; gap: 8px; }
.angaben .eingabe > span { flex: none; inline-size: 8rem; }
.angaben .eingabe input, .angaben .eingabe select { flex: 1; min-inline-size: 0; }
.angaben .eingabe input[inputmode="numeric"] { flex: none; }
.angaben > .reihe { margin-block-start: 4px; }

details > summary {
    display: flex; align-items: center; gap: 6px; min-block-size: 1.625rem;
    cursor: pointer; font-size: var(--klein); color: var(--tinte-2); list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary .pfeil { inline-size: 12px; block-size: 12px; flex: none; }
details[open] > summary .pfeil { transform: rotate(180deg); }
details.einzelheit > div { display: flex; flex-direction: column; gap: 8px; padding-block-start: 8px; }

/* ---------- Kennzahlen ---------- */
.kennzahlen { inline-size: 100%; border-collapse: collapse; }
.kennzahlen th { inline-size: 46%; padding: 4px 8px 4px 0; text-align: start; font-weight: 400; color: var(--tinte-2); vertical-align: baseline; }
.kennzahlen td { padding: 4px 0; }
.kennzahlen tr + tr th, .kennzahlen tr + tr td { border-block-start: 1px solid var(--linie); }
.kennzahlen.klein { font-size: var(--klein); }

/* ---------- Hinweis und Meldung ---------- */
.hinweis { margin: 0; color: var(--tinte-2); font-size: var(--klein); }
.hinweis.warnung { color: var(--warnung); }
.hinweis.fehler { color: var(--fehler); }
.meldung { margin: 0; min-block-size: 1.4em; font-size: var(--klein); color: var(--tinte-2); }
.meldung.erfolg { color: var(--erfolg); }
.meldung.fehler { color: var(--fehler); }
.meldung.warnung { color: var(--warnung); }
.meldung:empty { display: none; }

/* ---------- Marke: Zustand in Form ---------- */
.marke {
    display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px;
    border: 0; border-radius: var(--rund-klein);
    font: inherit; font-size: var(--bezeichner); font-weight: 500; letter-spacing: 0.02em;
    color: var(--tinte-2); background: var(--flaeche-2);
}
.marke.warnung { color: var(--warnung); background: var(--warnung-grund); }
.marke.erfolg { color: var(--erfolg); background: var(--erfolg-grund); }
.marke.fehler { color: var(--fehler); background: var(--fehler-grund); }
button.marke { cursor: pointer; }
button.marke:hover { box-shadow: inset 0 0 0 1px currentColor; }
/* Ausgefiltert: nur noch der Umriss, das Wort bleibt lesbar. */
button.marke[aria-pressed="false"] { color: var(--tinte-2); background: transparent; box-shadow: inset 0 0 0 1px var(--linie); }

/* ---------- Liste, Kartenkarte, Modusanzeige ---------- */
.liste { max-block-size: 40vh; overflow-y: auto; padding: 0 8px; border: 1px solid var(--linie); border-radius: var(--rund); background: var(--flaeche-2); }
.kartenkarte { background: var(--flaeche); border: 1px solid var(--linie-2); border-radius: var(--rund-gross); box-shadow: var(--schatten); }
.modus {
    display: inline-flex; align-items: center; gap: 10px; padding: 5px 12px;
    border-radius: var(--rund); font-size: var(--klein); font-weight: 500;
    color: var(--flaeche); background: var(--tinte); box-shadow: var(--schatten);
}
.modus kbd { font: inherit; font-size: var(--bezeichner); padding: 0 5px; border: 1px solid var(--flaeche); border-radius: var(--rund-klein); opacity: 0.7; }

/* ---------- Dialog ---------- */
dialog {
    padding: 0; color: var(--tinte); background: var(--flaeche);
    border: 1px solid var(--linie-2); border-radius: var(--rund-gross); box-shadow: var(--schatten-tief);
    inline-size: calc(100% - 48px); max-inline-size: 34rem;
}
dialog::backdrop { background: var(--abblendung-tief); }
dialog .dialogkopf { display: flex; align-items: center; padding: 12px 16px; border-block-end: 1px solid var(--linie); }
dialog .dialogkopf h2 { flex: 1; margin: 0; font-size: var(--titel); font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--tinte); }
dialog .dialoginhalt { display: flex; flex-direction: column; gap: 14px; padding: 16px; }

/* ---------- Ablagefeld ---------- */
.nur-fuer-etikett { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ablagefeld {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px;
    border: 1px dashed var(--linie-2); border-radius: var(--rund-gross);
    background: var(--papier); color: var(--tinte-2); text-align: center; cursor: pointer;
}
.ablagefeld .ikon { inline-size: 32px; block-size: 32px; }
.ablagefeld .beschriftung { font-weight: 600; color: var(--tinte); }
.ablagefeld .zusatz { font-size: var(--klein); }
.ablagefeld:hover, .ablagefeld.ziehen { border-color: var(--tinte); background: var(--flaeche-2); }
.ablagefeld.ziehen { border-style: solid; }
.nur-fuer-etikett:focus-visible + .ablagefeld { outline: 2px solid var(--fokus); outline-offset: 2px; }
.ablagefeld.stumm { color: var(--tinte-3); border-color: var(--linie); pointer-events: none; }
.ablagefeld.stumm .beschriftung { color: var(--tinte-3); }

/* ---------- Gerüst: Anwendungsleiste ---------- */
.fenster { display: flex; flex-direction: column; inline-size: 100%; background: var(--papier); overflow: hidden; }
.kopfleiste {
    display: flex; align-items: center; gap: 20px; flex: none; block-size: 48px;
    padding: 0 16px 0 8px; background: var(--flaeche); border-block-end: 1px solid var(--linie);
}
.kopfleiste .rechts { display: flex; align-items: center; gap: 6px; flex: none; }
.signet { flex: none; }
.signet-knopf { justify-content: flex-start; gap: 10px; padding: 4px 8px; text-align: start; line-height: 1.25; }
.signet-ikon { inline-size: 22px; block-size: 22px; color: var(--tinte); }
.signet-text { display: flex; flex-direction: column; align-items: flex-start; white-space: nowrap; }
.signet-name { font-size: var(--titel); font-weight: 600; color: var(--tinte); }
.signet-ansicht { display: inline-flex; align-items: center; gap: 4px; font-size: var(--klein); color: var(--tinte-2); }
.suchbereich { display: flex; flex: 0 6 auto; min-inline-size: 6.5rem; margin-inline: auto; position: relative; }
.suchfeld { display: flex; align-items: center; min-inline-size: 0; position: relative; }
.suchfeld .lupe { position: absolute; inset-inline-start: 8px; inline-size: 15px; block-size: 15px; color: var(--tinte-3); pointer-events: none; }
.suchfeld input[type="search"] { inline-size: 24rem; min-inline-size: 7rem; padding: 4px 8px 4px 28px; font-size: var(--klein); }

/* ---------- Menü ---------- */
.ausklapp { position: relative; }
.ausklappfeld { position: absolute; top: calc(100% + 6px); left: 0; z-index: 5; inline-size: 22rem; display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.ausklappfeld.rechtsbuendig { left: auto; right: 0; }
.menue { inline-size: auto; min-inline-size: 14rem; gap: 2px; padding: 4px; }
.menue > .knopf { justify-content: flex-start; padding: 6px 10px; white-space: nowrap; }
.menue > hr { inline-size: 100%; margin: 4px 0; border: 0; border-block-start: 1px solid var(--linie); }
.menue-kopf { padding: 6px 10px 8px; margin-block-end: 2px; border-block-end: 1px solid var(--linie); font-size: var(--klein); color: var(--tinte-2); white-space: nowrap; }
.menueknopf .pfeil { inline-size: 12px; block-size: 12px; flex: none; }
.menueknopf[aria-expanded="true"] .pfeil { transform: rotate(180deg); }

/* ---------- Gerüst: Werkzeugleiste, in komverw die Modulleiste ---------- */
.werkzeugleiste {
    display: flex; align-items: center; gap: 16px; flex: none; block-size: 40px;
    padding: 0 12px; background: var(--flaeche); border-block-end: 1px solid var(--linie);
}
.werkzeugleiste .knopf { block-size: 28px; padding-block: 0; }
.werkzeugleiste .knopf.symbol { inline-size: 28px; }
.werkzeugleiste .knopf.symbol .ikon { inline-size: 18px; block-size: 18px; }
.leiste-schalter[aria-pressed="true"] { background: transparent; }
.leiste-schalter:hover { background: var(--flaeche-2); }
/* Neben einer Zone gibt es keine Leiste zu schalten: blass, auch wenn sie davor offen war. */
.leiste-schalter:disabled { color: var(--linie); background: transparent; border-color: transparent; }
.reiter { display: flex; align-items: center; gap: 4px; flex: none; padding-inline-start: 12px; border-inline-start: 1px solid var(--linie); margin-inline-end: auto; }
.reiter > .knopf.still { padding-inline: 8px; }
.reiter > .knopf.still[aria-pressed="true"] {
    color: var(--tinte);
    background: linear-gradient(var(--tinte), var(--tinte)) center bottom 2px / calc(100% - 16px) 2px no-repeat;
}
.reiter > .knopf.still[aria-pressed="true"]:hover { background-color: var(--flaeche-2); }
.reiter > .trenner { flex: none; inline-size: 1px; block-size: 20px; margin-inline: 8px; background: var(--linie); }

/* Das Fach der Datei, in komverw das Projekt: Name, Zeit des Sicherns, Marke,
   dazu „Sichern“ und die Meldung. Es kürzt, wenn es eng wird, die Marke nie. */
.dateifach { display: flex; align-items: center; gap: 8px; min-inline-size: 0; }
.dateifach > .knopf { min-inline-size: 0; gap: 6px; }
.dateifach > .knopf.primaer { flex: none; }
.status { display: inline-flex; align-items: center; gap: 8px; min-inline-size: 0; overflow: hidden; font-size: var(--klein); font-weight: 400; color: var(--tinte-2); white-space: nowrap; }
.status .name { font-weight: 500; color: var(--tinte); }
.status .satz { flex: 0 1 auto; min-inline-size: 3rem; overflow: hidden; text-overflow: ellipsis; }
.status .marke { flex: none; }
.dateifach .meldung { flex: 1 4 auto; min-inline-size: 5rem; min-block-size: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Gerüst: Mitte und Fußzeile ---------- */
.mitte { display: flex; flex: 1; min-block-size: 0; }
.steuerung { inline-size: 22rem; flex: none; overflow-y: auto; background: var(--flaeche); border-inline-end: 1px solid var(--linie); }
@media (min-width: 1600px) { .steuerung { inline-size: 24rem; } }
.fusszeile {
    display: flex; align-items: center; gap: 16px; flex: none; block-size: 24px; padding: 0 16px;
    white-space: nowrap; overflow: hidden; font-size: var(--bezeichner); color: var(--tinte-2);
    background: var(--flaeche); border-block-start: 1px solid var(--linie);
}
.fusszeile p { margin: 0; }
.fusszeile .rechts { margin-inline-start: auto; }

/* ---------- Zone, Zonenkarte, Kacheln, Zahlentafel ---------- */
.zone { flex: 1; min-inline-size: 0; overflow: auto; padding: 14px; background: var(--papier); container: zone / inline-size; }
.zonenraster { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 12px; align-items: start; max-inline-size: 120rem; }
.zonenraster.gleich { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.zonenraster.lang { grid-template-columns: minmax(0, 1fr) minmax(0, 25rem); }
@container zone (width <= 1072px) { .zonenraster.bricht { grid-template-columns: minmax(0, 1fr); } }
.zonenkarte { min-inline-size: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund-gross); }
.zonenkarte.breit { grid-column: 1 / -1; }
.kartenkopf { display: flex; align-items: center; gap: 8px; min-block-size: 1.75rem; }
.kartenkopf > h2 { margin: 0; min-inline-size: 0; }
.kartenkopf > .griffe { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 8px 16px; margin-block: 10px 4px; }
.kachel { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: var(--rund-gross); }
.kachel-wert { font-size: var(--zahl); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--tinte); }
.kachel-zusatz { font-size: var(--klein); color: var(--tinte-2); }
.zahlentafel { inline-size: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.zahlentafel th, .zahlentafel td { padding: 4px 6px; text-align: end; white-space: nowrap; }
.zahlentafel th { font-family: inherit; font-size: var(--bezeichner); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--tinte-2); line-height: 1.3; box-shadow: inset 0 -1px var(--linie); vertical-align: bottom; }
.zahlentafel .links { text-align: start; white-space: normal; }
.zahlentafel td.kennung { font-weight: 500; }
.zahlentafel tbody tr + tr td { border-block-start: 1px solid var(--linie); }
.zahlentafel .summe td { border-block-start: 2px solid var(--tinte); font-weight: 600; }
.zahlentafel th > button { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; line-height: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.zahlentafel th > button:hover, .zahlentafel th[aria-sort] > button { color: var(--tinte); }
.zahlentafel th > button .ikon { inline-size: 12px; block-size: 12px; }
.zahlentafel.waehlbar tbody tr { cursor: pointer; }
.zahlentafel.waehlbar tbody tr:hover td, .zahlentafel tr[aria-selected="true"] td { background: var(--flaeche-2); }
.tafel { inline-size: 100%; max-inline-size: 30rem; padding: 20px 24px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund-gross); }

/* ---------- Teil 2, neu: die Bühne ---------- */

.buehne { position: relative; flex: 1; min-inline-size: 60%; display: flex; flex-direction: column; background: var(--dok-grund); }
/* Das Modusband: Eine Karte lässt sich überlagern, Text nicht. Darum liegt die Anzeige
   nicht auf dem Dokument, sondern steht über ihm, und mit ihr alles, was der Modus braucht. */
.modusband { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 10px; background: var(--flaeche); border-block-end: 1px solid var(--linie); }
.modusband .eingabe > span { flex: none; white-space: nowrap; }
.modusband input[type="text"] { inline-size: 7rem; padding-block: 2px; }
.modusband .hinweis, .modusband .meldung { min-block-size: 0; white-space: nowrap; }
.modusband .griffe { margin-inline-start: auto; display: flex; gap: 6px; }
.modusband .knopf { block-size: 28px; padding-block: 0; }

/* Das Dokument: eine Zeile, eine feste Höhe. Mono gibt es nur in 400: nichts wird fett oder kursiv. */
.dokument { flex: 1; min-block-size: 0; overflow: auto; padding-block: 8px; font: 400 var(--dokument) / var(--dokumentzeile) var(--mono); font-synthesis: none; font-variant-numeric: normal; background: var(--dok-grund); color: var(--tinte); }
.zeile { display: grid; grid-template-columns: 3.25rem 18px minmax(0, 1fr); min-block-size: var(--dokumentzeile); }
.zeile .nr { padding-inline-end: 6px; text-align: end; color: var(--tinte-2); user-select: none; }
.zeile .rand { display: flex; align-items: center; justify-content: center; border-inline-start: 1px solid var(--linie); }
.zeile .rand .ikon { inline-size: 12px; block-size: 12px; }
.zeile .inhalt { padding-inline-start: 4px; white-space: pre; }
.zeile.aktuell { background: var(--dok-zeile); }
.zeile.aktuell .nr { color: var(--tinte); }
.zeile .rand.fehler { color: var(--fehler); }
.zeile .rand.warnung { color: var(--warnung); }

/* Eine Einfärbung zur Zeit: im Dokument die Syntax. */
.x-element { color: var(--xml-element); }
.x-attribut { color: var(--xml-attribut); }
.x-wert { color: var(--xml-wert); }
.x-sonder { color: var(--xml-sonder); }
.x-kommentar { color: var(--xml-kommentar); }
.x-zeichen { color: var(--xml-zeichen); }

.m-auswahl { background: var(--dok-auswahl); }
.m-zeiger { box-shadow: inset 1px 0 0 var(--tinte); }
.m-treffer { box-shadow: 0 0 0 1px var(--dok-treffer); border-radius: 1px; }
.m-treffer.aktiv { background: var(--tinte); box-shadow: 0 0 0 1px var(--tinte); }
.m-treffer.aktiv, .m-treffer.aktiv * { color: var(--flaeche); }
.m-paar { box-shadow: 0 0 0 1px var(--linie-2); border-radius: 1px; }
.m-fehler { text-decoration: underline wavy var(--fehler) 1px; text-underline-offset: 3px; }
.m-warnung { text-decoration: underline wavy var(--warnung) 1px; text-underline-offset: 3px; }
.falte-rest { margin-inline-start: 6px; padding: 0 5px; font-family: var(--sans); font-size: var(--bezeichner); color: var(--tinte-2); background: var(--flaeche-2); border-radius: var(--rund-klein); }

/* Der Baum: dieselbe Hierarchie wie der Text, derselbe Pfeil wie der Feldkopf. */
.baum, .baum ul { margin: 0; padding: 0; list-style: none; }
.baum ul { padding-inline-start: 12px; }
.baumzeile { display: flex; align-items: center; gap: 4px; inline-size: 100%; min-block-size: 1.5rem; padding: 2px 6px; font: inherit; font-size: var(--klein); color: var(--tinte); background: none; border: 0; border-radius: var(--rund-klein); text-align: start; cursor: pointer; white-space: nowrap; }
.baumzeile:hover, .baumzeile[aria-selected="true"] { background: var(--flaeche-2); }
.baumzeile .pfeil { inline-size: 12px; block-size: 12px; flex: none; color: var(--tinte-2); }
.baumzeile[aria-expanded="true"] .pfeil { transform: rotate(180deg); }
.baumzeile .platz { inline-size: 12px; flex: none; }
.baumzeile .leise { margin-inline-start: 6px; color: var(--tinte-2); overflow: hidden; text-overflow: ellipsis; }

/* Eine Zeile mit Sprung: Befunde und Änderungen. */
.sprungliste { display: flex; flex-direction: column; gap: 2px; }
.sprung { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 2px 6px; align-items: baseline; inline-size: 100%; padding: 5px 6px; font: inherit; font-size: var(--klein); color: var(--tinte); background: none; border: 0; border-radius: var(--rund-klein); text-align: start; cursor: pointer; }
.sprung:hover, .sprung[aria-current="true"] { background: var(--flaeche-2); }
.sprung > .ikon { inline-size: 12px; block-size: 12px; align-self: center; }
.sprung .ort { overflow-wrap: anywhere; }
.sprung .satz { grid-column: 2; color: var(--tinte-2); }
.sprung.fehler > .ikon { color: var(--fehler); }
.sprung.warnung > .ikon { color: var(--warnung); }
.sprung.neu > .ikon { color: var(--diff-neu); }
.sprung.weg > .ikon { color: var(--diff-weg); }
.sprung.geaendert > .ikon { color: var(--tinte-2); }
.sprung.verschoben > .ikon { color: var(--diff-verschoben); }

/* ---------- Teil 2, neu: der Vergleich ---------- */

.marke.neu { color: var(--diff-neu); background: var(--diff-neu-grund); }
.marke.weg { color: var(--diff-weg); background: var(--diff-weg-grund); }
.marke.verschoben { color: var(--diff-verschoben); background: var(--diff-verschoben-grund); }
.feldkopfzeile { display: flex; flex-wrap: wrap; gap: 4px; }

/* Rechts bleibt der Platz des Streifens frei: So steht die Grenze über der Grenze der Reihen. */
.standkopf { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-inline-end: 12px; background: var(--flaeche); border-block-end: 1px solid var(--linie); }
.standkopf > div { display: flex; align-items: baseline; gap: 8px; min-inline-size: 0; padding: 6px 10px; white-space: nowrap; overflow: hidden; }
.standkopf > div + div { border-inline-start: 1px solid var(--linie); }
.standkopf .bez { flex: none; }
.standkopf .mono { color: var(--tinte); overflow: hidden; text-overflow: ellipsis; font-size: var(--klein); }
.standkopf .zeit { flex: none; margin-inline-start: auto; font-size: var(--klein); color: var(--tinte-2); }

.vergleich { position: relative; flex: 1; min-block-size: 0; display: flex; }
.diff { flex: 1; min-inline-size: 0; overflow: auto; font: 400 var(--dokument) / var(--dokumentzeile) var(--mono); font-synthesis: none; font-variant-numeric: normal; background: var(--dok-grund); scroll-behavior: auto; }

/* Eine Reihe je Zeile: beide Seiten rollen gemeinsam, darum wird umbrochen, nicht seitlich gerollt. */
.diffreihe { display: grid; grid-template-columns: 2.75rem 18px minmax(0, 1fr) 2.75rem 18px minmax(0, 1fr); min-block-size: var(--dokumentzeile); }
.diff.folge .diffreihe { grid-template-columns: 2.75rem 2.75rem 18px minmax(0, 1fr); }
.diffreihe > .nr { padding-inline-end: 6px; text-align: end; color: var(--tinte-2); user-select: none; }
.diffreihe > .nr.b { border-inline-start: 1px solid var(--linie); }
.diff.folge .diffreihe > .nr.b { border-inline-start: 0; }
.diffreihe > .zeichen { display: flex; align-items: flex-start; justify-content: center; padding-block-start: 4px; }
.diffreihe > .zeichen .ikon { inline-size: 12px; block-size: 12px; }
/* Eine umbrochene Zeile rückt 2 Zeichen ein, damit sie als Fortsetzung zu erkennen ist. */
.diffreihe > .text { padding-inline: calc(2px + 2ch) 8px; text-indent: -2ch; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Eine Einfärbung zur Zeit: im Vergleich tritt die Syntax in die Tinte zurück. */
.diff .x-element, .diff .x-wert, .diff .x-sonder { color: var(--tinte); }
.diff .x-attribut, .diff .x-zeichen, .diff .x-kommentar { color: var(--tinte-2); }

.neu-seite { background: var(--diff-neu-grund); }
.neu-seite.zeichen { color: var(--diff-neu); }
.weg-seite { background: var(--diff-weg-grund); }
.weg-seite.zeichen { color: var(--diff-weg); }
.versch-seite { background: var(--diff-verschoben-grund); }
.versch-seite.zeichen { color: var(--diff-verschoben); }
/* Die leere Gegenseite trägt die Schraffur von `gesperrt`. */
.leer-seite { background: repeating-linear-gradient(135deg, var(--diff-leer) 0 3px, transparent 3px 6px); }
.wort-neu, .wort-neu * { background: var(--diff-neu-wort); color: var(--tinte); }
.wort-weg, .wort-weg * { background: var(--diff-weg-wort); color: var(--tinte); }

.diffreihe.gewaehlt > .nr { color: var(--tinte); font-weight: 400; box-shadow: inset 0 1px 0 var(--tinte), inset 0 -1px 0 var(--tinte); }
.diffreihe.gewaehlt > .zeichen, .diffreihe.gewaehlt > .text { box-shadow: inset 0 1px 0 var(--tinte), inset 0 -1px 0 var(--tinte); }

.falte { display: flex; align-items: center; justify-content: center; gap: 6px; inline-size: 100%; min-block-size: 1.5rem; padding: 2px 8px; font: inherit; font-family: var(--sans); font-size: var(--klein); color: var(--tinte-2); background: var(--flaeche); border: 0; border-block: 1px solid var(--linie); cursor: pointer; }
.falte:hover { color: var(--tinte); background: var(--flaeche-2); }
.falte .pfeil { inline-size: 12px; block-size: 12px; }

/* Der Griff im Zusammenführen: nur solange der Modus läuft. */
.griff { display: none; }
.vergleich.fuehrt .griff { display: inline-flex; float: inline-end; align-items: center; justify-content: center; inline-size: 1.25rem; block-size: 1.25rem; margin: 0 0 0 4px; padding: 0; color: var(--tinte); background: var(--flaeche); border: 1px solid var(--linie-2); border-radius: var(--rund); cursor: pointer; }
.vergleich.fuehrt .griff:hover { border-color: var(--tinte); }
.vergleich.fuehrt .griff .ikon { inline-size: 12px; block-size: 12px; }
.griff.entschieden, .vergleich.fuehrt .griff.entschieden { color: var(--flaeche); background: var(--tinte); border-color: var(--tinte); }

/* Der Streifen zeigt das ganze Dokument: jede Änderung an ihrer Stelle, in ihrer Farbe. */
.streifen { position: relative; flex: none; inline-size: 12px; background: var(--flaeche); border-inline-start: 1px solid var(--linie); }
.streifen button { position: absolute; inset-inline: 2px; min-block-size: 4px; padding: 0; border: 0; border-radius: 1px; cursor: pointer; }
.streifen .neu { background: var(--diff-neu); }
.streifen .weg { background: var(--diff-weg); }
.streifen .geaendert { background: linear-gradient(90deg, var(--diff-weg) 50%, var(--diff-neu) 50%); }
.streifen .verschoben { background: var(--diff-verschoben); }
.streifen button[aria-current="true"] { box-shadow: 0 0 0 1px var(--tinte); }

/* ---------- Vorschauen ---------- */
.probe { display: flex; flex-direction: column; gap: 14px; padding: 16px; background: var(--flaeche); min-block-size: 100%; }
.probe.papier { background: var(--papier); }
.probezeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.schmal { inline-size: 22rem; max-inline-size: 100%; }
.ikongitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 4px 12px; font-size: var(--klein); }
.ikongitter > div { display: flex; align-items: center; gap: 8px; min-inline-size: 0; padding-block: 3px; }
.ikongitter code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tinte-2); }

/* Gemeinsam für DIFF und EDIT: Werkzeugleiste und Werkzeugmenü. Stand vorher nur in DIFF, darum wich EDIT ab (gesperrte Pfeile mit Rahmen, Leistenschalter dauerhaft hinterlegt). */
.dateifach > .knopf.symbol { flex: none; }
.reiter > .knopf.still:disabled { color: var(--tinte-3); background: transparent; border-color: transparent; }
.reiter > .knopf.symbol:disabled { opacity: .45; }
/* Die Regeln des Design Systems für den Leistenschalter verloren gegen die allgemeine für „gedrückt“: Er sah dauerhaft gehovert aus
   und blieb in den Kennzahlen dunkel. Gleiche Regeln, stärkerer Selektor, Reihenfolge wie im Design System. */
.knopf.still.leiste-schalter[aria-pressed="true"] { background: transparent; }
.knopf.still.leiste-schalter:hover { background: var(--flaeche-2); }
.knopf.still.leiste-schalter:disabled { color: var(--linie); background: transparent; border-color: transparent; }
/* Das Werkzeugmenü am Signet: Name und Zweck je Werkzeug, das offene ist hinterlegt. */
.menue .zweizeilig { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.25; }
.menue .zweizeilig small { font-size: var(--bezeichner); font-weight: 400; color: var(--tinte-2); }
.menue > a.knopf { text-decoration: none; }
.menue > .knopf[aria-current="page"] { color: var(--tinte); background: var(--flaeche-2); }

/* Was nur die Startseite braucht. Kein Farbwert: alle Farben sind Verweise auf die Token.
   Konzept Startseite vom 8. November 2026: Maß und Spalten rechnet src/start/main.ts aus Fenster und Kachelzahl,
   was eine Kachel zeigt, entscheiden die Container Queries unten am Maß der Kachel (S, M, L, XL).
   Kopfleiste 48 px, Fußzeile 36 px; ohne Skript steht ein einfaches Raster. */
html, body { margin: 0; block-size: 100%; }
.fenster { block-size: 100vh; block-size: 100dvh; }
/* Ohne Suchfeld rückt die Darstellung von selbst nach rechts. */
.kopfleiste .rechts { margin-inline-start: auto; }
.knopf.still.signet-ruhig { cursor: default; }
.knopf.still.signet-ruhig:hover { color: var(--tinte-2); background: transparent; }
@media (max-width: 600px) { .stufe-klein { display: none; } }

/* Die Fläche: Der Rand kommt vom Skript (4 % der kürzeren Fensterseite, 16 bis 48 px). Der Block der Kacheln
   steht etwas über der Mitte; wird es zu eng, rollt die Fläche. */
.kachelflaeche { flex: 1 1 auto; min-block-size: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 32px; }
.kachelflaeche::before { content: ""; flex: 2 1 0; }
.kachelflaeche::after { content: ""; flex: 3 1 0; }
.startkacheln { flex: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 16px; inline-size: min(100%, 60rem); margin: 0; padding: 0; list-style: none; }
.startkacheln > .startkachel { aspect-ratio: 4 / 3; }
.startkacheln.gerechnet { display: flex; flex-wrap: wrap; justify-content: center; }
.startkacheln.gerechnet > .startkachel { flex: none; inline-size: var(--kw); block-size: var(--kh); aspect-ratio: auto; }
.startfuss { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; block-size: 36px; padding-inline: 32px; font-size: var(--klein); color: var(--tinte-3); white-space: nowrap; overflow: hidden; }

/* Die Kachel: Stufe S zeigt Symbol und Name. */
.startkachel { position: relative; container-type: size; min-inline-size: 0; }
.kachel-griff {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    inline-size: 100%; block-size: 100%; padding: 12px; overflow: hidden;
    color: var(--tinte); background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund-gross);
    font-size: var(--text); line-height: 1.4; text-decoration: none;
}
.kachel-griff:hover { border-color: var(--tinte); }
.kachel-griff:active { background: var(--flaeche-2); }
.k-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; inline-size: 100%; }
.k-symbol { inline-size: 24px; block-size: 24px; color: var(--tinte); }
.k-marken { display: flex; gap: 4px; }
.k-name { font-size: var(--titel); font-weight: 600; line-height: 1.2; letter-spacing: 0.02em; }
.k-zweck, .k-griffe, .k-fuss { display: none; }
.k-zweck { font-size: var(--klein); line-height: 1.4; color: var(--tinte-2); text-wrap: pretty; }
.k-griffe { flex-direction: column; gap: 3px; margin-block-start: 2px; font-size: var(--klein); line-height: 1.45; color: var(--tinte-2); }
.k-griffe > span { display: flex; align-items: baseline; gap: 8px; }
.k-griffe > span::before { content: ""; flex: none; inline-size: 6px; block-size: 1px; background: var(--tinte-3); transform: translateY(-3px); }
.k-fuss { align-items: center; gap: 8px; inline-size: 100%; margin-block-start: auto; padding-block-start: 10px; border-block-start: 1px solid var(--linie); font-size: var(--klein); line-height: 18px; color: var(--tinte-2); }
.k-fuss kbd { flex: none; min-inline-size: 18px; padding: 0 5px; font: 400 var(--bezeichner) / 16px var(--mono); text-align: center; color: var(--tinte); border: 1px solid var(--linie-2); border-radius: var(--rund-klein); }
.k-datei { flex: 1; min-inline-size: 0; }
.k-pfeil { color: var(--tinte-3); }
.kachel-griff:hover .k-pfeil { color: var(--tinte); }

/* Die Schwellen: Breite und Höhe der Kachel, gemessen ohne Rand außen. */
@container (min-width: 200px) and (min-height: 140px) {
    .kachel-griff { padding: 16px; }
    .k-symbol { inline-size: 28px; block-size: 28px; }
    .k-name { font-size: 22px; }
    .k-zweck { display: block; }
}
@container (min-width: 280px) and (min-height: 230px) {
    .kachel-griff { padding: 20px; gap: 8px; }
    .k-symbol { inline-size: 32px; block-size: 32px; }
    .k-name { font-size: var(--zahl); }
    .k-zweck { font-size: var(--text); }
    .k-griffe { display: flex; }
}
@container (min-width: 360px) and (min-height: 300px) {
    .kachel-griff { padding: 24px; }
    .k-symbol { inline-size: 40px; block-size: 40px; }
    .k-fuss { display: flex; }
}
