/* PDF-Werkzeuge – Gestaltung
   Farben kommen aus Paletten, Standard ist Petrol. Gewählt wird unter
   „Einstellungen“: <html data-palette="tinte|aubergine|graphit|terrakotta">
   und data-theme="light|dark" (ohne data-theme folgt die Helligkeit dem Gerät).
   js/thema.js setzt beides vor dem ersten Zeichnen.
   Ansichten: <body data-ansicht="start|werkzeug|einstellungen">. Mit Datei
   wird die Seite zur Arbeitsfläche: Kopfleiste, Werkzeugschiene links, Inhalt.
   Unter 820 px wandert die Werkzeugwahl in ein Blatt von unten, die
   Werkzeugleiste des Seiteneditors an den unteren Rand. */

:root {
  /* Petrol – hell */
  --papier: #edf3f3;
  --flaeche: #ffffff;
  --flaeche-2: #f4f8f8;
  --arbeitsflaeche: #dde6e6;
  --tinte: #10201f;
  --tinte-2: #4e6261;
  --tinte-3: #34494a;
  --linie: #d3e0df;
  --linie-2: #bdcfcd;
  --akzent: #0e6470;
  --akzent-druck: #0a4e57;
  --akzent-text: #ffffff;
  --akzent-wasch: #e1f0f1;
  --akzent-rand: #b5d9dc;
  --haupt: var(--akzent);
  --haupt-druck: var(--akzent-druck);
  --haupt-text: var(--akzent-text);
  --auswahl: #0f7f8c;
  --erfolg: #2e6b3a;
  --erfolg-wasch: #e7f2ea;
  --hinweis: #8a4b08;
  --hinweis-wasch: #fdf1de;
  --hinweis-punkt: #d98a1c;
  --fehler: #b42318;
  --fehler-wasch: #fdecea;
  --fehler-text: #ffffff;
  --unterschrift: #1f3f8f;
  --schatten: 0 1px 2px rgb(16 32 31 / 0.05), 0 8px 24px rgb(16 32 31 / 0.06);
  --schatten-gross: 0 16px 40px rgb(16 32 31 / 0.18);

  --schrift-text: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --schrift-titel: "Source Serif 4", Georgia, "Times New Roman", serif;

  --groesse-klein: 0.8125rem;
  --groesse-text: 0.9375rem;
  --groesse-h3: 1rem;
  --groesse-h2: 1.375rem;
  --groesse-h1: 2.25rem;
  --radius: 10px;
  --radius-gross: 14px;
  --kopf-hoehe: 64px;
  color-scheme: light;
}

/* Weitere Paletten – hell */
:root[data-palette="tinte"] {
  --papier: #eef1f5; --flaeche: #ffffff; --flaeche-2: #f5f7fa; --arbeitsflaeche: #e3e7ed;
  --tinte: #141a26; --tinte-2: #566074; --tinte-3: #3b4558; --linie: #dce1e8; --linie-2: #c5cdd9;
  --akzent: #2447a6; --akzent-druck: #1b3887; --akzent-text: #ffffff; --akzent-wasch: #e9eefa; --akzent-rand: #c9d5f2;
  --auswahl: #2f6fe0; --erfolg: #1e6b4a; --erfolg-wasch: #e6f2ec;
}
:root[data-palette="aubergine"] {
  --papier: #f3f1f6; --flaeche: #ffffff; --flaeche-2: #f8f6fa; --arbeitsflaeche: #e6e2ec;
  --tinte: #1c1724; --tinte-2: #5d5669; --tinte-3: #3f3849; --linie: #e0dce6; --linie-2: #ccc5d6;
  --akzent: #5e3592; --akzent-druck: #4a2875; --akzent-text: #ffffff; --akzent-wasch: #efe8f7; --akzent-rand: #d6c6ec;
  --auswahl: #7b4bc0; --erfolg: #1e6b4a; --erfolg-wasch: #e6f2ec;
}
:root[data-palette="graphit"] {
  --papier: #f2f2f0; --flaeche: #ffffff; --flaeche-2: #f7f7f5; --arbeitsflaeche: #e4e4e1;
  --tinte: #18191b; --tinte-2: #5b5d62; --tinte-3: #3c3e42; --linie: #ddddda; --linie-2: #c9c9c5;
  --akzent: #1d5fd6; --akzent-druck: #174cab; --akzent-text: #ffffff; --akzent-wasch: #e8effc; --akzent-rand: #c3d5f7;
  --haupt: #18191b; --haupt-druck: #000000; --haupt-text: #ffffff;
  --auswahl: #1d5fd6; --erfolg: #1e6b4a; --erfolg-wasch: #e6f2ec;
}
:root[data-palette="terrakotta"] {
  --papier: #f5f2ed; --flaeche: #ffffff; --flaeche-2: #faf7f3; --arbeitsflaeche: #e8e2da;
  --tinte: #221b16; --tinte-2: #655a50; --tinte-3: #463d35; --linie: #e3dcd3; --linie-2: #d5ccc1;
  --akzent: #a3452a; --akzent-druck: #853520; --akzent-text: #ffffff; --akzent-wasch: #f8e9e3; --akzent-rand: #ebcbbe;
  --auswahl: #c2532f; --erfolg: #2e6b3a; --erfolg-wasch: #e7f2ea;
  --hinweis: #7a4d00; --hinweis-wasch: #fbf0d9; --fehler: #9b1c31; --fehler-wasch: #fbe8eb;
}

/* Dunkel: Grundwerte (Petrol) und je Palette – einmal für „wie das Gerät“,
   einmal für die ausdrückliche Wahl. Die Blöcke sind absichtlich gleich. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #0c1414; --flaeche: #142020; --flaeche-2: #1a2828; --arbeitsflaeche: #091010;
    --tinte: #e3eeed; --tinte-2: #93a9a7; --tinte-3: #b9cac8; --linie: #253535; --linie-2: #33494a;
    --akzent: #6cc5cf; --akzent-druck: #8fd5dd; --akzent-text: #062024; --akzent-wasch: #11343a; --akzent-rand: #1f5560;
    --haupt: var(--akzent); --haupt-druck: var(--akzent-druck); --haupt-text: var(--akzent-text);
    --erfolg: #8fd19a; --erfolg-wasch: #152a1a;
    --hinweis: #f0b860; --hinweis-wasch: #33260f; --hinweis-punkt: #f0b860;
    --fehler: #f08a80; --fehler-wasch: #3a1a17; --fehler-text: #2a0e0b;
    --unterschrift: #9fb7ff;
    --schatten: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    --schatten-gross: 0 16px 40px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-palette="tinte"] {
    --papier: #0f131a; --flaeche: #171c25; --flaeche-2: #1d2330; --arbeitsflaeche: #0b0e14;
    --tinte: #e6eaf1; --tinte-2: #9aa4b5; --tinte-3: #c0c8d4; --linie: #2a3240; --linie-2: #3a4456;
    --akzent: #9db6f2; --akzent-druck: #b9cbf6; --akzent-text: #0e1626; --akzent-wasch: #1e2a44; --akzent-rand: #34487a;
    --erfolg: #7cc8a0; --erfolg-wasch: #15281e;
  }
  :root:not([data-theme="light"])[data-palette="aubergine"] {
    --papier: #131019; --flaeche: #1c1724; --flaeche-2: #231d2d; --arbeitsflaeche: #0d0b12;
    --tinte: #ece8f2; --tinte-2: #a69eb3; --tinte-3: #cbc4d6; --linie: #302a3b; --linie-2: #423a50;
    --akzent: #c3a6ec; --akzent-druck: #d5c0f2; --akzent-text: #1d0f33; --akzent-wasch: #2e2142; --akzent-rand: #4d3870;
    --erfolg: #7cc8a0; --erfolg-wasch: #15281e;
  }
  :root:not([data-theme="light"])[data-palette="graphit"] {
    --papier: #111214; --flaeche: #1a1b1e; --flaeche-2: #222326; --arbeitsflaeche: #0b0c0d;
    --tinte: #ececea; --tinte-2: #a0a2a6; --tinte-3: #c7c8cb; --linie: #2e3034; --linie-2: #3e4045;
    --akzent: #7fa6f5; --akzent-druck: #a3c0f8; --akzent-text: #0e1626; --akzent-wasch: #1c2a44; --akzent-rand: #2e4a80;
    --haupt: #ececea; --haupt-druck: #ffffff; --haupt-text: #18191b;
    --erfolg: #7cc8a0; --erfolg-wasch: #15281e;
  }
  :root:not([data-theme="light"])[data-palette="terrakotta"] {
    --papier: #15110e; --flaeche: #1f1915; --flaeche-2: #282019; --arbeitsflaeche: #0e0b09;
    --tinte: #f1ebe5; --tinte-2: #aba096; --tinte-3: #d2c8be; --linie: #352c25; --linie-2: #4a3d33;
    --akzent: #e99a7c; --akzent-druck: #f0b39b; --akzent-text: #2a0f05; --akzent-wasch: #3a2219; --akzent-rand: #5e3526;
    --erfolg: #8fd19a; --erfolg-wasch: #152a1a; --fehler: #f4a0ae; --fehler-wasch: #3a1a1f;
  }
}
:root[data-theme="dark"] {
  --papier: #0c1414; --flaeche: #142020; --flaeche-2: #1a2828; --arbeitsflaeche: #091010;
  --tinte: #e3eeed; --tinte-2: #93a9a7; --tinte-3: #b9cac8; --linie: #253535; --linie-2: #33494a;
  --akzent: #6cc5cf; --akzent-druck: #8fd5dd; --akzent-text: #062024; --akzent-wasch: #11343a; --akzent-rand: #1f5560;
  --haupt: var(--akzent); --haupt-druck: var(--akzent-druck); --haupt-text: var(--akzent-text);
  --erfolg: #8fd19a; --erfolg-wasch: #152a1a;
  --hinweis: #f0b860; --hinweis-wasch: #33260f; --hinweis-punkt: #f0b860;
  --fehler: #f08a80; --fehler-wasch: #3a1a17; --fehler-text: #2a0e0b;
  --unterschrift: #9fb7ff;
  --schatten: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  --schatten-gross: 0 16px 40px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}
:root[data-theme="dark"][data-palette="tinte"] {
  --papier: #0f131a; --flaeche: #171c25; --flaeche-2: #1d2330; --arbeitsflaeche: #0b0e14;
  --tinte: #e6eaf1; --tinte-2: #9aa4b5; --tinte-3: #c0c8d4; --linie: #2a3240; --linie-2: #3a4456;
  --akzent: #9db6f2; --akzent-druck: #b9cbf6; --akzent-text: #0e1626; --akzent-wasch: #1e2a44; --akzent-rand: #34487a;
  --erfolg: #7cc8a0; --erfolg-wasch: #15281e;
}
:root[data-theme="dark"][data-palette="aubergine"] {
  --papier: #131019; --flaeche: #1c1724; --flaeche-2: #231d2d; --arbeitsflaeche: #0d0b12;
  --tinte: #ece8f2; --tinte-2: #a69eb3; --tinte-3: #cbc4d6; --linie: #302a3b; --linie-2: #423a50;
  --akzent: #c3a6ec; --akzent-druck: #d5c0f2; --akzent-text: #1d0f33; --akzent-wasch: #2e2142; --akzent-rand: #4d3870;
  --erfolg: #7cc8a0; --erfolg-wasch: #15281e;
}
:root[data-theme="dark"][data-palette="graphit"] {
  --papier: #111214; --flaeche: #1a1b1e; --flaeche-2: #222326; --arbeitsflaeche: #0b0c0d;
  --tinte: #ececea; --tinte-2: #a0a2a6; --tinte-3: #c7c8cb; --linie: #2e3034; --linie-2: #3e4045;
  --akzent: #7fa6f5; --akzent-druck: #a3c0f8; --akzent-text: #0e1626; --akzent-wasch: #1c2a44; --akzent-rand: #2e4a80;
  --haupt: #ececea; --haupt-druck: #ffffff; --haupt-text: #18191b;
  --erfolg: #7cc8a0; --erfolg-wasch: #15281e;
}
:root[data-theme="dark"][data-palette="terrakotta"] {
  --papier: #15110e; --flaeche: #1f1915; --flaeche-2: #282019; --arbeitsflaeche: #0e0b09;
  --tinte: #f1ebe5; --tinte-2: #aba096; --tinte-3: #d2c8be; --linie: #352c25; --linie-2: #4a3d33;
  --akzent: #e99a7c; --akzent-druck: #f0b39b; --akzent-text: #2a0f05; --akzent-wasch: #3a2219; --akzent-rand: #5e3526;
  --erfolg: #8fd19a; --erfolg-wasch: #152a1a; --fehler: #f4a0ae; --fehler-wasch: #3a1a1f;
}

/* ───────────────────────────── Grundlagen ───────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font-family: var(--schrift-text);
  font-size: var(--groesse-text);
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.nur-klein { display: none; }
@media (max-width: 640px) {
  .nur-gross { display: none; }
  .nur-klein { display: inline; }
}
.nur-vorlesen {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ───────────────────────────── Gerüst ───────────────────────────── */

.seite { min-height: 100dvh; display: flex; flex-direction: column; }

.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  min-height: var(--kopf-hoehe);
  padding-block: 10px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px), calc((100% - 1200px) / 2));
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}
.marke {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-right: 4px;
  border-radius: 10px;
  color: var(--tinte);
  text-decoration: none;
}
.marke-zeichen { width: 32px; height: 32px; color: var(--akzent); flex: none; }
.marke-name { font-family: var(--schrift-titel); font-weight: 600; font-size: 1.3125rem; letter-spacing: -0.01em; white-space: nowrap; }
.kopf-rechts { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.datenschutz {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--erfolg-wasch);
  color: var(--erfolg);
  font-size: var(--groesse-klein);
  font-weight: 500;
}
.datenschutz svg { width: 16px; height: 16px; flex: none; }
.kopf-knopf { width: 44px; height: 44px; border-radius: 10px; color: var(--tinte-3); }
.kopf-knopf svg { width: 22px; height: 22px; }
.kopf-knopf[aria-pressed="true"] { background: var(--akzent-wasch); color: var(--akzent); }

.rahmen { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); }
.arbeitsflaeche {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-block: 32px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  min-width: 0;
}
body:not([data-ansicht="werkzeug"]) .leiste,
body:not([data-ansicht="werkzeug"]) .dateileiste,
body:not([data-ansicht="werkzeug"]) .werkzeug-wahl-zeile { display: none; }

/* Mit Datei: Arbeitsfläche über die ganze Breite */
body[data-ansicht="werkzeug"] .kopf { flex-wrap: nowrap; padding-inline: 12px 16px; padding-block: 0; height: var(--kopf-hoehe); }
body[data-ansicht="werkzeug"] .marke-name,
body[data-ansicht="werkzeug"] .datenschutz { display: none; }
body[data-ansicht="werkzeug"] .kopf-rechts { margin-left: 0; padding-left: 8px; border-left: 1px solid var(--linie); }
body[data-ansicht="werkzeug"] .rahmen { grid-template-columns: 92px minmax(0, 1fr); }
body[data-ansicht="werkzeug"] .arbeitsflaeche { max-width: none; margin: 0; padding: 20px 24px 48px; }

/* ─────────────────────── Werkzeugschiene ─────────────────────── */

.leiste {
  position: sticky;
  top: var(--kopf-hoehe);
  align-self: start;
  height: calc(100dvh - var(--kopf-hoehe));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px 16px;
  background: var(--flaeche);
  border-right: 1px solid var(--linie);
  scrollbar-width: thin;
}
.leiste-kopf { display: none; }
.leiste-gruppe { display: flex; flex-direction: column; gap: 2px; }
.leiste-gruppe + .leiste-gruppe { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--linie); }
.leiste { overflow-x: hidden; }
/* Auf der schmalen Schiene trennen Linien die Gruppen; die Titel stehen nur im Blatt (Telefon). */
.leiste-titel {
  display: none;
  padding: 0 4px 2px;
  color: var(--tinte-2);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.reiter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 60px;
  padding: 8px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--tinte-3);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}
.reiter svg { width: 22px; height: 22px; flex: none; stroke-width: 1.6; }
.reiter-text { display: grid; min-width: 0; }
.reiter-name, .reiter-info { display: none; }
.reiter-kurz { hyphens: manual; }
.reiter:hover { background: var(--flaeche-2); color: var(--tinte); }
.reiter[aria-current="true"] { background: var(--akzent-wasch); color: var(--akzent); font-weight: 600; }

.werkzeug-wahl-zeile { display: none; }
.blatt-schleier { display: none; }

/* ─────────────────────── Dateileiste im Kopf ─────────────────────── */

.dateileiste { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.trenner-senkrecht { flex: none; width: 1px; height: 28px; background: var(--linie); }
.dateileiste .datei-name { display: grid; flex: 0 1 auto; min-width: 0; font-weight: 400; }
.dateileiste .datei-titel-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dateileiste .datei-name small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  margin-left: 0;
  color: var(--tinte-2);
  font-size: 0.75rem;
}
.datei-aktionen { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; position: relative; }
.dateileiste .knopf svg { width: 18px; height: 18px; }

.status-pille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--flaeche-2);
  color: var(--tinte-3);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-pille::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.status-pille[data-zustand="offen"] { background: var(--hinweis-wasch); color: var(--hinweis); }
.status-pille[data-zustand="offen"]::before { border: 0; background: var(--hinweis-punkt); }
.status-pille[data-zustand="gespeichert"] { background: var(--erfolg-wasch); color: var(--erfolg); }
.status-pille[data-zustand="gespeichert"]::before { border: 0; background: currentColor; }

.speichern-gruppe { display: flex; }
.speichern-gruppe.mit-mehr #speichern-datei { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.speichern-gruppe .speichern-mehr {
  width: 44px;
  padding: 0;
  border-left: 1px solid color-mix(in srgb, var(--haupt-text) 35%, transparent);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Aufklappmenü (Speichern, Verlauf) */
.menue {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 2px;
  width: min(340px, calc(100vw - 24px));
  padding: 6px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  box-shadow: var(--schatten-gross);
}
.menue-eintrag {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tinte);
  text-align: left;
  cursor: pointer;
}
.menue-eintrag:hover, .menue-eintrag:focus-visible { background: var(--flaeche-2); }
.menue-eintrag svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--akzent); }
.menue-eintrag strong { display: block; font-weight: 600; }
.menue-eintrag small { display: block; color: var(--tinte-2); font-size: var(--groesse-klein); }
.verlauf { padding: 14px; gap: 10px; }
.verlauf h2 { font-family: var(--schrift-text); font-size: 1rem; font-weight: 600; }
.verlauf-liste { display: grid; margin: 0; padding: 0; list-style: none; }
.verlauf-liste li { display: flex; gap: 12px; padding: 6px 0; }
.verlauf-liste li::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--linie-2);
}
.verlauf-liste li.schritt::before { background: var(--akzent); }
.verlauf-liste li.offen::before { background: var(--hinweis-punkt); }
.verlauf-liste li.offen small { color: var(--hinweis); }
.verlauf-liste span { display: grid; }
.verlauf-liste small { color: var(--tinte-2); font-size: var(--groesse-klein); }
.verlauf > p { padding-top: 10px; border-top: 1px solid var(--linie); color: var(--tinte-2); font-size: var(--groesse-klein); }

/* ─────────────────────────── Panels ─────────────────────────── */

.panel { display: grid; gap: 18px; min-width: 0; }
.panel-kopf { display: grid; gap: 4px; max-width: 72ch; }
.panel-kopf h2 { font-family: var(--schrift-titel); font-weight: 600; font-size: 1.625rem; line-height: 1.2; }
.panel-kopf p { color: var(--tinte-2); }
.inhalt { display: grid; gap: 16px; min-width: 0; }

/* Ablage für Dateien */
.ablage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 88px;
  padding: 18px;
  border: 2px dashed var(--linie-2);
  border-radius: 12px;
  background: var(--flaeche-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ablage:hover, .ablage.ueber { border-color: var(--akzent); background: var(--akzent-wasch); }
.ablage:focus-within { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ablage input[type="file"], label.knopf input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.ablage-text { color: var(--tinte-2); }
.ablage-text strong { color: var(--tinte); font-weight: 600; }
.link { color: var(--akzent); text-decoration: underline; text-underline-offset: 3px; }
.leer { display: grid; gap: 12px; justify-items: start; }
.leer .ablage { width: 100%; min-height: 160px; }

/* ─────────────────────────── Knöpfe ─────────────────────────── */

.knopf {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--linie-2);
  border-radius: 10px;
  background: var(--flaeche);
  color: var(--tinte);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.knopf:hover:not(:disabled) { border-color: var(--akzent); color: var(--akzent); }
.knopf.haupt { background: var(--haupt); border-color: var(--haupt); color: var(--haupt-text); }
.knopf.haupt:hover:not(:disabled) { background: var(--haupt-druck); border-color: var(--haupt-druck); color: var(--haupt-text); }
.knopf.leise { background: transparent; border-color: transparent; color: var(--akzent); }
.knopf.leise:hover:not(:disabled) { background: var(--akzent-wasch); border-color: transparent; }
.knopf.klein { min-height: 36px; padding: 4px 12px; font-size: var(--groesse-klein); }
.dateileiste .knopf.klein { min-height: 44px; font-size: var(--groesse-text); }
.knopf.volle-breite { width: 100%; }
.knopf:disabled { opacity: 0.45; cursor: not-allowed; }
.knopf.arbeitet { pointer-events: none; }
.knopf.arbeitet::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: drehen 0.8s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }
.knopf svg { width: 18px; height: 18px; flex: none; }
.knopf.gefahr:hover:not(:disabled) { border-color: var(--fehler); color: var(--fehler); }
.gefahr-text, .knopf.gefahr-text { color: var(--fehler); }
.knopfzeile { display: flex; flex-wrap: wrap; gap: 6px; }

.leiste-aktionen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--linie);
}
.leiste-aktionen .summe, .leiste-aktionen .haken-zeile { margin-right: auto; }
.leiste-aktionen .haken-block { margin-right: auto; display: grid; gap: 4px; }
.summe { color: var(--tinte-2); font-size: var(--groesse-klein); }

.symbol-knopf {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--tinte-2);
  cursor: pointer;
}
.symbol-knopf svg { width: 18px; height: 18px; }
.symbol-knopf:hover:not(:disabled) { background: var(--flaeche-2); color: var(--akzent); }
.symbol-knopf.gefahr:hover:not(:disabled) { color: var(--fehler); }
.symbol-knopf:disabled { opacity: 0.3; cursor: default; }
.kopf-knopf.symbol-knopf { width: 44px; height: 44px; }
.kopf-knopf.symbol-knopf svg { width: 22px; height: 22px; }
@media (pointer: coarse) { .symbol-knopf { width: 44px; height: 44px; } }

.plakette {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--akzent-wasch);
  color: var(--akzent);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* ─────────────────────── Dateiliste, Seitenraster ─────────────────────── */

.dateiliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.datei {
  display: grid;
  grid-template-columns: 28px 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
}
.datei-nr { text-align: center; color: var(--tinte-2); font-variant-numeric: tabular-nums; font-size: var(--groesse-klein); }
.miniatur {
  display: grid;
  place-items: center;
  width: 52px;
  height: 66px;
  background: var(--flaeche-2);
  border-radius: 4px;
  overflow: hidden;
}
.miniatur canvas { display: block; max-width: 100%; max-height: 100%; box-shadow: 0 0 0 1px var(--linie); background: #fff; }
.datei-info { display: grid; min-width: 0; }
.datei-titel { display: flex; align-items: center; min-width: 0; font-weight: 500; }
.datei-titel-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datei-titel .plakette { flex: none; }
.datei-meta { color: var(--tinte-2); font-size: var(--groesse-klein); }
.datei-knoepfe { display: flex; gap: 2px; }
.datei.aktuell { border-color: var(--akzent); }
.datei-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.datei-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.datei-name small { font-weight: 400; color: var(--tinte-2); font-size: var(--groesse-klein); margin-left: 8px; }

.auswahl-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.auswahl-zeile label { font-weight: 500; }
.auswahl-zeile .feld { flex: 1 1 180px; max-width: 280px; }
.seitenraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
.seiten-kachel {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px 8px 8px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--flaeche);
  box-shadow: 0 0 0 1px var(--linie);
  cursor: pointer;
  color: var(--tinte-2);
  font-variant-numeric: tabular-nums;
  font-size: var(--groesse-klein);
}
.seiten-kachel:hover { box-shadow: 0 0 0 1px var(--linie-2), var(--schatten); }
.seiten-kachel canvas { display: block; background: #fff; box-shadow: 0 1px 3px rgb(20 30 50 / 0.18); }
.kachel-bild { display: grid; place-items: center; width: 112px; height: 112px; }
.kachel-bild > * { transform: rotate(var(--drehung, 0deg)); transition: transform 0.2s; }
.leere-seite {
  display: grid;
  place-items: center;
  width: 70px;
  height: 99px;
  background: #fff;
  box-shadow: 0 1px 3px rgb(20 30 50 / 0.18);
  color: #6b7280;
  font-size: 0.75rem;
}
.kachel-herkunft { font-size: 0.6875rem; color: var(--tinte-2); font-weight: 400; }
.seiten-kachel.ziel { outline: 2px dashed var(--akzent); outline-offset: 2px; }
.seiten-kachel[aria-pressed="true"] { border-color: var(--akzent); background: var(--akzent-wasch); box-shadow: none; color: var(--akzent); font-weight: 600; }
.seiten-kachel[aria-pressed="true"] .kachel-nr::before { content: "✓ "; }

/* ─────────────────────────── Felder ─────────────────────────── */

.feld {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--linie-2);
  border-radius: 10px;
  background: var(--flaeche);
  color: var(--tinte);
  width: 100%;
}
textarea.feld { min-height: 96px; resize: vertical; }
.feld:focus { outline: 2px solid var(--akzent); outline-offset: 0; border-color: transparent; }
.feld-beschriftung { display: flex; justify-content: space-between; gap: 8px; font-weight: 500; }
.feld-beschriftung output { color: var(--tinte-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.haken-zeile { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.haken-zeile input { width: 20px; height: 20px; margin: 0; accent-color: var(--akzent); }
input[type="range"] { width: 100%; accent-color: var(--akzent); }

.zweispaltig { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.felder { display: grid; gap: 14px; align-content: start; }
.feld-gruppe { display: grid; gap: 6px; }
.feld-gruppe > label { font-weight: 500; }
.feld-gruppe .technisch { color: var(--tinte-2); font-size: 0.75rem; font-weight: 400; margin-left: 6px; }
.feld-optionen { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--linie); border-radius: 10px; }
.kein-feld { padding: 16px; border-radius: var(--radius); background: var(--flaeche-2); color: var(--tinte-2); }

/* Schalter (role=switch) */
.schalter {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--tinte-2);
  cursor: pointer;
  transition: background 0.15s;
}
.schalter::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  transition: left 0.15s;
}
.schalter[aria-checked="true"] { background: var(--haupt); }
.schalter[aria-checked="true"]::after { left: 24px; background: var(--haupt-text); }

/* ─────────────────────────── Vorschau ─────────────────────────── */

.vorschau-spalte { display: grid; gap: 10px; min-width: 0; }
.leinwand {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: start;
  overflow: auto;
  max-height: 74vh;
  padding: 16px;
  border-radius: 12px;
  background: var(--arbeitsflaeche);
}
.leinwand.gross { max-height: none; }
.leinwand canvas { display: block; background: #fff; box-shadow: 0 1px 3px rgb(20 30 50 / 0.2), 0 10px 30px rgb(20 30 50 / 0.1); }
.blaettern { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; color: var(--tinte-2); font-size: var(--groesse-klein); }
.blaettern .seite-zahl { min-width: 7.5em; text-align: center; color: var(--tinte); }
.blaettern .symbol-knopf { width: 40px; height: 40px; }
.werkzeugzeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  min-height: 48px;
  padding: 4px 6px 4px 4px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
}
.zoom { display: inline-flex; align-items: center; gap: 8px; font-size: var(--groesse-klein); color: var(--tinte-2); }
.werkzeugzeile .zoom { margin-left: auto; }
.zoom .feld { width: auto; min-height: 36px; padding: 4px 8px; }

/* Bausteine für Einstellungen */
.block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-gross);
  background: var(--flaeche);
}
.block-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.block h3 { font-size: var(--groesse-h3); font-weight: 600; }
.zeichenfeld {
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 220;
  max-width: 100%;
  border: 1px solid var(--linie-2);
  border-radius: 10px;
  background:
    linear-gradient(to top, transparent 27%, #d8dee6 27%, #d8dee6 calc(27% + 1px), transparent calc(27% + 1px)),
    #fff;
  touch-action: none;
  cursor: crosshair;
}
.hinweis { color: var(--tinte-2); font-size: var(--groesse-klein); }

.datei-aktionen-alt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.feld.klein { width: auto; min-height: 36px; padding: 4px 8px; font-size: var(--groesse-klein); }
.zeile-klein { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.foto-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.kein-feld .zeile-klein { margin-top: 10px; }

/* Umschalter (wie Optionsfelder) */
.umschalter {
  display: inline-flex;
  flex-wrap: wrap;
  justify-self: start;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche-2);
}
.umschalter-knopf {
  min-height: 38px;
  padding: 4px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--tinte-2);
  font-size: var(--groesse-klein);
  font-weight: 500;
  cursor: pointer;
}
.umschalter-knopf[aria-checked="true"] { background: var(--flaeche); color: var(--akzent); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.14); }

/* ─────────────────── Werkzeugleiste des Seiteneditors ─────────────────── */

.werkzeugleiste {
  position: sticky;
  top: calc(var(--kopf-hoehe) + 8px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  justify-self: center;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--linie);
  border-radius: 14px;
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.werkzeug {
  display: inline-flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 64px;
  min-height: 54px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--tinte-3);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}
.werkzeug svg { width: 20px; height: 20px; }
.werkzeug:hover { background: var(--flaeche-2); }
.werkzeug[aria-pressed="true"] { background: var(--akzent-wasch); border-color: var(--akzent-rand); color: var(--akzent); font-weight: 600; }
.rueck-knopf { flex: none; align-self: center; margin-left: 4px; }
.werkzeug-hinweis {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: -6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--tinte-3);
  font-size: var(--groesse-klein);
  text-align: center;
}
.werkzeug-hinweis svg { width: 16px; height: 16px; flex: none; color: var(--akzent); }

/* Seiteneditor */
.editor-raster { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.editor-huelle { display: grid; gap: 10px; min-width: 0; }
/* Blättern und Größe als Statusleiste unter der Seite – oben bleibt Platz für die Seite */
.editor-huelle > .werkzeugzeile { order: 2; }
.editor-leinwand { max-height: calc(100dvh - var(--kopf-hoehe) - 190px); min-height: 420px; }
.editor-leinwand:focus-visible { outline-offset: -2px; }
.buehne { position: relative; }
.ebene { position: absolute; inset: 0; touch-action: pan-x pan-y pinch-zoom; }
.ebene[data-modus="tippen"] { cursor: crosshair; }
.ebene[data-modus="ziehen"] { cursor: crosshair; touch-action: none; }
.el { position: absolute; cursor: move; touch-action: none; }
.el:hover { outline: 1px dashed var(--auswahl); outline-offset: 2px; }
.el.gewaehlt { outline: 1.5px solid var(--auswahl); outline-offset: 2px; }
.el-text .el-inhalt {
  margin: 0;
  padding: 0;
  font-family: Arial, "Liberation Sans", Helvetica, sans-serif;
  white-space: pre;
  outline: none;
  min-width: 2px;
}
.el-text.tippen { cursor: text; outline-style: dashed; }
.el-text.tippen .el-inhalt { caret-color: var(--auswahl); }
.el-symbol svg, .el-bild img { display: block; width: 100%; height: 100%; pointer-events: none; }
.el-marker { mix-blend-mode: multiply; }
.el-notiz {
  border: 1px solid #9e780f;
  border-radius: 2px;
  background:
    linear-gradient(#73540a, #73540a) 20% 32% / 60% 1.5px no-repeat,
    linear-gradient(#73540a, #73540a) 20% 52% / 60% 1.5px no-repeat,
    linear-gradient(#73540a, #73540a) 20% 72% / 40% 1.5px no-repeat,
    #ffdb59;
}
.el-balken { background: #000; }
.el-feld { border: 1.5px solid #3b6fd8; border-radius: 2px; background: rgb(59 111 216 / 0.13); }
.el-feld .feld-name {
  position: absolute;
  left: 3px;
  top: 50%;
  max-width: calc(100% - 6px);
  overflow: hidden;
  transform: translateY(-50%);
  color: #1d3c7a;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.1;
  pointer-events: none;
}
.el-feld[data-typ="mehrzeilig"] .feld-name { top: 3px; transform: none; }
.el-feld[data-typ="haken"] .feld-name { display: none; }
/* Zum Ausfüllen senden: Datum wie Text, Unterschrift gestrichelt mit Stift */
.el-feld[data-typ="unterschrift"] {
  border-style: dashed;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d3c7a' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M3.5 15.5c2.4-5 3.8-6 4.4-3.6.6 2.6 1.6 3 3.6-.4 1.4-2.3 2.6-2.4 3.4.2.5 1.6 1.4 1.8 3.1.4'/%3E%3Cpath d='M3.5 19.5h17'/%3E%3C/svg%3E") right 3px center / auto 70% no-repeat,
    rgb(59 111 216 / 0.13);
}
.el-feld[data-typ="unterschrift"] .feld-name { max-width: calc(100% - 30px); }
/* Anfasser zum Vergrößern: kleiner Punkt außerhalb der Ecke, damit er nichts
   verdeckt; die Trefferfläche ist unsichtbar größer (wichtig für Finger). */
.griff {
  position: absolute;
  right: -13px;
  bottom: -13px;
  display: none;
  width: 10px;
  height: 10px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: var(--auswahl);
  box-shadow: 0 0 0 1px rgb(20 30 50 / 0.35);
  cursor: nwse-resize;
  touch-action: none;
}
.griff::after { content: ""; position: absolute; inset: -9px; }
.el.gewaehlt .griff { display: block; }
.aufziehen { position: absolute; border: 1.5px dashed var(--auswahl); background: color-mix(in srgb, var(--auswahl) 10%, transparent); pointer-events: none; }
@media (pointer: coarse) {
  .griff { right: -17px; bottom: -17px; width: 13px; height: 13px; }
  .griff::after { inset: -13px; }
}

/* Einstellungen neben dem Editor */
.seitenkasten, .kontext { display: grid; gap: 14px; min-width: 0; }
.editor-raster > .seitenkasten {
  position: sticky;
  top: calc(var(--kopf-hoehe) + 16px);
  max-height: calc(100dvh - var(--kopf-hoehe) - 32px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-gross);
  background: var(--flaeche);
}
.seitenkasten .block { padding: 0; border: 0; background: transparent; }
/* Trennlinie nur zwischen sichtbaren Kästen (verborgene stehen dazwischen im DOM) */
.seitenkasten .block:not([hidden]) ~ .block:not([hidden]),
.seitenkasten .eigenschaften:not([hidden]) { padding-top: 14px; border-top: 1px solid var(--linie); }
.einstellung-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.einstellung-zeile .feld { flex: 1 1 140px; width: auto; }
.farbwahl { display: inline-flex; gap: 6px; }
.farbe {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid var(--flaeche);
  border-radius: 50%;
  background: var(--farbe);
  box-shadow: 0 0 0 1px var(--linie);
  cursor: pointer;
}
.farbe[aria-checked="true"] { box-shadow: 0 0 0 2px var(--akzent); }
@media (pointer: coarse) { .farbe { width: 40px; height: 40px; } }
.baustein-liste { display: grid; gap: 4px; }
.baustein { display: flex; align-items: center; gap: 2px; }
.baustein-wahl {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 5px 12px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.baustein-wahl[aria-checked="true"] { border-color: var(--akzent); background: var(--akzent-wasch); color: var(--akzent); font-weight: 600; }
.stempel-vorschau {
  justify-self: start;
  max-width: 100%;
  max-height: 120px;
  padding: 6px;
  border: 1px solid var(--linie);
  border-radius: 6px;
  background: #fff;
}

/* Fortschritt, Ergebnisse */
.fortschritt-huelle { display: grid; gap: 6px; }
.fortschritt { height: 8px; overflow: hidden; border: 1px solid var(--linie); border-radius: 999px; background: var(--flaeche-2); }
.fortschritt-balken { width: 0; height: 100%; background: var(--akzent); transition: width 0.2s; }
.ergebnis { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche-2); }
.ergebnis h3 { font-size: var(--groesse-h3); font-weight: 600; }
.ergebnis-text { min-height: 220px; white-space: pre-wrap; }
.meta-liste, .bericht-liste { margin: 0; padding-left: 18px; }
.meta-liste { color: var(--tinte-2); font-size: var(--groesse-klein); }
.meta-liste strong { color: var(--tinte); font-weight: 500; overflow-wrap: anywhere; }
.feld-paar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.feld.passwort { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.0625rem; letter-spacing: 0.03em; }
.feld[aria-invalid="true"] { border-color: var(--fehler); }
.passwort-merken code {
  padding: 2px 6px;
  border: 1px solid var(--linie);
  border-radius: 4px;
  background: var(--flaeche);
  font-size: 1rem;
}

/* ─────────────────────────── Dialoge ─────────────────────────── */

.dialog-huelle {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(8 14 14 / 0.5);
}
.dialog {
  display: grid;
  gap: 12px;
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 16px;
  background: var(--flaeche);
  box-shadow: var(--schatten-gross);
}
.dialog h2 { font-family: var(--schrift-titel); font-size: var(--groesse-h2); font-weight: 600; }
.dialog h3 { margin-top: 6px; font-size: 1rem; font-weight: 600; }
.dialog.breit { width: min(640px, 100%); }
.dialog-knoepfe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dialog-aktionen { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.fehlertext { color: var(--fehler); font-size: var(--groesse-klein); }
.link-knopf { padding-inline: 4px; color: var(--akzent); text-decoration: underline; text-underline-offset: 3px; }
.wh-code {
  padding: 12px;
  border: 1px dashed var(--akzent);
  border-radius: 8px;
  background: var(--akzent-wasch);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-align: center;
  word-break: break-word;
  user-select: all;
}

/* ─────────────────────────── Startansicht ─────────────────────────── */

.start-normal { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.start-haupt { display: grid; gap: 28px; min-width: 0; }
.start-seite { display: grid; gap: 16px; min-width: 0; }
.start-kopf { display: grid; gap: 8px; }
.start-kopf h1 {
  font-family: var(--schrift-titel);
  font-weight: 600;
  font-size: var(--groesse-h1);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.start-kopf p { max-width: 60ch; color: var(--tinte-2); font-size: 1.0625rem; }
.start-hinweis {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--akzent-wasch);
  color: var(--akzent);
  font-weight: 600;
}
#zurueck-start { justify-self: start; }
.start-karte {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--linie);
  border-radius: 16px;
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.start-ablage { min-height: 220px; padding: 32px 24px; }
.ablage-symbol {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--akzent-wasch);
  color: var(--akzent);
}
.ablage-symbol svg { width: 34px; height: 34px; stroke-width: 1.5; }
.ablage-text { display: grid; gap: 4px; }
.ablage-text strong { font-size: 1.25rem; }
.ablage-zusatz { display: block; font-size: var(--groesse-text); }
.ablage-knopf { min-height: 48px; padding-inline: 22px; margin-top: 4px; pointer-events: none; }
.start-unten { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; padding: 6px 8px 8px; color: var(--tinte-2); font-size: var(--groesse-klein); }
.scan-start { min-height: 48px; }
.beispiele { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 4px; color: var(--tinte-2); font-size: var(--groesse-klein); }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 3px 14px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--akzent);
  font-size: var(--groesse-klein);
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { border-color: var(--akzent); }
.chip[aria-pressed="true"] { border-color: var(--haupt); background: var(--haupt); color: var(--haupt-text); }
.meine-ordner .chip { color: var(--tinte-2); font-weight: 500; }
.meine-ordner .chip[aria-pressed="true"] { color: var(--haupt-text); }

.aufgaben { display: grid; gap: 14px; }
.aufgaben-kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.aufgaben-kopf h2 { font-size: 1.125rem; font-weight: 600; }
.aufgaben-kopf p { color: var(--tinte-2); font-size: var(--groesse-klein); }
.aufgaben-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.aufgabe {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: 76px;
  padding: 16px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--tinte);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.aufgabe:hover { border-color: var(--akzent); box-shadow: var(--schatten); }
.aufgabe-symbol {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--akzent-wasch);
  color: var(--akzent);
}
.aufgabe-symbol svg { width: 22px; height: 22px; }
.aufgabe-text { display: grid; gap: 2px; min-width: 0; }
.aufgabe-text strong { font-weight: 600; }
.aufgabe-text small { color: var(--tinte-2); font-size: var(--groesse-klein); }
.aufgaben-mehr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; color: var(--tinte-2); font-size: var(--groesse-klein); }
.aufgaben-mehr .knopf.leise { min-height: 36px; padding: 2px 8px; font-size: var(--groesse-klein); }

.zuletzt-liste { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.zuletzt-eintrag { display: flex; align-items: center; gap: 2px; }
.zuletzt-oeffnen {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--tinte);
  text-align: left;
  cursor: pointer;
}
.zuletzt-oeffnen:hover { background: var(--flaeche-2); }
.zuletzt-oeffnen::before {
  content: "";
  flex: none;
  width: 30px;
  height: 40px;
  border: 1px solid var(--linie);
  border-radius: 3px;
  background:
    linear-gradient(var(--linie-2), var(--linie-2)) 5px 7px / 55% 3px no-repeat,
    linear-gradient(var(--linie), var(--linie)) 5px 14px / 70% 2px no-repeat,
    linear-gradient(var(--linie), var(--linie)) 5px 19px / 70% 2px no-repeat,
    linear-gradient(var(--linie), var(--linie)) 5px 24px / 45% 2px no-repeat,
    #fff;
}
.zuletzt-oeffnen > span { display: grid; min-width: 0; }
.zuletzt-oeffnen .datei-titel-text { font-weight: 500; }
.zuletzt-oeffnen small { color: var(--tinte-2); font-size: var(--groesse-klein); }
.zuletzt-oeffnen .bald-weg { color: var(--hinweis); font-weight: 600; }
.zuletzt .haken-zeile { font-weight: 500; }
.start-seite .block > .hinweis { font-size: var(--groesse-klein); }

/* Konto und „Meine Dokumente“ */
.konto-knopf { gap: 8px; max-width: 260px; min-height: 44px; font-size: var(--groesse-text); }
.konto-knopf svg { width: 18px; height: 18px; flex: none; }
.konto-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meine .block-kopf { flex-wrap: wrap; }
.meine .block-kopf h3 { white-space: nowrap; }
.meine-werkzeuge { display: grid; gap: 8px; }
.meine-ordner { display: flex; flex-wrap: wrap; gap: 6px; }
.belegung { display: grid; gap: 4px; }
.belegung-balken { display: block; height: 6px; border-radius: 3px; background: var(--flaeche-2); overflow: hidden; }
.belegung-balken > span { display: block; height: 100%; background: var(--akzent); }
.verwaltung-liste { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.verwaltung-liste li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--linie); }
.verwaltung-text { display: grid; min-width: 0; }
.verwaltung-text strong { overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.verwaltung-text small { color: var(--tinte-2); font-size: var(--groesse-klein); }

/* ─────────────────────────── Einstellungen ─────────────────────────── */

.einstellungen { display: grid; gap: 20px; max-width: 920px; }
.einstellungen-kopf { display: grid; gap: 6px; }
.einstellungen-kopf h1 { font-family: var(--schrift-titel); font-weight: 600; font-size: var(--groesse-h1); line-height: 1.1; letter-spacing: -0.015em; }
.einstellungen-kopf p { color: var(--tinte-2); font-size: 1.0625rem; }
.einstellungen-zurueck { justify-self: start; margin-left: -10px; }
.karte {
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--linie);
  border-radius: 16px;
  background: var(--flaeche);
}
.karte-kopf { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.karte-kopf h2 { font-size: 1.25rem; font-weight: 600; }
.karte-kopf p { color: var(--tinte-2); font-size: 0.875rem; }
.einstellung { display: grid; gap: 10px; }
.einstellung > .titel { font-weight: 600; }
.paletten { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.palette-karte {
  display: grid;
  gap: 8px;
  padding: 8px 8px 12px;
  border: 2px solid var(--linie);
  border-radius: 14px;
  background: var(--flaeche);
  color: var(--tinte);
  text-align: left;
  cursor: pointer;
}
.palette-karte:hover { border-color: var(--linie-2); }
.palette-karte[aria-checked="true"] { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-wasch); }
.palette-muster {
  position: relative;
  display: grid;
  align-content: space-between;
  height: 84px;
  padding: 10px;
  border-radius: 10px;
  background: var(--m-grund);
  box-shadow: inset 0 0 0 1px var(--m-linie);
}
.palette-muster::before {
  content: "";
  height: 6px;
  width: 45%;
  border-radius: 3px;
  background: var(--m-tinte);
  box-shadow: 0 10px 0 -1px var(--m-linie);
}
.palette-muster::after {
  content: "";
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--m-haupt) 0 calc(100% - 30px), transparent calc(100% - 30px) calc(100% - 24px), var(--m-wasch) calc(100% - 24px));
}
.palette-karte[aria-checked="true"] .palette-muster > span {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--haupt);
  color: var(--haupt-text);
  box-shadow: 0 0 0 3px var(--flaeche);
}
.palette-muster > span { display: none; }
.palette-muster > span svg { width: 14px; height: 14px; stroke-width: 3; }
.palette-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 0 2px; font-weight: 600; }
.palette-text { padding: 0 2px; color: var(--tinte-2); font-size: var(--groesse-klein); line-height: 1.35; }
.einstellungen .vorschau-streifen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--linie-2);
  border-radius: 12px;
  background: var(--papier);
}
.einstellungen .vorschau-streifen > .titel {
  flex-basis: 100%;
  color: var(--tinte-2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.zeile-einstellung { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--linie); }
.zeile-einstellung:first-of-type { border-top: 0; padding-top: 0; }
.zeile-einstellung > div { flex: 1; display: grid; min-width: 0; }
.zeile-einstellung .titel { font-weight: 600; }
.zeile-einstellung small { color: var(--tinte-2); font-size: 0.875rem; }

/* ─────────────────────────── Scanner ─────────────────────────── */

.scanner { display: grid; gap: 16px; }
.scanner-kopf { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.scanner-kopf > div { flex: 1 1 300px; }
.scanner-inhalt { display: grid; gap: 14px; }
.scan-aufnahme { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.scan-aufnahme .knopf { min-height: 52px; }
.scan-status { padding: 12px 14px; border-radius: 10px; background: var(--akzent-wasch); color: var(--akzent); }
.scan-seiten h3 { font-size: 1rem; font-weight: 600; }
.scan-leiste { display: flex; gap: 8px; margin: 0; padding: 0 0 6px; overflow-x: auto; list-style: none; }
.scan-mini {
  display: grid;
  gap: 2px;
  width: 92px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--flaeche);
  color: var(--tinte);
  box-shadow: 0 0 0 1px var(--linie);
  font-size: var(--groesse-klein);
  cursor: pointer;
}
.scan-mini img { width: 100%; height: 76px; object-fit: contain; }
.scan-mini small { color: var(--tinte-2); }
.scan-mini.retake small { color: var(--fehler); }
.scan-mini[aria-pressed="true"] { border-color: var(--akzent); background: var(--akzent-wasch); box-shadow: none; }
.scan-rahmen { padding: 50px; overflow: hidden; border-radius: 16px; background: #262c37; }
.scan-buehne { position: relative; width: 100%; margin: 0 auto; }
.scan-buehne img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.scan-ueberlagerung { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.scan-griff {
  position: absolute;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  padding: 0;
  border: 2px solid var(--auswahl);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.94);
  color: var(--auswahl);
  touch-action: none;
  cursor: grab;
}
.scan-griff svg { width: 16px; height: 16px; }
.scan-griff:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (pointer: coarse) { .scan-griff { width: 44px; height: 44px; margin: -22px 0 0 -22px; } }
.scan-titel { font-size: 1.1rem; font-weight: 600; }
.scan-qualitaet { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--linie); border-radius: 12px; }
.scan-qualitaet.good { border-color: color-mix(in srgb, var(--erfolg) 40%, var(--linie)); background: var(--erfolg-wasch); }
.scan-qualitaet.review { border-color: color-mix(in srgb, var(--hinweis-punkt) 45%, var(--linie)); background: var(--hinweis-wasch); }
.scan-qualitaet.retake { border-color: color-mix(in srgb, var(--fehler) 45%, var(--linie)); background: var(--fehler-wasch); }
.scan-qualitaet-kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.scan-qualitaet h3 { font-size: 1rem; font-weight: 600; }
.scan-punkte { font-variant-numeric: tabular-nums; font-size: 1.1rem; font-weight: 600; }
.scan-qualitaet dl { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; font-size: var(--groesse-klein); }
.scan-qualitaet dt { color: var(--tinte-2); }
.scan-qualitaet dd { margin: 0; font-weight: 500; }
.scan-qualitaet ul { margin: 0; padding-left: 20px; font-size: var(--groesse-klein); }
.scan-vorschau { padding: 10px; border-radius: 12px; background: var(--arbeitsflaeche); }
.scan-vorschau img { display: block; max-width: 100%; max-height: 60dvh; margin: 0 auto; object-fit: contain; box-shadow: var(--schatten); }
.scan-fertig { display: grid; gap: 8px; }
.scan-fertig .knopf { min-height: 52px; }
.warnung { color: var(--fehler); }
@media (pointer: coarse) { .scan-rahmen { padding: 54px; } }

/* Startansicht: „Versendet“ */
.versendet .block-kopf { flex-wrap: wrap; }
.versendet-eintrag { flex-wrap: wrap; }
.versendet-eintrag { gap: 4px 6px; padding: 4px 0 8px; border-bottom: 1px solid var(--linie); }
.versendet-eintrag:last-child { border-bottom: 0; }
.versendet-text {
  display: grid;
  flex: 1 1 220px;
  min-width: 0;
  padding: 6px 10px;
}
.versendet-text .datei-titel-text { font-weight: 500; }
.versendet-text small { color: var(--tinte-2); font-size: var(--groesse-klein); }

/* Zum Ausfüllen senden: Feldliste mit Pflicht und Ankreuzgruppen */
.feldliste-senden { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.feldzeile-senden {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--linie);
}
.feldzeile-senden small, .gruppe-senden small { color: var(--tinte-2); font-size: var(--groesse-klein); }
.feldzeile-senden .feldzeile-name { min-width: 0; overflow-wrap: anywhere; }
.feldzeile-senden .pflicht-zeile { margin-left: auto; font-size: var(--groesse-klein); }
.neu {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--akzent-wasch);
  color: var(--akzent);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.gruppe-senden { display: grid; gap: 4px; margin: 6px 0; padding: 8px 10px; border: 1px dashed var(--akzent); border-radius: 8px; background: var(--akzent-wasch); }
.gruppe-mitglieder { margin: 0; padding-left: 18px; color: var(--tinte-2); font-size: var(--groesse-klein); }

/* Empfängerseite (empfang.html): einspaltig, schmal zuerst; Kopf wie die App */
.marke-unter { display: block; color: var(--tinte-2); font-size: var(--groesse-klein); }
.empfang-seite .marke { gap: 12px; }
.empfang-seite .marke > span { display: grid; }
.empfang-seite .datenschutz { margin-left: auto; }
.empfang {
  display: grid;
  gap: 18px;
  width: min(868px, calc(100% - 32px));
  min-width: 0;
  margin: 28px auto 64px;
  padding: 24px;
  border: 1px solid var(--linie);
  border-radius: 16px;
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.empfang .panel-kopf h2 { font-family: var(--schrift-titel); font-weight: 600; font-size: 1.625rem; }
.empfang-zustand { padding: 8px 0; }
.empfang-seiten {
  display: grid;
  gap: 14px;
  justify-items: center;
  min-width: 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--flaeche-2);
}
.empfang-seiten canvas { display: block; background: #fff; box-shadow: 0 1px 3px rgb(20 30 50 / 0.2), 0 6px 18px rgb(20 30 50 / 0.08); }
.empfang-titel, .empfang-seite-titel { font-size: var(--groesse-h3); font-weight: 600; }
.empfang-seite-titel { color: var(--tinte-2); font-size: var(--groesse-klein); text-transform: uppercase; letter-spacing: 0.06em; }
.feld-markierung {
  position: absolute;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 3px;
  border: 1.5px solid #3b6fd8;
  border-radius: 3px;
  background: rgb(59 111 216 / 0.14);
  color: #1d3c7a;
  font-family: Arial, "Liberation Sans", Helvetica, sans-serif;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
}
.feld-markierung.gefuellt { background: rgb(59 111 216 / 0.06); }
.feld-markierung[data-typ="haken"] { justify-content: center; padding: 0; font-weight: 700; }
.feld-markierung[data-typ="unterschrift"] { justify-content: center; border-style: dashed; }
.feld-markierung img { display: block; max-width: 100%; max-height: 100%; }
.feld-markierung.fehlt { border-color: var(--fehler); background: rgb(179 55 47 / 0.16); }
.feld-gruppe.fehlt, .haken-zeile.fehlt { padding: 8px; border-radius: 8px; outline: 1.5px solid var(--fehler); outline-offset: 0; }
.pflicht-stern { margin-left: 3px; color: var(--fehler); font-weight: 600; }
.empfang .felder > label.haken-zeile { justify-self: start; }
.unterschrift-vorschau { max-width: 180px; max-height: 56px; padding: 4px; border: 1px solid var(--linie); border-radius: 6px; background: #fff; }
.unterschrift-dialog { display: grid; gap: 12px; }
.unterschrift-zeichnen { display: grid; gap: 8px; }
.empfang-abschluss {
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding-bottom: 12px;
  background: var(--flaeche);
}
.empfang-abschluss .hinweis { flex: 1 1 260px; }
.empfang-fertig .knopf { justify-self: start; }

/* Meldungen */
.meldung {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--tinte);
  color: var(--papier);
  box-shadow: var(--schatten-gross);
  font-size: var(--groesse-text);
  z-index: 60;
  pointer-events: none; /* verdeckt nichts: Tippen auf die Seite geht durch */
}
.meldung.fehler { background: var(--fehler); color: var(--fehler-text); }

/* ─────────────────────────── Mittlere Breite ─────────────────────────── */

@media (max-width: 1180px) {
  body[data-ansicht="werkzeug"] .knopf-text { display: none; }
  .editor-raster { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 960px) {
  .start-normal { grid-template-columns: minmax(0, 1fr); }
  .editor-raster { grid-template-columns: minmax(0, 1fr); }
  .editor-raster > .seitenkasten { position: static; max-height: none; }
  .zweispaltig { grid-template-columns: minmax(0, 1fr); }
  .empfang { padding: 16px; }
  .empfang-seiten { padding: 8px; }
}

/* ─────────────────────────── Telefon und Tablet hochkant ─────────────────────────── */

@media (max-width: 820px) {
  :root { --kopf-hoehe: 56px; }
  .arbeitsflaeche { padding-top: 20px; }
  body[data-ansicht="werkzeug"] .kopf { gap: 4px; padding-inline: 4px 8px; }
  body[data-ansicht="werkzeug"] .kopf-rechts,
  body[data-ansicht="werkzeug"] #andere-datei,
  body[data-ansicht="werkzeug"] #verlauf-datei,
  body[data-ansicht="werkzeug"] .trenner-senkrecht { display: none; }
  body[data-ansicht="werkzeug"] .marke-zeichen { width: 28px; height: 28px; }
  .dateileiste { gap: 4px; }
  .dateileiste .datei-name small { gap: 0 6px; }
  .dateileiste .datei-name small .datei-meta-text { display: none; }
  .speichern-gruppe .knopf.haupt { padding-inline: 14px; }
  body[data-ansicht="werkzeug"] .rahmen { grid-template-columns: minmax(0, 1fr); }
  body[data-ansicht="werkzeug"] .arbeitsflaeche { padding: 0 12px 120px; }

  /* Werkzeugwahl: Zeile unter dem Kopf, Liste als Blatt von unten */
  body[data-ansicht="werkzeug"] .werkzeug-wahl-zeile {
    position: sticky;
    top: var(--kopf-hoehe);
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 -12px 16px;
    padding: 6px 12px;
    background: var(--flaeche-2);
    border-bottom: 1px solid var(--linie);
  }
  .werkzeug-wahl {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--linie-2);
    border-radius: 999px;
    background: var(--flaeche);
    color: var(--tinte);
    font-weight: 600;
    cursor: pointer;
  }
  .werkzeug-wahl svg { width: 18px; height: 18px; flex: none; }
  .werkzeug-wahl .werkzeug-wahl-symbol { color: var(--akzent); }
  .werkzeug-wahl-info { color: var(--tinte-2); font-size: var(--groesse-klein); font-variant-numeric: tabular-nums; }

  body[data-ansicht="werkzeug"] .leiste {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 41;
    height: auto;
    max-height: 86dvh;
    padding: 8px 8px calc(16px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 30px rgb(0 0 0 / 0.2);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
  }
  body.werkzeuge-offen .leiste { transform: none; visibility: visible; transition: transform 0.22s ease; }
  body.werkzeuge-offen .blatt-schleier { display: block; position: fixed; inset: 0; z-index: 40; border: 0; padding: 0; background: rgb(8 14 14 / 0.45); }
  .leiste-kopf {
    display: grid;
    gap: 6px;
    padding: 0 8px 6px;
  }
  .leiste-kopf::before { content: ""; justify-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--linie-2); }
  .leiste-kopf > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .leiste-kopf h2 { font-family: var(--schrift-titel); font-size: 1.3125rem; font-weight: 600; }
  .leiste-kopf p { color: var(--tinte-2); font-size: var(--groesse-klein); }
  .leiste-titel { display: block; padding: 4px 12px 2px; }
  .leiste-gruppe + .leiste-gruppe { margin-top: 4px; padding-top: 4px; }
  .reiter {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 6px 12px;
    font-size: var(--groesse-text);
    text-align: left;
  }
  .reiter svg { width: 22px; height: 22px; padding: 9px; box-sizing: content-box; border-radius: 10px; background: var(--akzent-wasch); color: var(--akzent); }
  .reiter-kurz { display: none; }
  .reiter-name, .reiter-info { display: block; }
  .reiter-name { font-weight: 600; color: var(--tinte); }
  .reiter-info { font-size: var(--groesse-klein); color: var(--tinte-2); font-weight: 400; }
  .reiter[aria-current="true"] { background: var(--flaeche-2); }

  /* Seiteneditor: Werkzeugleiste unten in Daumennähe */
  body[data-ansicht="werkzeug"] .werkzeugleiste {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 25;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 20px rgb(0 0 0 / 0.12);
    scrollbar-width: none;
  }
  .werkzeugleiste.mehr-rechts { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
  .werkzeugleiste.mehr-links { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
  .werkzeugleiste.mehr-links.mehr-rechts {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  }
  .werkzeug { min-width: 64px; min-height: 56px; }
  .werkzeug-hinweis { margin-top: 0; justify-self: stretch; justify-content: center; border-radius: 12px; }
  body[data-ansicht="werkzeug"] .panel-kopf h2 { font-size: 1.3125rem; }
  body[data-ansicht="werkzeug"] .panel-kopf p { font-size: var(--groesse-klein); }
  /* Meldungen über der Werkzeugleiste am unteren Rand */
  body[data-ansicht="werkzeug"] .meldung { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .editor-leinwand { max-height: none; min-height: 0; padding: 10px; }

  .feld-paar { grid-template-columns: minmax(0, 1fr); }
  .karte { padding: 18px; }
}

@media (max-width: 640px) {
  :root { --groesse-h1: 1.75rem; }
  .kopf { padding-block: 8px; }
  /* Kopf: Marke und Knöpfe in einer Zeile, der Datenschutz-Hinweis darunter */
  body:not([data-ansicht="werkzeug"]) .kopf-rechts { display: contents; }
  body:not([data-ansicht="werkzeug"]) .marke { margin-right: auto; }
  body:not([data-ansicht="werkzeug"]) .datenschutz { order: 3; flex-basis: 100%; justify-content: flex-start; border-radius: 10px; }
  .marke-name { font-size: 1.1875rem; }
  .konto-text { max-width: 9em; }
  .start-haupt { gap: 22px; }
  .start-kopf p { font-size: var(--groesse-text); }
  /* Auf dem Telefon: Scannen vorn, kein „hierher ziehen“ */
  .start-karte { padding: 0; border: 0; background: transparent; box-shadow: none; gap: 10px; }
  .start-unten { order: -1; padding: 0; justify-content: stretch; }
  .start-unten > span { display: none; }
  .scan-start { width: 100%; min-height: 60px; font-size: 1.0625rem; background: var(--haupt); border-color: var(--haupt); color: var(--haupt-text); }
  .scan-start:hover:not(:disabled) { background: var(--haupt-druck); color: var(--haupt-text); }
  .start-ablage { flex-direction: row; justify-content: flex-start; min-height: 56px; padding: 8px 16px; border: 1px solid var(--linie-2); border-radius: 12px; background: var(--flaeche); text-align: left; }
  .start-ablage .ablage-symbol, .start-ablage .ablage-text { display: none; }
  .start-ablage .ablage-knopf { margin: 0; min-height: 40px; padding: 0; border: 0; background: transparent; color: var(--tinte); font-size: 1rem; }
  .aufgaben-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .aufgabe { min-height: 64px; padding: 12px; gap: 10px; align-items: center; }
  .aufgabe-symbol { width: 32px; height: 32px; }
  .aufgabe-text small { display: none; }
  .aufgaben-kopf p { display: none; }
  .datei { grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: auto auto; row-gap: 2px; }
  .datei-nr { display: none; }
  .miniatur { grid-row: 1 / span 2; }
  .datei-knoepfe { grid-column: 2; margin-left: -8px; }
  .leiste-aktionen .knopf { flex: 1 1 100%; }
  .werkzeug { min-width: 60px; padding: 4px 6px; }
  .paletten { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .palette-karte { grid-template-columns: 88px minmax(0, 1fr); align-items: center; column-gap: 12px; padding: 8px; }
  .palette-muster { grid-row: 1 / span 2; height: 56px; padding: 7px; }
  .palette-muster::after { height: 16px; }
  .seitenraster { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .kachel-bild { width: 92px; height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01ms !important; }
}
