/* papr – Gestaltung („Premium“)
   Flächen, Text, Linien, Schatten und Schrift sind für alle Paletten gleich;
   die Paletten unter „Einstellungen“ ändern nur den Akzent (Akzent, Akzent
   weich, Text auf Akzent, Auswahl, Fokus, Flieger): <html data-palette="petrol|tinte|aubergine|graphit">,
   Standard ist Orange (ohne data-palette). Nur Orange hat im Hellen einen
   Hauptknopf in Tinte: Weiß auf dem Orange erreicht 3,6 : 1, das reicht für
   Text nicht. data-theme="light|dark" wählt die Helligkeit (ohne
   data-theme folgt sie dem Gerät). js/thema.js setzt beides vor dem ersten Zeichnen.
   Ansichten: <body data-ansicht="start|werkzeug|einstellungen|ablage">. Ab 768 px
   steht links die Seitenleiste (js/seitenleiste.js), darunter eine Reiterleiste
   unten. Mit Datei: Kopfleiste, Werkzeugschiene (nur Symbole), Inhalt; Editoren
   mit schwebender Werkzeugleiste und Eigenschaften rechts. Unter 820 px wandert
   die Werkzeugwahl in ein Blatt von unten, die Werkzeugleiste an den unteren Rand.
   Schritt 2: Befehlsfenster (Strg K), Seitenvorschau (ab 1200 px), Reiter Werkzeug/Seite/Dokument
   in den Eigenschaften, Zoomleiste mit Prozentmenü, Pfad im Editorkopf – am Ende der Datei.
   Kontraste aller Paletten prüft test/design.cjs (Text ≥ 4,5 : 1, Rand/Fokus ≥ 3 : 1). */

:root {
  /* Grundlage hell */
  --papier: #f6f7f8; /* Grund */
  --seitenflaeche: #fbfbfc; /* Seitenleiste, Kopf im Editor */
  --flaeche: #ffffff;
  --flaeche-2: #f9fafa;
  --erhoeht: #ffffff;
  --hover: #eef0f2;
  --arbeitsflaeche: #eceef0;
  --linie: #e4e7ea;
  --linie-2: #d3d8dd; /* Linie stark */
  --feldrand: #848d98; /* Entwurf #8a939e erreicht auf dem Grund nur 2,9 : 1 */
  --tinte: #0c1117;
  --tinte-2: #4f5b67;
  --tinte-3: #636e7a;
  --erfolg: #157244;
  --erfolg-wasch: #e7f4ec;
  --hinweis: #7a5a00; /* Gelb und Himbeerrot: weit genug weg vom Orange */
  --hinweis-wasch: #fff6d1;
  --hinweis-punkt: #7a5a00;
  --fehler: #be123c;
  --fehler-wasch: #ffe9ed;
  --fehler-text: #ffffff;
  --unterschrift: #1f3f8f;
  --kbd: #f1f3f4;
  --kbd-rand: #d3d8dd;
  --kbd-auf-akzent: rgb(255 255 255 / 0.16); /* Orange: liegt auf dem Hauptknopf in Tinte */
  --punkt: rgb(12 17 23 / 0.07);
  --lichtkante: inset 0 1px 0 rgb(255 255 255 / 0.7);
  --schatten: 0 1px 2px rgb(12 17 23 / 0.04), 0 6px 20px rgb(12 17 23 / 0.05);
  --schatten-gross: 0 1px 2px rgb(12 17 23 / 0.06), 0 10px 30px rgb(12 17 23 / 0.1);
  --schatten-xl: 0 30px 80px rgb(12 17 23 / 0.25);
  --papier-schatten: 0 0 0 1px rgb(0 0 0 / 0.06), 0 20px 50px rgb(0 0 0 / 0.12);
  --schleier: rgb(12 17 23 / 0.45);

  /* Akzent: Orange hell. Das Orange taugt nicht als Textfarbe (3,6 : 1) – Text und
     Symbole in Akzentfarbe nehmen --akzent-ton; Schrift auf dem Orange ist dunkel. */
  --akzent: #ea580c;
  --akzent-text: #2b1406;
  --akzent-wasch: #fff0e6;
  --akzent-ton: #b93c0a; /* Text und Symbole in Akzentfarbe, auch auf „Akzent weich“ */
  --auswahl: #ea580c;
  --fokus-farbe: #ea580c;
  --fokus: rgb(234 88 12 / 0.25);
  /* Flieger im Kopf: drei Töne der Palette */
  --marke-a: #ea580c;
  --marke-b: #fb923c;
  --marke-c: #9a3412;

  /* Daraus abgeleitet (gilt für jede Palette) */
  --akzent-rand: color-mix(in srgb, var(--akzent) 35%, transparent);
  /* Nur Orange hell: Hauptknopf in Tinte; gedrückt wird das Orange heller (dunkle Schrift darauf).
     Die übrigen Paletten und alles Dunkle setzen das unten zurück. */
  --akzent-druck: color-mix(in srgb, var(--akzent) 84%, #ffffff);
  --haupt: #0c1117;
  --haupt-druck: #262d36;
  --haupt-text: #ffffff;
  --glow: 0 1px 2px rgb(12 17 23 / 0.12), 0 6px 16px rgb(12 17 23 / 0.12);

  --schrift-text: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --schrift-titel: var(--schrift-text);
  --schrift-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --groesse-klein: 0.8125rem;
  --groesse-text: 0.875rem;
  --groesse-h3: 0.9375rem;
  --groesse-h2: 1.25rem;
  --groesse-h1: 1.875rem;
  --radius-klein: 8px;
  --radius: 10px;
  --radius-mittel: 12px;
  --radius-gross: 14px;
  --radius-xl: 16px;
  --kopf-hoehe: 60px;
  --seitenleiste-breite: 248px;
  color-scheme: light;
}

/* Paletten – hell: nur der Akzent. Außer Orange ist der Hauptknopf überall der Akzent. */
:root[data-palette] {
  --akzent-druck: color-mix(in srgb, var(--akzent) 84%, var(--tinte));
  --haupt: var(--akzent);
  --haupt-druck: var(--akzent-druck);
  --haupt-text: var(--akzent-text);
  --kbd-auf-akzent: rgb(0 0 0 / 0.18); /* Entwurf: Weiß 18 % – darauf erreicht weißer Text nur 4,1 : 1 */
  --glow: 0 1px 2px color-mix(in srgb, var(--akzent) 25%, transparent), 0 6px 16px color-mix(in srgb, var(--akzent) 18%, transparent);
}
:root[data-palette="petrol"] {
  --akzent: #0b6e78; --akzent-text: #ffffff; --akzent-wasch: #e6f3f4; --akzent-ton: #0a5f68;
  --auswahl: #0b6e78; --fokus-farbe: #0b6e78; --fokus: rgb(11 110 120 / 0.25);
  --marke-a: #0b6e78; --marke-b: #4fd1c7; --marke-c: #074a51;
}
:root[data-palette="tinte"] {
  --akzent: #2447a6; --akzent-text: #ffffff; --akzent-wasch: #e9eefa; --akzent-ton: #1f3d8f;
  --auswahl: #2f6fe0; --fokus-farbe: #2447a6; --fokus: rgb(36 71 166 / 0.25);
  --marke-a: #2447a6; --marke-b: #7c9ae8; --marke-c: #172e6e;
}
:root[data-palette="aubergine"] {
  --akzent: #5e3592; --akzent-text: #ffffff; --akzent-wasch: #f0e9f8; --akzent-ton: #522d80;
  --auswahl: #7b4bc0; --fokus-farbe: #5e3592; --fokus: rgb(94 53 146 / 0.25);
  --marke-a: #5e3592; --marke-b: #a982db; --marke-c: #3d2260;
}
:root[data-palette="graphit"] {
  --akzent: #1b1d21; --akzent-text: #ffffff; --akzent-wasch: #e8eefb; --akzent-ton: #1a4fb4;
  --auswahl: #1d5fd6; --fokus-farbe: #1d5fd6; --fokus: rgb(29 95 214 / 0.25);
  --marke-a: #1b1d21; --marke-b: #8a9099; --marke-c: #4a5059;
}

/* Dunkel: Grundlage (mit Orange) und je Palette – einmal für „wie das Gerät“,
   einmal für die ausdrückliche Wahl. Die Blöcke sind absichtlich gleich.
   Im Dunkeln ist der Hauptknopf in allen Paletten der Akzent mit dunkler Schrift. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #08090b; --seitenflaeche: #0b0d0f; --flaeche: #101215; --flaeche-2: #14171b; --erhoeht: #16191d;
    --hover: #1a1e23; --arbeitsflaeche: #060708; --linie: #22272d; --linie-2: #30363e; --feldrand: #5f6772;
    --tinte: #eef0f2; --tinte-2: #a7afb8; --tinte-3: #858d97;
    --erfolg: #5bd08e; --erfolg-wasch: #10261b; --hinweis: #f2d25c; --hinweis-wasch: #2a250d; --hinweis-punkt: #f2d25c;
    --fehler: #ff8fa3; --fehler-wasch: #2e131a; --fehler-text: #2a0a12; --unterschrift: #9fb7ff;
    --kbd: #1a1e23; --kbd-rand: #2e343b; --kbd-auf-akzent: rgb(4 33 31 / 0.14); --punkt: rgb(255 255 255 / 0.05);
    --lichtkante: inset 0 1px 0 rgb(255 255 255 / 0.04);
    --schatten: inset 0 1px 0 rgb(255 255 255 / 0.035), 0 8px 24px rgb(0 0 0 / 0.35);
    --schatten-gross: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 12px 32px rgb(0 0 0 / 0.55);
    --schatten-xl: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 30px 90px rgb(0 0 0 / 0.7);
    --papier-schatten: 0 0 0 1px rgb(0 0 0 / 0.06), 0 20px 50px rgb(0 0 0 / 0.55);
    --schleier: rgb(3 4 5 / 0.62);
    --glow: 0 0 0 1px color-mix(in srgb, var(--akzent) 35%, transparent), 0 6px 20px color-mix(in srgb, var(--akzent) 18%, transparent);
    --akzent-druck: color-mix(in srgb, var(--akzent) 84%, var(--tinte));
    --haupt: var(--akzent); --haupt-druck: var(--akzent-druck); --haupt-text: var(--akzent-text);
    --akzent: #fb923c; --akzent-text: #2b1406; --akzent-wasch: #2a1a0f; --akzent-ton: #fdba74;
    --auswahl: #ea580c; --fokus-farbe: #fb923c; --fokus: rgb(251 146 60 / 0.3);
    --marke-a: #fb923c; --marke-b: #fdba74; --marke-c: #c2410c;
    color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-palette="petrol"] {
    --akzent: #4fd1c7; --akzent-text: #04211f; --akzent-wasch: #0f2a2b; --akzent-ton: #7be3da;
    --auswahl: #0e8c95; --fokus-farbe: #4fd1c7; --fokus: rgb(79 209 199 / 0.28);
    --marke-a: #4fd1c7; --marke-b: #b4f1ec; --marke-c: #0e8c95;
  }
  :root:not([data-theme="light"])[data-palette="tinte"] {
    --akzent: #9db6f2; --akzent-text: #0e1626; --akzent-wasch: #182340; --akzent-ton: #b9cbf6;
    --auswahl: #2f6fe0; --fokus-farbe: #9db6f2; --fokus: rgb(157 182 242 / 0.3);
    --marke-a: #9db6f2; --marke-b: #cfdcf9; --marke-c: #4b6fd0;
  }
  :root:not([data-theme="light"])[data-palette="aubergine"] {
    --akzent: #c3a6ec; --akzent-text: #1d0f33; --akzent-wasch: #261b38; --akzent-ton: #d5c0f2;
    --auswahl: #7b4bc0; --fokus-farbe: #c3a6ec; --fokus: rgb(195 166 236 / 0.3);
    --marke-a: #c3a6ec; --marke-b: #e3d5f6; --marke-c: #8457c4;
  }
  :root:not([data-theme="light"])[data-palette="graphit"] {
    --akzent: #ececea; --akzent-text: #18191b; --akzent-wasch: #1c2433; --akzent-ton: #a3c0f8;
    --auswahl: #2f6fe0; --fokus-farbe: #7fa6f5; --fokus: rgb(127 166 245 / 0.3);
    --marke-a: #ececea; --marke-b: #ffffff; --marke-c: #9ba1a9;
  }
}
:root[data-theme="dark"] {
  --papier: #08090b; --seitenflaeche: #0b0d0f; --flaeche: #101215; --flaeche-2: #14171b; --erhoeht: #16191d;
  --hover: #1a1e23; --arbeitsflaeche: #060708; --linie: #22272d; --linie-2: #30363e; --feldrand: #5f6772;
  --tinte: #eef0f2; --tinte-2: #a7afb8; --tinte-3: #858d97;
  --erfolg: #5bd08e; --erfolg-wasch: #10261b; --hinweis: #f2d25c; --hinweis-wasch: #2a250d; --hinweis-punkt: #f2d25c;
  --fehler: #ff8fa3; --fehler-wasch: #2e131a; --fehler-text: #2a0a12; --unterschrift: #9fb7ff;
  --kbd: #1a1e23; --kbd-rand: #2e343b; --kbd-auf-akzent: rgb(4 33 31 / 0.14); --punkt: rgb(255 255 255 / 0.05);
  --lichtkante: inset 0 1px 0 rgb(255 255 255 / 0.04);
  --schatten: inset 0 1px 0 rgb(255 255 255 / 0.035), 0 8px 24px rgb(0 0 0 / 0.35);
  --schatten-gross: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 12px 32px rgb(0 0 0 / 0.55);
  --schatten-xl: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 30px 90px rgb(0 0 0 / 0.7);
  --papier-schatten: 0 0 0 1px rgb(0 0 0 / 0.06), 0 20px 50px rgb(0 0 0 / 0.55);
  --schleier: rgb(3 4 5 / 0.62);
  --glow: 0 0 0 1px color-mix(in srgb, var(--akzent) 35%, transparent), 0 6px 20px color-mix(in srgb, var(--akzent) 18%, transparent);
  --akzent-druck: color-mix(in srgb, var(--akzent) 84%, var(--tinte));
  --haupt: var(--akzent); --haupt-druck: var(--akzent-druck); --haupt-text: var(--akzent-text);
  --akzent: #fb923c; --akzent-text: #2b1406; --akzent-wasch: #2a1a0f; --akzent-ton: #fdba74;
  --auswahl: #ea580c; --fokus-farbe: #fb923c; --fokus: rgb(251 146 60 / 0.3);
  --marke-a: #fb923c; --marke-b: #fdba74; --marke-c: #c2410c;
  color-scheme: dark;
}
:root[data-theme="dark"][data-palette="petrol"] {
  --akzent: #4fd1c7; --akzent-text: #04211f; --akzent-wasch: #0f2a2b; --akzent-ton: #7be3da;
  --auswahl: #0e8c95; --fokus-farbe: #4fd1c7; --fokus: rgb(79 209 199 / 0.28);
  --marke-a: #4fd1c7; --marke-b: #b4f1ec; --marke-c: #0e8c95;
}
:root[data-theme="dark"][data-palette="tinte"] {
  --akzent: #9db6f2; --akzent-text: #0e1626; --akzent-wasch: #182340; --akzent-ton: #b9cbf6;
  --auswahl: #2f6fe0; --fokus-farbe: #9db6f2; --fokus: rgb(157 182 242 / 0.3);
  --marke-a: #9db6f2; --marke-b: #cfdcf9; --marke-c: #4b6fd0;
}
:root[data-theme="dark"][data-palette="aubergine"] {
  --akzent: #c3a6ec; --akzent-text: #1d0f33; --akzent-wasch: #261b38; --akzent-ton: #d5c0f2;
  --auswahl: #7b4bc0; --fokus-farbe: #c3a6ec; --fokus: rgb(195 166 236 / 0.3);
  --marke-a: #c3a6ec; --marke-b: #e3d5f6; --marke-c: #8457c4;
}
:root[data-theme="dark"][data-palette="graphit"] {
  --akzent: #ececea; --akzent-text: #18191b; --akzent-wasch: #1c2433; --akzent-ton: #a3c0f8;
  --auswahl: #2f6fe0; --fokus-farbe: #7fa6f5; --fokus: rgb(127 166 245 / 0.3);
  --marke-a: #ececea; --marke-b: #ffffff; --marke-c: #9ba1a9;
}

/* ───────────────────────────── 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;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
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(--fokus-farbe); outline-offset: 2px; }
kbd, .kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--kbd-rand);
  border-radius: 6px;
  background: var(--kbd);
  color: var(--tinte-2);
  font-family: var(--schrift-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.45;
}
.mono { font-family: var(--schrift-mono); font-variant-numeric: tabular-nums; }
.nur-klein { display: none; }
@media (max-width: 767px) {
  .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;
}

/* Status-Markierung (Pille mit Punkt): .pille[data-art="ok|warn|akzent|gefahr|neutral"] */
.pille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--tinte-2);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.pille::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pille[data-art="ok"] { background: var(--erfolg-wasch); color: var(--erfolg); }
.pille[data-art="warn"] { background: var(--hinweis-wasch); color: var(--hinweis); }
.pille[data-art="akzent"] { background: var(--akzent-wasch); color: var(--akzent-ton); }
.pille[data-art="gefahr"] { background: var(--fehler-wasch); color: var(--fehler); }

/* ───────────────────────────── 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 12px;
  min-height: var(--kopf-hoehe);
  padding-block: 10px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px), calc((100% - 1200px) / 2));
  background: var(--seitenflaeche);
  border-bottom: 1px solid var(--linie);
}
.marke {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-right: 4px;
  border-radius: var(--radius);
  color: var(--tinte);
  text-decoration: none;
}
/* Flieger aus drei Flächen in den Tönen der Palette; Wortmarke „papr“ als gezeichneter Pfad
   (Bricolage Grotesque 700, Laufweite −0,035 em), Farbe aus der Tinte. */
.marke-zeichen { flex: none; width: 28px; height: 28px; overflow: visible; }
.mz-a { fill: var(--marke-a); }
.mz-b { fill: var(--marke-b); }
.mz-c { fill: var(--marke-c); }
.marke-name { display: inline-flex; align-items: center; font-size: 1.375rem; line-height: 1; white-space: nowrap; }
.marke-wort { display: block; width: 2.108em; height: 0.707em; fill: currentColor; }
.kopf-titel { color: var(--tinte-2); font-weight: 500; white-space: nowrap; }
.kopf-rechts { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.kopf-knoepfe { display: contents; }
.datenschutz {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--erfolg-wasch);
  color: var(--erfolg);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.datenschutz svg { width: 14px; height: 14px; flex: none; }
.kopf-knopf { width: 40px; height: 40px; border-radius: var(--radius); color: var(--tinte-2); }
.kopf-knopf svg { width: 18px; height: 18px; }
.kopf-knopf[aria-pressed="true"] { background: var(--akzent-wasch); color: var(--akzent-ton); }
#helligkeit-knopf { border-color: var(--linie); background: var(--flaeche); }
.kopf .datei-oeffnen-kopf { min-height: 40px; padding: 0 8px 0 14px; gap: 10px; white-space: nowrap; box-shadow: var(--glow); }
@media (max-width: 900px) {
  .datei-oeffnen-kopf kbd { display: none; }
  .kopf .datei-oeffnen-kopf { padding: 0 14px; }
}
.datei-oeffnen-kopf kbd { border: 0; background: var(--kbd-auf-akzent); color: inherit; }

/* App (index.html): Kopf mit fester Höhe; auf den Seiten mit Seitenleiste steht
   die Marke als oberes Feld der Leiste. */
body[data-ansicht] .kopf {
  flex-wrap: nowrap;
  height: var(--kopf-hoehe);
  padding: 0 max(24px, env(safe-area-inset-right, 0px)) 0 0;
  background: var(--papier);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--linie);
}
body[data-ansicht] .marke {
  align-self: stretch;
  flex: none;
  width: var(--seitenleiste-breite);
  padding: 0 18px;
  border-radius: 0;
  background: var(--seitenflaeche);
  border-right: 1px solid var(--linie);
}
body[data-ansicht] .marke:focus-visible { outline-offset: -3px; }
body[data-ansicht] .kopf-titel { margin-left: 20px; }

.rahmen { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); }
body[data-ansicht]:not([data-ansicht="werkzeug"]) .rahmen { grid-template-columns: var(--seitenleiste-breite) minmax(0, 1fr); }
.arbeitsflaeche {
  width: 100%;
  max-width: 1136px;
  padding-block: 36px 48px;
  padding-left: max(40px, env(safe-area-inset-left, 0px));
  padding-right: max(40px, 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; }
body[data-ansicht="werkzeug"] .seitenleiste,
body[data-ansicht="werkzeug"] .reiterleiste,
body[data-ansicht="werkzeug"] .kopf-titel,
body[data-ansicht="werkzeug"] .datei-oeffnen-kopf { display: none; }

/* Mit Datei: Kopf über die ganze Breite, Arbeitsfläche ohne Rand */
body[data-ansicht="werkzeug"] { --kopf-hoehe: 56px; }
body[data-ansicht="werkzeug"] .kopf { gap: 10px; padding-inline: 10px 14px; background: var(--seitenflaeche); }
body[data-ansicht="werkzeug"] .marke { width: auto; min-width: 36px; justify-content: center; padding: 0; background: none; border: 0; align-self: center; border-radius: 9px; }
body[data-ansicht="werkzeug"] .marke:focus-visible { outline-offset: 2px; }
body[data-ansicht="werkzeug"] .kopf .marke-name,
body[data-ansicht="werkzeug"] .datenschutz { display: none; }
body[data-ansicht="werkzeug"] .kopf-rechts { margin-left: 0; gap: 2px; padding-left: 8px; border-left: 1px solid var(--linie); }
body[data-ansicht="werkzeug"] #helligkeit-knopf { border-color: transparent; background: transparent; }
body[data-ansicht="werkzeug"] .kopf-knopf { width: 36px; height: 36px; border-radius: 9px; }
body[data-ansicht="werkzeug"] .rahmen { grid-template-columns: 60px minmax(0, 1fr); }
body[data-ansicht="werkzeug"] .arbeitsflaeche { max-width: none; margin: 0; padding: 0; }
body[data-ansicht="werkzeug"] .arbeitsflaeche > .panel:not(.editor-panel) { padding: 24px 28px 48px; }

/* ─────────────────────── Seitenleiste und Reiterleiste ─────────────────────── */

.seitenleiste {
  position: sticky;
  top: var(--kopf-hoehe);
  z-index: 5;
  align-self: start;
  height: calc(100dvh - var(--kopf-hoehe));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 6px 12px 16px;
  background: var(--seitenflaeche);
  border-right: 1px solid var(--linie);
  scrollbar-width: thin;
}
.seitenleiste-kopf { display: none; }
.seitenleiste-suche {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--tinte-3);
  font-size: 0.78125rem;
  text-align: left;
  box-shadow: var(--lichtkante);
  cursor: pointer;
}
.seitenleiste-suche:hover { border-color: var(--linie-2); color: var(--tinte-2); }
.seitenleiste-suche svg { width: 16px; height: 16px; flex: none; }
.seitenleiste-suche kbd { flex: none; padding-inline: 4px; }
.seitenleiste-suche-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-liste { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-liste > li:empty { display: none; }
.nav-eintrag, .seitenleiste .nav-knopf, .seitenleiste-werkzeug {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: auto;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-klein);
  background: transparent;
  color: var(--tinte-2);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav-eintrag svg, .seitenleiste .nav-knopf svg, .seitenleiste-werkzeug svg { flex: none; width: 18px; height: 18px; }
.nav-eintrag:hover, .seitenleiste .nav-knopf:hover:not(:disabled), .seitenleiste-werkzeug:hover { background: var(--hover); color: var(--tinte); }
.nav-eintrag[aria-current="page"], .seitenleiste .nav-knopf[aria-pressed="true"] { background: var(--hover); color: var(--tinte); box-shadow: inset 0 0 0 1px var(--linie); }
.nav-name { flex: 1; min-width: 0; }
.nav-kurz { display: none; }
.nav-zahl { color: var(--tinte-3); font-family: var(--schrift-mono); font-size: 0.75rem; font-weight: 400; }
.kopf .nav-name, .kopf .nav-zahl { display: none; }
.seitenleiste-titel { margin: 0 0 4px; padding: 0 10px; color: var(--tinte-3); font-size: 0.75rem; font-weight: 500; }
.seitenleiste-werkzeuge { display: flex; flex-direction: column; gap: 2px; }
.seitenleiste-unten { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.speicher {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-mittel);
  background: var(--flaeche);
  font-size: 0.75rem;
}
.speicher-zeile { display: flex; justify-content: space-between; gap: 8px; }
.speicher-zeile > span:first-child { color: var(--tinte-2); font-weight: 500; }
.speicher-zeile > span:last-child { color: var(--tinte-3); font-family: var(--schrift-mono); }
.speicher-balken { display: block; height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; }
.speicher-balken > span { display: block; height: 100%; border-radius: 2px; background: var(--akzent); }
.speicher-schutz { display: inline-flex; align-items: center; gap: 6px; color: var(--erfolg); font-weight: 500; }
.speicher-schutz svg { width: 13px; height: 13px; flex: none; }
.speicher-text { color: var(--tinte-3); line-height: 1.4; }
.nutzerzeile { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 2px; }
.nutzerzeile .nutzer-ohne { flex: 1; min-width: 0; padding: 0 4px; color: var(--tinte-3); font-size: 0.75rem; line-height: 1.35; }
.nutzerzeile .konto-knopf {
  flex: 1;
  justify-content: flex-start;
  max-width: none;
  min-width: 0;
  min-height: 44px;
  padding: 4px 6px 4px 4px;
  border-color: transparent;
  background: transparent;
  color: var(--tinte);
  font-size: var(--groesse-klein);
  font-weight: 500;
}
.nutzerzeile .konto-knopf:hover:not(:disabled) { border-color: transparent; background: var(--hover); color: var(--tinte); }
.nutzerzeile .konto-knopf svg { width: 32px; height: 32px; padding: 7px; border-radius: 50%; background: var(--akzent-wasch); color: var(--akzent-ton); }
.nutzerzeile .kopf-knopf { width: 36px; height: 36px; }
.mehr-schleier { display: none; }

.reiterleiste { display: none; }

/* ─────────────────────── Werkzeugschiene (nur Symbole) ─────────────────────── */

.leiste {
  position: sticky;
  top: var(--kopf-hoehe);
  z-index: 6;
  align-self: start;
  height: calc(100dvh - var(--kopf-hoehe));
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0 16px;
  background: var(--seitenflaeche);
  border-right: 1px solid var(--linie);
  scrollbar-width: thin;
}
.leiste-kopf { display: none; }
.leiste-gruppe { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.leiste-gruppe + .leiste-gruppe::before { content: ""; width: 24px; height: 1px; margin: 4px 0; background: var(--linie); }
/* Auf der 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 {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--tinte-2);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}
.reiter svg { width: 20px; height: 20px; flex: none; }
.reiter-text { display: none; min-width: 0; }
.reiter-name, .reiter-info { display: none; }
.reiter-kurz { hyphens: manual; }
.reiter:hover { background: var(--hover); color: var(--tinte); }
.reiter[aria-current="true"] { background: var(--akzent-wasch); color: var(--akzent-ton); box-shadow: inset 0 0 0 1px var(--akzent-rand); }
/* Tooltip mit dem Namen bei Zeigen und Tastaturfokus */
.reiter::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: 30;
  padding: 4px 9px;
  border: 1px solid var(--linie-2);
  border-radius: var(--radius-klein);
  background: var(--erhoeht);
  color: var(--tinte);
  box-shadow: var(--schatten-gross);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-4px, -50%);
  transition: opacity 0.12s, transform 0.12s;
  pointer-events: none;
}
.reiter:hover::after, .reiter:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
@media (min-height: 620px) and (min-width: 821px) { .leiste { overflow: visible; } }

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

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

.dateileiste { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.trenner-senkrecht { flex: none; width: 1px; height: 22px; margin: 0 4px; background: var(--linie); }
.dateileiste > .trenner-senkrecht:first-child { display: none; }
.dateileiste .datei-name { display: flex; flex: 0 1 auto; align-items: baseline; gap: 2px 10px; min-width: 0; font-weight: 400; }
.dateileiste .datei-titel-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dateileiste .datei-name small {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px 10px;
  margin-left: 0;
  color: var(--tinte-3);
  font-size: var(--groesse-klein);
  white-space: nowrap;
}
.datei-aktionen { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: none; position: relative; }
.dateileiste .knopf svg { width: 18px; height: 18px; }
.datei-aktionen > .knopf.leise { width: 36px; min-height: 36px; padding: 0; color: var(--tinte-2); }
.datei-aktionen > .knopf.leise:hover:not(:disabled) { background: var(--hover); color: var(--tinte); }
.dateileiste .knopf-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#andere-datei { min-height: 36px; padding: 0 10px; color: var(--tinte-2); font-weight: 500; }

.status-pille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--tinte-2);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.status-pille::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; }
.status-pille[data-zustand="offen"] { background: var(--hinweis-wasch); color: var(--hinweis); }
/* „Änderungen offen“: Warndreieck statt Punkt – Gelb allein unterscheidet sich zu wenig vom Orange. */
.status-pille[data-zustand="offen"]::before { display: none; }
.status-pille > svg { flex: none; width: 13px; height: 13px; margin-left: -2px; stroke-width: 2; color: 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; margin-left: 6px; border-radius: 9px; box-shadow: var(--glow); }
.speichern-gruppe .knopf.haupt { min-height: 36px; padding: 0 14px; border-radius: 9px; box-shadow: none; }
.speichern-gruppe.mit-mehr #speichern-datei { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.speichern-gruppe .speichern-mehr {
  width: 32px;
  padding: 0;
  border-left: 1px solid color-mix(in srgb, var(--haupt-text) 30%, transparent);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.speichern-gruppe .speichern-mehr svg { width: 16px; height: 16px; }

/* 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-2);
  border-radius: var(--radius-mittel);
  background: var(--erhoeht);
  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(--hover); }
.menue-eintrag svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--akzent-ton); }
.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.375rem; line-height: 1.2; letter-spacing: -0.02em; }
.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: 1px dashed var(--feldrand);
  border-radius: var(--radius-mittel);
  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(--fokus-farbe); 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-ton); font-weight: 500; 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: var(--radius);
  background: var(--erhoeht);
  color: var(--tinte);
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--lichtkante);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.knopf:hover:not(:disabled) { border-color: var(--feldrand); background: var(--hover); color: var(--tinte); }
.knopf.haupt { background: var(--haupt); border-color: var(--haupt); color: var(--haupt-text); font-weight: 600; box-shadow: var(--glow); }
.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-ton); box-shadow: none; }
.knopf.leise:hover:not(:disabled) { background: var(--akzent-wasch); border-color: transparent; color: var(--akzent-ton); }
.knopf.klein { min-height: 36px; padding: 4px 12px; font-size: var(--groesse-klein); }
.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(--hover); color: var(--tinte); }
.symbol-knopf.gefahr:hover:not(:disabled) { color: var(--fehler); }
.symbol-knopf:disabled { opacity: 0.3; cursor: default; }
.kopf-knopf.symbol-knopf { width: 40px; height: 40px; }
.kopf-knopf.symbol-knopf svg { width: 18px; height: 18px; }
@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-ton);
  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 rgb(0 0 0 / 0.08); 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); font-variant-numeric: tabular-nums; }
.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(--feldrand), 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-ton); font-weight: 600; }
.seiten-kachel[aria-pressed="true"] .kachel-nr::before { content: "✓ "; }

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

.feld {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--feldrand);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--tinte);
  width: 100%;
}
.feld::placeholder { color: var(--tinte-3); opacity: 1; }
textarea.feld { min-height: 96px; resize: vertical; }
.feld:focus { outline: none; border-color: var(--fokus-farbe); box-shadow: 0 0 0 3px var(--fokus); }
.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: var(--radius); }
.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(--feldrand);
  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; }
.vorschau-zeile { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.vorschau-zeile > .seitenspalte-knopf { margin-left: auto; }
.leinwand {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: start;
  overflow: auto;
  max-height: 74vh;
  padding: 16px;
  border-radius: var(--radius-mittel);
  background-color: var(--arbeitsflaeche);
  background-image: radial-gradient(var(--punkt) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.leinwand.gross { max-height: none; }
.leinwand canvas { display: block; background: #fff; border-radius: 2px; box-shadow: var(--papier-schatten); }
.blaettern { display: flex; align-items: center; gap: 2px; 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); font-family: var(--schrift-mono); font-size: 0.75rem; }
.blaettern .symbol-knopf { width: 36px; height: 36px; }
.werkzeugzeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  min-height: 44px;
  padding: 3px 6px 3px 4px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-mittel);
  background: var(--erhoeht);
  box-shadow: var(--schatten-gross);
}
.zoom { display: inline-flex; align-items: center; gap: 8px; font-size: var(--groesse-klein); color: var(--tinte-2); }
.zoom .feld { width: auto; min-height: 36px; padding: 4px 8px; }
.werkzeugzeile { justify-content: center; gap: 2px; padding: 4px; min-height: 0; }
.werkzeugzeile .trenner-senkrecht { height: 18px; }
.werkzeugzeile .blaettern[hidden] + .trenner-senkrecht { display: none; }
.werkzeugzeile .symbol-knopf { width: 32px; height: 32px; border-radius: var(--radius-klein); }
.werkzeugzeile .blaettern .seite-zahl { min-width: 54px; }

/* Bausteine für Einstellungen */
.block {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* lange Namen kürzen statt die Karte zu verbreitern */
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-gross);
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.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: 2px;
  padding: 3px;
  border: 0;
  border-radius: var(--radius);
  background: var(--hover);
}
.umschalter-knopf {
  min-height: 36px;
  padding: 4px 14px;
  border: 0;
  border-radius: var(--radius-klein);
  background: transparent;
  color: var(--tinte-2);
  font-size: var(--groesse-klein);
  font-weight: 500;
  cursor: pointer;
}
.umschalter-knopf[aria-checked="true"] { background: var(--erhoeht); color: var(--tinte); font-weight: 600; box-shadow: 0 1px 2px rgb(12 17 23 / 0.1), 0 0 0 1px rgb(12 17 23 / 0.04), var(--lichtkante); }

/* ─────────────────── 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;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-mittel);
  background: var(--erhoeht);
  box-shadow: var(--schatten-gross);
}
.werkzeug {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-klein);
  background: transparent;
  color: var(--tinte-2);
  font-size: var(--groesse-klein);
  font-weight: 500;
  cursor: pointer;
}
.werkzeug svg { width: 18px; height: 18px; flex: none; }
.werkzeug:hover { background: var(--hover); color: var(--tinte); }
.werkzeug[aria-pressed="true"] { background: var(--akzent-wasch); color: var(--akzent-ton); font-weight: 600; box-shadow: inset 0 0 0 1px var(--akzent-rand); }
.rueck-knopf { flex: none; align-self: center; margin-left: 4px; }
.werkzeug-hinweis {
  justify-self: center;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 12px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--tinte-2);
  font-size: 0.75rem;
  text-align: center;
}
.werkzeug-hinweis svg { display: none; }
.werkzeug-hinweis::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--akzent); }

/* Seiteneditor */
.editor-raster { display: grid; grid-template-columns: minmax(0, 1fr) 312px; 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; }
/* Beschriften: Name unter der eigenen Unterschrift – hängt unter dem Bild und wandert mit */
.el-bild .el-name {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.17em; /* ≈ 1,5 pt bei 9 pt, wie NAMENSZEILE.abstand */
  font-family: Arial, "Liberation Sans", Helvetica, sans-serif;
  line-height: 1.2;
  color: #1a2133;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  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; }
}
/* Langes Drücken öffnet das eigene Menü – kein „Bild sichern“, keine Textauswahl und keine Lupe (iOS);
   nur der Text, der gerade getippt wird, bleibt markierbar */
.ebene, .ebene .el { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.ebene .el-text.tippen, .ebene .el-text.tippen .el-inhalt { -webkit-user-select: text; user-select: text; }

/* Leiste am gewählten Eintrag (js/editor.js): Duplizieren · Löschen · ⋯ – schwebt über dem Eintrag, sonst darunter */
.objekt-leiste {
  position: absolute;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--linie-2);
  border-radius: var(--radius-klein);
  background: var(--erhoeht);
  box-shadow: var(--schatten-gross);
  white-space: nowrap;
}
.objekt-leiste .symbol-knopf { width: 32px; height: 32px; border-radius: 6px; color: var(--tinte-2); }
.objekt-leiste .symbol-knopf svg { width: 17px; height: 17px; }
.objekt-leiste .symbol-knopf:focus-visible { outline-offset: 0; }
.objekt-leiste .symbol-knopf[aria-expanded="true"] { background: var(--hover); color: var(--tinte); }
@media (pointer: coarse), (max-width: 767px) {
  .objekt-leiste .symbol-knopf { width: 44px; height: 44px; }
  .objekt-leiste .symbol-knopf svg { width: 20px; height: 20px; }
}

/* Kontextmenü (js/ui.js kontextmenue): wie die Aufklappmenüs, aber an der Klickstelle und immer ganz im Fenster */
.kontext-menue {
  position: fixed;
  top: 0;
  right: auto;
  left: 0;
  z-index: 45;
  width: max-content;
  min-width: 220px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  gap: 0;
  padding: 5px;
}
.kontext-eintrag { align-items: center; min-height: 36px; padding: 7px 10px; }
.kontext-eintrag svg { width: 18px; height: 18px; margin-top: 0; color: var(--tinte-2); }
.kontext-eintrag .kontext-text { flex: 1; }
.kontext-eintrag kbd { margin-left: 18px; }
.kontext-eintrag:focus-visible { outline-offset: -2px; }
.kontext-eintrag.gefahr-text, .kontext-eintrag.gefahr-text svg { color: var(--fehler); }
.menue-trenner { height: 1px; margin: 4px 8px; background: var(--linie); }
@media (pointer: coarse) {
  .kontext-eintrag { min-height: 44px; }
  .kontext-eintrag kbd { display: none; }
}

/* 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; box-shadow: none; }
/* Überschrift des Werkzeugs oben in den Eigenschaften (js/app.js setzt sie dorthin), Aktionen unten */
.panel-kopf:has(> .panel-symbol) { grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: center; }
.panel-kopf:has(> .panel-symbol) > :not(.panel-symbol) { grid-column: 2; }
.seitenkasten .panel-kopf h2 { font-size: var(--groesse-h3); letter-spacing: -0.01em; }
.seitenkasten .panel-kopf p { color: var(--tinte-3); font-size: 0.75rem; line-height: 1.45; }
.panel-symbol { grid-row: 1 / span 2; align-self: start; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--akzent-wasch); color: var(--akzent-ton); }
.panel-symbol svg { width: 18px; height: 18px; }
.seitenkasten > .leiste-aktionen { padding-top: 12px; }
.seitenkasten > .leiste-aktionen .knopf.haupt { flex: 1 1 auto; }
/* 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); border-color: var(--seitenflaeche); }
@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-ton); 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;
}
/* Gespeicherte Unterschriften als wählbare Kacheln */
.unterschrift-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.unterschrift-kachel {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 6px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--tinte);
  cursor: pointer;
}
.unterschrift-kachel img { width: 100%; height: 44px; object-fit: contain; border-radius: 4px; background: #fff; }
.unterschrift-kachel .unterschrift-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--groesse-klein); }
.unterschrift-kachel[aria-checked="true"] { border-color: var(--akzent); background: var(--akzent-wasch); color: var(--akzent-ton); font-weight: 600; }
.unterschrift-aktionen { flex-wrap: wrap; }

/* 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; }
/* Stapel aufteilen: Dokumentkarten (Seiten + Name/Ordner), Schnittlinien dazwischen, ausgelassene Seiten als Zeilen */
.stapel-folge { display: grid; gap: 8px; }
.stapel-karte { display: grid; gap: 12px; padding: 14px 16px 16px; border: 1px solid var(--linie); border-radius: var(--radius-gross); background: var(--flaeche); box-shadow: var(--schatten); }
.stapel-karte-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.stapel-karte-kopf strong { font-weight: 600; }
.stapel-karte-kopf > span { color: var(--tinte-2); font-size: var(--groesse-klein); }
.stapel-ki { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: var(--akzent-wasch); color: var(--akzent-ton); font-size: 0.75rem; font-weight: 500; }
.stapel-seiten { display: flex; flex-wrap: wrap; align-items: stretch; row-gap: 10px; }
.stapel-seite { display: grid; gap: 4px; justify-items: center; align-content: start; width: 108px; color: var(--tinte-2); font-size: var(--groesse-klein); text-align: center; }
.stapel-seite canvas { display: block; background: #fff; box-shadow: 0 1px 3px rgb(20 30 50 / 0.18); }
.stapel-seite[data-aus="true"] canvas { opacity: 0.4; box-shadow: none; outline: 1px dashed var(--linie-2); outline-offset: 2px; }
.stapel-seite .knopf { min-height: 28px; padding: 2px 8px; }
.stapel-seite .stapel-aus { color: var(--tinte-2); }
.stapel-seite .stapel-aus:hover:not(:disabled) { color: var(--akzent-ton); }
.stapel-schere { display: grid; place-items: center; align-self: stretch; width: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--tinte-2); opacity: 0.5; cursor: pointer; }
.stapel-schere svg { width: 16px; height: 16px; transform: rotate(90deg); }
.stapel-schere:hover, .stapel-schere:focus-visible { opacity: 1; background: var(--akzent-wasch); color: var(--akzent-ton); }
@media (hover: none) { .stapel-schere { opacity: 0.8; } }
.stapel-schnitt { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 8px; color: var(--akzent-ton); }
.stapel-schnitt > svg { flex: none; width: 18px; height: 18px; }
.stapel-schnitt-linie { flex: 1; border-top: 2px dashed var(--akzent-rand); }
.stapel-zeile { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 10px; border: 1px dashed var(--linie-2); border-radius: var(--radius); color: var(--tinte-2); font-size: var(--groesse-klein); }
.stapel-zeile canvas { flex: none; width: auto !important; height: 32px !important; background: #fff; box-shadow: 0 0 0 1px var(--linie-2); opacity: 0.7; }
.stapel-zeile > span { flex: 1; min-width: 0; }
.stapel-felder { display: grid; gap: 8px 10px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.stapel-feld { display: grid; gap: 4px; color: var(--tinte-2); font-size: var(--groesse-klein); }
@media (max-width: 820px) { .stapel-felder { grid-template-columns: 1fr; } .stapel-seite { width: 96px; } .stapel-karte { padding: 12px; } }
.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: var(--schrift-mono); 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: var(--schleier);
}
.dialog {
  display: grid;
  gap: 12px;
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--linie-2);
  border-radius: var(--radius-xl);
  background: var(--erhoeht);
  box-shadow: var(--schatten-xl);
}
.dialog h2 { font-family: var(--schrift-titel); font-size: var(--groesse-h2); font-weight: 600; letter-spacing: -0.015em; }
.dialog h3 { margin-top: 6px; font-size: var(--groesse-h3); 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; }
/* Fortschritt ohne Knöpfe (An Buchführung senden) */
.lauf-zeile { display: flex; align-items: center; gap: 10px; }
.kreisel { flex: none; width: 18px; height: 18px; border: 2px solid var(--akzent); border-right-color: transparent; border-radius: 50%; animation: drehen 0.8s linear infinite; }
.fehlertext { color: var(--fehler); font-size: var(--groesse-klein); }
.link-knopf { padding-inline: 4px; color: var(--akzent-ton); 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: var(--schrift-mono);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-align: center;
  word-break: break-word;
  user-select: all;
}

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

.start-normal { display: grid; gap: 28px; min-width: 0; }
.start-haupt { display: grid; gap: 28px; min-width: 0; }
.start-kopf { display: grid; gap: 6px; }
.start-datum { color: var(--tinte-3); font-family: var(--schrift-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.start-kopf h1 {
  font-family: var(--schrift-titel);
  font-weight: 600;
  font-size: var(--groesse-h1);
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.start-kopf p { max-width: 60ch; color: var(--tinte-2); font-size: 0.9375rem; }
.start-hinweis {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--akzent-wasch);
  color: var(--akzent-ton);
  font-weight: 600;
}
#zurueck-start { justify-self: start; }

/* Ablagekarte: gestrichelte Fläche mit Punktraster, darunter Datenschutz und Beispiele */
.start-karte {
  display: grid;
  gap: 0;
  padding: 6px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-xl);
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.start-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 26px 28px;
  border: 1px dashed var(--feldrand);
  border-radius: var(--radius-mittel);
  background-color: var(--flaeche-2);
  background-image: radial-gradient(var(--punkt) 1px, transparent 1.2px);
  background-size: 16px 16px;
  transition: border-color 0.15s, background-color 0.15s;
}
.start-zone.ueber { border-color: var(--akzent); background-color: var(--akzent-wasch); }
.start-ablage {
  flex: 1 1 320px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 20px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
}
.start-ablage:hover, .start-ablage.ueber { background: transparent; }
.start-ablage:focus-within { outline-offset: 6px; }
.ablage-symbol {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-gross);
  background: var(--akzent-wasch);
  color: var(--akzent-ton);
  box-shadow: var(--lichtkante);
}
.ablage-symbol svg { width: 26px; height: 26px; stroke-width: 1.6; }
.ablage-text { display: grid; gap: 2px; min-width: 0; }
.ablage-text strong { font-size: 1.0625rem; letter-spacing: -0.01em; }
.ablage-zusatz { display: block; font-size: var(--groesse-text); }
.start-knoepfe { display: flex; flex-wrap: wrap; gap: 10px; }
.start-knoepfe .knopf { min-height: 44px; }
.start-knoepfe label.knopf { padding-inline: 18px; }
.start-knoepfe label.knopf:focus-within { outline: 2px solid var(--fokus-farbe); outline-offset: 2px; }
.scan-start { gap: 8px; }
.scan-start .scan-symbol { display: contents; }
.scan-start .scan-texte { display: contents; }
.scan-start small { display: none; }
.start-unten { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 16px 6px; color: var(--tinte-3); font-size: 0.75rem; }
.beispiele { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-left: auto; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--akzent-ton);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { text-decoration: underline; text-underline-offset: 3px; }
.chip[aria-pressed="true"] { color: var(--tinte); }

/* Schnellstart */
.aufgaben { display: grid; gap: 12px; }
.aufgaben-kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.aufgaben-kopf h2 { font-size: var(--groesse-h3); font-weight: 600; }
.aufgaben-kopf p { color: var(--tinte-3); font-size: 0.75rem; }
.aufgaben-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.aufgabe {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-gross);
  background: var(--flaeche);
  color: var(--tinte);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--schatten);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.aufgabe:hover { border-color: var(--linie-2); box-shadow: var(--schatten-gross); }
.aufgabe-symbol {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--akzent-wasch);
  color: var(--akzent-ton);
}
.aufgabe-symbol svg { width: 19px; height: 19px; }
.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-3); font-size: var(--groesse-klein); }
.aufgaben-mehr .knopf.leise { min-height: 36px; padding: 2px 8px; font-size: var(--groesse-klein); font-weight: 500; }

/* Listen unten: „Zuletzt bearbeitet“ / „Zuletzt geöffnet“ als Tabelle, daneben „Versendet“ */
.start-listen { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.start-listen > * { flex: 999 1 520px; min-width: 0; }
.start-listen > .versendet, .start-listen > .meine:not(.offen) { flex: 1 1 300px; }
.liste-karte { padding: 0; gap: 0; overflow: hidden; container-type: inline-size; }
.liste-karte > .block-kopf { flex-wrap: wrap; justify-content: flex-start; gap: 4px 10px; padding: 14px 18px; }
.liste-karte > .block-kopf h2 { font-size: var(--groesse-h3); font-weight: 600; }
.liste-karte > .block-kopf .hinweis { color: var(--tinte-3); font-size: 0.75rem; }
.liste-karte > .block-kopf > :last-child:not(:first-child):not(.hinweis) { margin-left: auto; }
.liste-karte > .block-kopf .knopf.leise { min-height: 32px; padding: 0 8px; color: var(--tinte-2); font-size: var(--groesse-klein); font-weight: 500; }
.liste-karte > :not(.block-kopf):not(.zuletzt-liste):not(.zl-kopf) { margin: 0 18px; }
.liste-karte > :last-child { margin-bottom: 14px; }
.liste-karte > .zuletzt-liste:last-child { margin-bottom: 0; }
.liste-karte .meine-werkzeuge { margin-bottom: 10px; }
.liste-fuss { padding-top: 10px; border-top: 1px solid var(--linie); color: var(--tinte-3); font-size: 0.75rem; }
.liste-karte > .liste-fuss { margin: 0; padding: 10px 18px 14px; }

.zl-kopf, .zuletzt-oeffnen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 80px 110px 150px;
  align-items: center;
  gap: 12px;
}
.zl-kopf {
  padding: 8px 18px;
  border-top: 1px solid var(--linie);
  border-bottom: 1px solid var(--linie);
  background: var(--flaeche-2);
  color: var(--tinte-3);
  font-size: 0.75rem;
  font-weight: 500;
}
.zl-kopf > span:last-child { grid-column: 5; }
.zuletzt-liste { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.zuletzt-eintrag { display: flex; align-items: center; gap: 2px; padding-right: 10px; border-bottom: 1px solid var(--linie); }
.zuletzt-eintrag:last-child { border-bottom: 0; }
.zuletzt-liste > .hinweis, .zuletzt-liste > .fehlertext { padding: 12px 18px; }
.zuletzt-oeffnen {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 6px 8px 6px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--tinte);
  text-align: left;
  cursor: pointer;
}
.zuletzt-eintrag:hover { background: var(--flaeche-2); }
.zl-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.zl-name::before {
  content: "PDF" / "";
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 36px;
  border: 1px solid var(--linie);
  border-radius: 5px;
  background: var(--flaeche-2);
  color: var(--tinte-3);
  font-family: var(--schrift-mono);
  font-size: 8px;
  font-weight: 600;
}
.zl-name > span { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; line-height: 1.35; }
.zuletzt-oeffnen .datei-titel-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.zuletzt-oeffnen small { color: var(--tinte-3); font-size: 0.75rem; }
.zuletzt-oeffnen .zuletzt-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zl-zahlen { display: contents; color: var(--tinte-2); font-size: var(--groesse-klein); }
.zl-seiten, .zl-groesse { font-family: var(--schrift-mono); font-variant-numeric: tabular-nums; }
.zl-zeit { white-space: nowrap; }
.zl-status { min-width: 0; }
.zuletzt-oeffnen .bald-weg { color: var(--hinweis); font-weight: 600; }
/* Schmale Karte (Telefon, neben „Versendet“): Zahlen unter dem Namen, Status rechts */
@container (max-width: 559px) {
  .zl-kopf { display: none; }
  .zuletzt-oeffnen { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name status" "zahlen status"; row-gap: 0; padding-left: 14px; }
  .zl-name { grid-area: name; }
  .zl-zahlen { grid-area: zahlen; display: flex; flex-wrap: wrap; gap: 0 8px; padding-left: 42px; color: var(--tinte-3); font-size: 0.75rem; }
  .zl-zahlen > * + *::before { content: "· "; }
  .zl-seiten .nur-vorlesen { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .zl-seiten, .zl-groesse { font-family: inherit; }
  .zl-status { grid-area: status; }
}
.start-seite > *, .block > * { min-width: 0; }
.meine-ersatz { font-size: var(--groesse-klein); }
.zuletzt .haken-zeile { font-weight: 500; }
.liste-karte > .haken-zeile { margin-top: 10px; }

/* Konto und „Meine Dokumente“ */
.konto-knopf { gap: 8px; max-width: 260px; min-height: 40px; font-size: var(--groesse-klein); }
.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 h2 { white-space: nowrap; }
.meine:not(.offen) { padding: 18px; gap: 12px; }
.meine:not(.offen) > .block-kopf { padding: 0; }
.meine:not(.offen) > :not(.block-kopf) { margin: 0; }
.meine-werkzeuge { display: grid; gap: 8px; }
.belegung { display: grid; gap: 4px; }
.belegung-balken { display: block; height: 6px; border-radius: 3px; background: var(--hover); 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); }
.verwaltung-text .plakette { margin-left: 6px; }
.verwaltung-knoepfe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }

/* Zwei-Faktor einrichten (QR-Code) und Sperrbildschirm mit PIN (js/zweifaktor.js) */
.qr-bild { justify-self: center; width: min(240px, 100%); padding: 8px; border: 1px solid var(--linie); border-radius: 8px; background: #fff; }
.qr-bild svg { display: block; width: 100%; height: auto; }
.totp-schluessel { font-family: var(--schrift-mono); font-size: 0.95em; letter-spacing: 0.04em; overflow-wrap: anywhere; user-select: all; }
.pin-sperre {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--papier); /* undurchsichtig: das offene Dokument bleibt verborgen */
}
.pin-sperre[hidden] { display: none; }
.pin-karte {
  display: grid;
  gap: 12px;
  width: min(380px, 100%);
  padding: 24px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-gross);
  background: var(--flaeche);
  box-shadow: var(--schatten-gross);
}
.pin-karte h2 { font-family: var(--schrift-titel); font-size: var(--groesse-h2, 1.375rem); font-weight: 600; letter-spacing: -0.015em; }
.pin-feld { font-size: 1.5rem; letter-spacing: 0.5em; text-align: center; }
.pin-karte .link-knopf { justify-self: center; }

/* ─────────────────────────── Ablage: Meine Dokumente mit Ordnern (#ablage) ─────────────────────────── */
.ablage-seite { display: grid; gap: 16px; --ablage-aktionen: 226px; } /* Platz für sechs Zeilenknöpfe (Vorlage) – Kopfzeile und Zeilen bleiben bündig */
@media (pointer: coarse) { .ablage-seite { --ablage-aktionen: 274px; } }
.ablage-hauptteil { display: grid; gap: 16px; min-width: 0; }
.ablage-kopfzeile { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.ablage-kopfzeile h1 { font-family: var(--schrift-titel); font-weight: 600; font-size: var(--groesse-h1); line-height: 1.15; letter-spacing: -0.025em; }
.ablage-kopfzeile p { flex-basis: 100%; color: var(--tinte-2); }
.ablage-werkzeuge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ablage-werkzeuge .feld { flex: 1 1 220px; max-width: 360px; }
.ablage-werkzeuge label.knopf:focus-within { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ablage-fortschritt { display: grid; gap: 4px; flex-basis: 100%; }
.ablage-raster { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.ablage-baum-huelle { padding: 8px; border: 1px solid var(--linie); border-radius: var(--radius-gross); background: var(--flaeche); }
.ablage-baum-huelle > summary { display: none; }
.ablage-baum, .ablage-baum ul { list-style: none; margin: 0; padding: 0; }
.ablage-baum ul { padding-left: 18px; }
.ablage-knoten { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
/* Ziel beim Ziehen – intern wie Dateien vom Rechner */
.ablage-knoten.ziel, .ablage-zeile.ziel, .ablage-pfad .ziel { outline: 2px dashed var(--akzent); outline-offset: -2px; background: var(--akzent-wasch); }
.ablage-auf { width: 28px; height: 28px; }
.ablage-auf svg { transition: transform 0.15s; }
.ablage-auf[aria-expanded="false"] svg { transform: rotate(-90deg); }
.ablage-auf.leer { visibility: hidden; }
.ablage-ordner-knopf { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 36px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--tinte); text-align: left; cursor: pointer; }
.ablage-ordner-knopf svg { width: 18px; height: 18px; flex: none; color: var(--akzent-ton); }
.ablage-ordner-knopf span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ablage-ordner-knopf:hover { background: var(--flaeche-2); }
.ablage-ordner-knopf[aria-current="true"] { background: var(--akzent-wasch); color: var(--akzent-ton); font-weight: 600; }
.ablage-inhalt { display: grid; align-content: start; gap: 10px; min-width: 0; min-height: 240px; padding: 12px; border: 1px solid var(--linie); border-radius: var(--radius-gross); background: var(--flaeche); container-type: inline-size; }
.ablage-inhalt.ueber { border: 2px dashed var(--akzent); padding: 11px; background: var(--akzent-wasch); }
.ablage-pfad ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: var(--groesse-klein); }
.ablage-pfad li { display: flex; align-items: center; }
.ablage-pfad li + li::before { content: "›"; padding: 0 2px; color: var(--tinte-2); }
.ablage-pfad .knopf.leise { min-height: 32px; padding: 2px 8px; }
.ablage-pfad [aria-current="page"] { color: var(--tinte); font-weight: 600; }
.ablage-suchtext { padding: 6px 8px; color: var(--tinte-2); font-size: var(--groesse-klein); }
.ablage-auswahl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 12px; border-radius: 10px; background: var(--akzent-wasch); color: var(--akzent-ton); font-weight: 600; }
.ablage-liste { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ablage-kopfzeile-liste, .ablage-zeile { display: grid; grid-template-columns: 32px minmax(0, 1fr) 9rem 6rem var(--ablage-aktionen); align-items: center; gap: 4px 8px; padding: 2px 8px; }
.ablage-kopfzeile-liste { border-bottom: 1px solid var(--linie); color: var(--tinte-2); font-size: var(--groesse-klein); }
.ablage-sortieren { min-height: 32px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; color: var(--tinte-2); font-size: var(--groesse-klein); font-weight: 500; text-align: left; cursor: pointer; }
.ablage-sortieren[aria-pressed="true"] { color: var(--akzent-ton); font-weight: 600; }
.ablage-zeile { min-height: 48px; border-radius: 8px; }
.ablage-zeile:hover { background: var(--flaeche-2); }
.ablage-zeile[data-gewaehlt="true"] { background: var(--akzent-wasch); }
.ablage-zeile.ziehen { opacity: 0.5; }
.ablage-wahl { width: 20px; height: 20px; margin: 0 6px; accent-color: var(--akzent); }
.ablage-name { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 4px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--tinte); text-align: left; cursor: pointer; }
.ablage-name > span { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; } /* lange Namen enden mit „…“ statt überzulaufen */
.ablage-titel { display: flex; align-items: center; min-width: 0; }
.ablage-titel .plakette { flex: none; }
.ablage-name .datei-titel-text { font-weight: 500; }
.ablage-name small { color: var(--tinte-2); font-size: var(--groesse-klein); }
.ablage-zeile:not(.ordner) .ablage-name::before { content: ""; flex: none; width: 24px; height: 32px; border: 1px solid var(--linie); border-radius: 3px; background: linear-gradient(var(--linie-2), var(--linie-2)) 4px 6px / 55% 2px no-repeat, linear-gradient(var(--linie), var(--linie)) 4px 12px / 70% 2px no-repeat, linear-gradient(var(--linie), var(--linie)) 4px 17px / 45% 2px no-repeat, #fff; }
.ablage-zeile.ordner .ablage-name svg { width: 22px; height: 22px; flex: none; color: var(--akzent-ton); }
.ablage-zahlen { display: contents; }
.ablage-datum, .ablage-groesse { color: var(--tinte-2); font-size: var(--groesse-klein); font-variant-numeric: tabular-nums; }
.ablage-aktionen { display: flex; justify-content: flex-end; gap: 2px; }
/* Schmale Inhaltsfläche (Telefon, Tablet hochkant, kleines Fenster): Datum und Größe unter dem Namen, Knöpfe in zwei Reihen zu drei */
@container (max-width: 600px) {
  .ablage-kopfzeile-liste { grid-template-columns: 32px minmax(0, 1fr) auto auto; }
  .ablage-kopfzeile-liste .ablage-aktionen { display: none; }
  .ablage-zeile { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "wahl name aktionen" "wahl zahlen aktionen"; row-gap: 0; }
  .ablage-zeile .ablage-wahl { grid-area: wahl; }
  .ablage-zeile .ablage-name { grid-area: name; }
  .ablage-zeile .ablage-zahlen { grid-area: zahlen; display: flex; gap: 8px; padding: 0 6px 6px; }
  .ablage-zeile .ablage-aktionen { grid-area: aktionen; flex-wrap: wrap; justify-content: flex-end; max-width: 138px; }
}
/* Ordnerstruktur einfügen: Liste im Dialog mit Vorschau (Status als data-status – die Klasse .neu ist schon eine Plakette) */
#ablage-struktur-text { min-height: 180px; font-family: var(--schrift-mono); tab-size: 4; }
.ablage-struktur-ziel { font-weight: 500; }
.ablage-struktur-vorschau { max-height: 40vh; overflow-y: auto; margin: 0; padding: 6px 8px; list-style: none; border: 1px solid var(--linie); border-radius: 10px; font-size: var(--groesse-klein); }
.ablage-struktur-vorschau li { display: flex; align-items: center; gap: 6px; min-height: 26px; min-width: 0; padding-left: calc(var(--tiefe, 0) * 16px); }
.ablage-struktur-vorschau li svg { width: 16px; height: 16px; flex: none; color: var(--akzent-ton); }
.ablage-struktur-vorschau li span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ablage-struktur-vorschau li[data-status="vorhanden"] .plakette { background: var(--flaeche-2); color: var(--tinte-2); }

/* ─────────────────────────── 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.15; letter-spacing: -0.025em; }
.einstellungen-kopf p { color: var(--tinte-2); font-size: 0.9375rem; }
.einstellungen-zurueck { justify-self: start; margin-left: -10px; }
.karte {
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-xl);
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.karte-kopf { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.karte-kopf h2 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
.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(--fokus); }
.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-ton); }
.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-filter-zeile { display: grid; gap: 6px; justify-items: start; }
.scan-filter-zeile .feld-beschriftung { font-weight: 500; }
.scan-filter-zeile .hinweis { margin: 0; }
@media (max-width: 560px) {
  .scan-filter-zeile { justify-items: stretch; }
  .scan-filter-zeile .umschalter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .scan-filter-zeile .umschalter-knopf { min-height: 44px; padding-inline: 4px; }
}
@media (pointer: coarse) { .scan-filter-zeile .umschalter-knopf { min-height: 44px; } }
.scan-fertig .knopf { min-height: 52px; }
.scan-konto { display: grid; justify-items: start; gap: 10px; padding: 14px; border: 1px solid var(--linie); border-radius: 12px; background: var(--akzent-wasch); }
.scan-konto p { margin: 0; color: var(--tinte); }
.scan-konto .knopf { min-height: 44px; }
.warnung { color: var(--fehler); }
@media (pointer: coarse) { .scan-rahmen { padding: 54px; } }

/* Startansicht: „Versendet“ */
.versendet > .block-kopf { border-bottom: 1px solid var(--linie); }
.versendet-stand { font-family: var(--schrift-mono); }
.versendet .zuletzt-liste { padding: 6px; }
.versendet-eintrag { flex-wrap: wrap; gap: 4px 6px; padding: 4px 6px 8px; border-bottom: 0; border-radius: var(--radius); }
.versendet-eintrag:hover { background: var(--flaeche-2); }
.versendet-text {
  display: grid;
  gap: 4px;
  flex: 1 1 220px;
  min-width: 0;
  padding: 6px;
}
.versendet-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.versendet-text .datei-titel-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.versendet-text small { color: var(--tinte-3); font-size: 0.75rem; }

/* 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-ton);
  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; gap: 4px; }
/* Anmeldung: Marke mit Untertitel über dem Titel – der Name erklärt sich nicht selbst */
.dialog-marke { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; color: var(--tinte); }
.dialog-marke > span { display: grid; gap: 4px; }
/* Mit Untertitel: Flieger über beide Zeilen */
.empfang-seite .marke-zeichen, .dialog-marke .marke-zeichen { width: 36px; height: 36px; }
.empfang-seite .datenschutz { margin-left: auto; white-space: normal; border-radius: var(--radius); }
.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); }

/* Hinweis auf eine wartende neue Version (js/offline.js) */
.update-hinweis {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px;
  border: 1px solid var(--akzent-rand); border-radius: 12px; background: var(--flaeche); color: var(--tinte);
  box-shadow: var(--schatten-gross); font-size: var(--groesse-text);
}
.update-hinweis .knopf { white-space: nowrap; }
/* Umzug zur neuen Adresse (js/umzug.js): 56 px über dem Update-Hinweis, damit beide sichtbar sind */
#umzug-hinweis { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
/* Druckausgabe: unsichtbarer Rahmen mit der PDF (js/drucken.js) */
.druck-rahmen { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }

/* ─────────────────────────── Editoren auf breiten Bildschirmen ─────────────────────────── */

/* Beschriften, Schwärzen, Formular erstellen, Zum Ausfüllen senden (.editor-panel, js/app.js):
   links die Seite auf der Arbeitsfläche mit Punktraster, darüber die schwebende Werkzeugleiste
   mit Hinweiszeile, unten eine schwebende Leiste für Seite und Größe; rechts die Eigenschaften
   über die ganze Höhe (312 px). */
@media (min-width: 961px) {
  .editor-panel { gap: 0; }
  .editor-panel > .panel-kopf { max-width: none; padding: 20px 28px 16px; }
  .editor-panel .inhalt { gap: 0; }
  .editor-panel .kein-feld, .editor-panel .inhalt > .ergebnis { margin: 16px 28px; }
  .editor-panel .editor-raster { gap: 0; align-items: stretch; }
  .editor-panel .editor-huelle {
    position: sticky;
    top: var(--kopf-hoehe);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: calc(100dvh - var(--kopf-hoehe));
    padding: 14px 16px 0;
    background-color: var(--arbeitsflaeche);
    background-image: radial-gradient(var(--punkt) 1px, transparent 1.2px);
    background-size: 18px 18px;
  }
  .editor-panel .editor-huelle { container-type: inline-size; }
  .editor-panel .werkzeugleiste { position: static; flex: none; }
  .editor-panel .werkzeug-hinweis { flex: none; }
  .editor-panel .editor-leinwand { flex: 1; align-self: stretch; min-height: 0; max-height: none; padding: 10px 24px 76px; border-radius: 0; background: none; }
  .editor-panel .editor-huelle > .werkzeugzeile {
    position: absolute;
    left: 50%;
    bottom: 16px;
    z-index: 4;
    flex-wrap: nowrap;
    min-height: 0;
    transform: translateX(-50%);
    white-space: nowrap;
  }
  .editor-panel .editor-raster > .seitenkasten {
    position: sticky;
    top: var(--kopf-hoehe);
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--kopf-hoehe));
    max-height: none;
    padding: 16px 16px 0;
    border: 0;
    border-left: 1px solid var(--linie);
    border-radius: 0;
    background: var(--seitenflaeche);
  }
  .editor-panel .seitenkasten > .leiste-aktionen {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: auto -16px 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--seitenflaeche);
  }
}

/* Schmalere Seitenfläche: Werkzeugleiste enger, dann nur Symbole (Name bleibt für Vorleser und als Tooltip) */
@container (max-width: 1100px) {
  .werkzeugleiste .werkzeug { gap: 5px; padding: 0 8px; }
}
@container (max-width: 1010px) {
  .werkzeugleiste .werkzeug { width: 36px; padding: 0; }
  .werkzeugleiste .werkzeug > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

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

@media (max-width: 1180px) {
  .editor-raster { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 960px) {
  .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; }
  body[data-ansicht="werkzeug"] .arbeitsflaeche > .panel { padding: 20px 20px 48px; }
}
@media (max-width: 1100px) {
  body[data-ansicht="werkzeug"] #andere-datei { display: none; }
  .arbeitsflaeche { padding-inline: max(28px, env(safe-area-inset-left, 0px)) max(28px, env(safe-area-inset-right, 0px)); }
}

/* ─────────────────────────── Telefon (< 768 px) ─────────────────────────── */

@media (max-width: 767px) {
  /* Kopf: Marke links, Hell/Dunkel, Einstellungen und Konto rechts; keine Seitenleiste */
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .kopf { padding: 0 8px 0 16px; background: var(--seitenflaeche); box-shadow: inset 0 -1px 0 var(--linie); }
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .marke { width: auto; padding: 0; background: none; border: 0; align-self: center; border-radius: var(--radius); }
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .kopf-titel,
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .datenschutz,
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .datei-oeffnen-kopf { display: none; }
  body[data-ansicht] .kopf-rechts { gap: 2px; }
  body[data-ansicht] #helligkeit-knopf { border-color: transparent; background: transparent; }
  .kopf .kopf-knopf, .kopf .konto-knopf { width: 44px; height: 44px; min-height: 44px; }
  .kopf .konto-knopf { justify-content: center; padding: 0; border-color: transparent; background: transparent; box-shadow: none; }
  .kopf .konto-knopf .konto-text { display: none; }
  .kopf .konto-knopf svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--akzent-wasch); color: var(--akzent-ton); }
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .rahmen { grid-template-columns: minmax(0, 1fr); }
  .arbeitsflaeche { padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(100px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }

  /* Reiterleiste unten: Start, Dokumente, Versendet, Mehr */
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .reiterleiste {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 4px;
    padding: 6px 8px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--linie);
    background: var(--seitenflaeche);
  }
  .reiterleiste > :empty, .reiterleiste > .reiter-platz:not(:has(> :not([hidden]))) { display: none; }
  .reiterleiste .reiter-tab, .reiterleiste .nav-knopf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: auto;
    min-height: 52px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-mittel);
    background: transparent;
    color: var(--tinte-2);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
  }
  .reiterleiste svg { width: 22px; height: 22px; }
  .reiterleiste .nav-knopf .nav-name { display: block; flex: none; }
  .reiterleiste .nav-knopf .nav-lang, .reiterleiste .nav-knopf .nav-zahl { display: none; }
  .reiterleiste .nav-knopf .nav-kurz { display: inline; }
  .reiterleiste .reiter-tab[aria-current="page"], .reiterleiste .nav-knopf[aria-pressed="true"], .reiterleiste .reiter-tab[aria-expanded="true"] { background: var(--akzent-wasch); color: var(--akzent-ton); }

  /* „Mehr“: die Seitenleiste als Blatt von unten */
  .seitenleiste {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 41;
    height: auto;
    max-height: 86dvh;
    padding: 10px 12px 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.25);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
  }
  body.mehr-offen .seitenleiste { transform: none; visibility: visible; transition: transform 0.22s ease; }
  body.mehr-offen .mehr-schleier { display: block; position: fixed; inset: 0; z-index: 40; border: 0; padding: 0; background: var(--schleier); }
  .seitenleiste-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; }
  .seitenleiste-kopf h2 { font-size: 1.0625rem; font-weight: 600; }
  .seitenleiste .nav-eintrag, .seitenleiste-werkzeug { min-height: 44px; }

  .meldung { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .update-hinweis { left: 12px; right: 12px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  #umzug-hinweis { bottom: calc(144px + env(safe-area-inset-bottom, 0px)); }

  /* Startseite: „Dokument scannen“ groß vorn, darunter „PDF oder Fotos wählen“ */
  :root { --groesse-h1: 1.625rem; }
  .start-normal, .start-haupt { gap: 22px; }
  .start-kopf { gap: 4px; }
  .start-kopf p { font-size: var(--groesse-text); }
  .start-karte { padding: 0; border: 0; background: transparent; box-shadow: none; }
  .start-zone { flex-direction: column; align-items: stretch; gap: 10px; padding: 0; border: 0; background: none; }
  .start-knoepfe { display: contents; }
  .start-knoepfe > label.knopf { display: none; }
  .start-knoepfe .scan-start {
    order: -1;
    justify-content: flex-start;
    gap: 14px;
    min-height: 72px;
    padding: 12px 16px;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--haupt);
    color: var(--haupt-text);
    text-align: left;
    box-shadow: var(--glow);
  }
  .scan-start:hover:not(:disabled) { border-color: transparent; background: var(--haupt-druck); color: var(--haupt-text); }
  .scan-start .scan-symbol { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: var(--radius-mittel); background: color-mix(in srgb, var(--haupt-text) 16%, transparent); }
  .scan-start .scan-symbol svg { width: 24px; height: 24px; }
  .scan-start .scan-texte { display: grid; line-height: 1.3; }
  .scan-start strong { font-size: 1.0625rem; font-weight: 600; }
  .scan-start small { display: block; font-size: var(--groesse-klein); font-weight: 400; opacity: 0.85; }
  .start-ablage {
    flex: none;
    align-items: center;
    gap: 14px;
    min-height: 60px;
    padding: 10px 16px;
    border: 1px solid var(--linie);
    border-radius: var(--radius-xl);
    background: var(--flaeche);
    box-shadow: var(--schatten);
  }
  .start-ablage:hover { background: var(--flaeche); }
  .start-ablage:focus-within { outline-offset: 2px; }
  .start-ablage .ablage-symbol { width: 40px; height: 40px; border-radius: 11px; }
  .start-ablage .ablage-symbol svg { width: 20px; height: 20px; }
  .start-ablage .ablage-text strong { font-size: var(--groesse-text); }
  .start-ablage .ablage-zusatz { display: none; }
  .start-unten { padding: 2px 2px 0; }
  .start-unten > span:first-child { display: none; }
  .beispiele { margin-left: 0; }
  .aufgaben-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .aufgabe { gap: 10px; padding: 14px; }
  .aufgabe-symbol { width: 32px; height: 32px; border-radius: 9px; }
  .aufgabe-text small { display: none; }
  .aufgaben-kopf h2 { color: var(--tinte-2); }
  .aufgaben-kopf p { display: none; }
  .liste-karte > .block-kopf { padding: 12px 14px; }
}

/* ─────────────────────────── Telefon und Tablet hochkant: Werkzeuge ─────────────────────────── */

@media (max-width: 820px) {
  body[data-ansicht="werkzeug"] { --kopf-hoehe: 56px; }
  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"] #drucken-datei,
  body[data-ansicht="werkzeug"] .trenner-senkrecht { display: none; }
  body[data-ansicht="werkzeug"] .update-hinweis { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  body[data-ansicht="werkzeug"] #umzug-hinweis { bottom: calc(152px + env(safe-area-inset-bottom, 0px)); }
  body[data-ansicht="werkzeug"] .marke { min-width: 44px; min-height: 44px; justify-content: center; }
  .dateileiste { gap: 4px; }
  .dateileiste .datei-name { display: grid; gap: 0; }
  .dateileiste .datei-name small { gap: 0 6px; }
  .dateileiste .datei-name small .datei-meta-text { display: none; }
  .dateileiste .datei-name small .status-pille { padding: 0; background: none; }
  .datei-aktionen > .knopf.leise { width: 44px; min-height: 44px; }
  .speichern-gruppe .knopf.haupt { min-height: 40px; padding-inline: 14px; }
  body[data-ansicht="werkzeug"] .rahmen { grid-template-columns: minmax(0, 1fr); }
  body[data-ansicht="werkzeug"] .arbeitsflaeche { padding: 0 12px 120px; }
  body[data-ansicht="werkzeug"] .arbeitsflaeche > .panel,
  body[data-ansicht="werkzeug"] .arbeitsflaeche > .panel:not(.editor-panel) { padding: 0; }

  /* 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(--seitenflaeche);
    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-ton); }
  .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;
    align-items: stretch;
    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: var(--schleier); }
  .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-size: 1.0625rem; font-weight: 600; }
  .leiste-kopf p { color: var(--tinte-2); font-size: var(--groesse-klein); }
  .leiste-gruppe { align-items: stretch; }
  .leiste-gruppe + .leiste-gruppe { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--linie); }
  .leiste-gruppe + .leiste-gruppe::before { display: none; }
  .leiste-titel { display: block; padding: 4px 12px 2px; }
  .reiter {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 56px;
    padding: 6px 12px;
    font-size: var(--groesse-text);
    text-align: left;
  }
  .reiter::after { display: none; }
  .reiter-text { display: grid; }
  .reiter svg { width: 22px; height: 22px; padding: 9px; box-sizing: content-box; border-radius: var(--radius); background: var(--akzent-wasch); color: var(--akzent-ton); }
  .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(--hover); box-shadow: none; }

  /* 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;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 10px calc(12px + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: 0 -10px 30px 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 { flex-direction: column; gap: 3px; min-width: 70px; min-height: 58px; padding: 4px 6px; border-radius: var(--radius-mittel); font-size: 0.75rem; }
  .werkzeug svg { width: 22px; height: 22px; }
  .editor-huelle { justify-items: center; }
  .werkzeug-hinweis { justify-self: center; justify-content: center; margin-bottom: 4px; box-shadow: var(--schatten); }
  body[data-ansicht="werkzeug"] .panel-kopf h2 { font-size: 1.1875rem; }
  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 { justify-self: stretch; max-height: none; min-height: 0; padding: 10px; }
  .editor-huelle > .werkzeugzeile { justify-self: stretch; box-shadow: none; }

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

  /* Ablage: einspaltig, Baum als aufklappbare Zeile mit dem aktuellen Ordner */
  .ablage-raster { grid-template-columns: minmax(0, 1fr); }
  .ablage-baum-huelle > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px; border-radius: 8px; font-weight: 600; list-style: none; cursor: pointer; }
  .ablage-baum-huelle > summary::-webkit-details-marker { display: none; }
  .ablage-baum-huelle > summary svg { width: 18px; height: 18px; flex: none; color: var(--akzent-ton); }
  .ablage-baum-huelle > summary svg:last-child { margin-left: auto; color: var(--tinte-2); }
  .ablage-baum-huelle[open] > summary { margin-bottom: 6px; border-bottom: 1px solid var(--linie); border-radius: 0; }
  .ablage-pfad ol { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .ablage-werkzeuge .feld { max-width: none; }
  .karte { padding: 18px; }
}

@media (max-width: 640px) {
  .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: 64px; }
  .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; }
}

/* Direktlink aus Dash (#versendet/<id>) */
.versendet-eintrag.hervorgehoben { outline: 2px solid var(--fokus-farbe); outline-offset: 2px; border-radius: 8px; }

/* ─────────── Angeheftet (Startseite) und Stecknadel (Ablage) ─────────── */

.angeheftet {
  border-color: var(--akzent-rand);
  background: linear-gradient(var(--akzent-wasch), var(--flaeche) 80%);
}
.angeheftet h2 { display: flex; align-items: center; gap: 8px; font-size: var(--groesse-h3); font-weight: 600; }
.angeheftet h2 svg { width: 18px; height: 18px; color: var(--akzent-ton); }
.angeheftet .block-kopf { flex-wrap: wrap; justify-content: flex-start; column-gap: 14px; }
.angeheftet .block-kopf .hinweis { font-size: var(--groesse-klein); }
.angeheftet-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.angeheftet-eintrag {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-mittel);
  background: var(--flaeche);
  box-shadow: var(--lichtkante);
}
.angeheftet-oeffnen {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 1px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.angeheftet-oeffnen:hover { background: var(--hover); }
.angeheftet-oeffnen .datei-titel-text { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.angeheftet-oeffnen small { overflow: hidden; color: var(--tinte-2); font-size: var(--groesse-klein); text-overflow: ellipsis; white-space: nowrap; }
.angeheftet-pfad { display: flex; align-items: center; gap: 4px; }
.angeheftet-pfad svg { flex: none; width: 14px; height: 14px; }
.angeheftet-erledigt { flex: none; }
.angeheftet-erledigt svg { width: 16px; height: 16px; }
.nadel-knopf[aria-pressed="true"] { color: var(--akzent-ton); }
.nadel-knopf[aria-pressed="true"] .nadel-kopf { fill: currentColor; }

/* ─────────── Ansehen: alle Seiten zum Durchscrollen ─────────── */

.leinwand.durchscrollen { display: block; overflow: auto; overscroll-behavior: contain; }
.seiten-stapel { display: grid; justify-items: safe center; gap: 16px; }
.seiten-platz {
  position: relative;
  background: #fff;
  border-radius: 2px;
  box-shadow: var(--papier-schatten);
}
/* Bis zum Neuzeichnen nach einem Größenwechsel füllt die alte Leinwand den Platzhalter. */
.seiten-platz canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; box-shadow: none; }

/* ─────────── Schritt 2: Zoomleiste (js/zoomleiste.js) ─────────── */

.zoom-gruppe { display: inline-flex; align-items: center; gap: 2px; }
.zoom-wahl { position: relative; display: inline-flex; }
.zoom-prozent, .zoom-einpassen {
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-klein);
  background: transparent;
  cursor: pointer;
}
.zoom-prozent { min-width: 56px; padding: 0 6px; color: var(--tinte); font-family: var(--schrift-mono); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.zoom-einpassen { padding: 0 10px; color: var(--tinte-2); font-size: 0.75rem; font-weight: 500; }
.zoom-prozent:hover, .zoom-einpassen:hover, .zoom-prozent[aria-expanded="true"] { background: var(--hover); color: var(--tinte); }
.zoom-einpassen[aria-pressed="true"] { color: var(--akzent-ton); }
.zoom-menue { top: calc(100% + 8px); right: auto; left: 50%; width: 180px; transform: translateX(-50%); white-space: nowrap; }
.editor-huelle .zoom-menue { top: auto; bottom: calc(100% + 10px); }
.zoom-stufe { min-height: 36px; padding: 6px 12px; align-items: center; font-size: var(--groesse-klein); }
.zoom-stufe[aria-checked="true"] { color: var(--akzent-ton); font-weight: 600; }
.zoom-stufe[aria-checked="true"]::after { content: "✓" / ""; margin-left: auto; }
@media (pointer: coarse) { .zoom-prozent, .zoom-einpassen { min-height: 44px; } }

/* ─────────── Schritt 2: Pfad und Befehle im Editorkopf ─────────── */

.dateileiste .datei-name { align-items: center; }
.datei-pfad { display: flex; min-width: 0; }
.datei-pfad ol { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; padding: 0; list-style: none; color: var(--tinte-3); font-size: var(--groesse-klein); }
.datei-pfad li { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 0 2 auto; }
.datei-pfad li + li::before { content: "/" / ""; flex: none; color: var(--tinte-3); }
.datei-pfad li.pfad-datei { flex: 0 1 auto; }
.pfad-teil { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tinte-2); }
.pfad-link { border-radius: 4px; text-decoration: none; }
.pfad-link:hover { color: var(--tinte); text-decoration: underline; text-underline-offset: 3px; }
.pfad-aus { cursor: help; }
.datei-pfad .datei-titel-text { color: var(--tinte); font-size: var(--groesse-text); }
.datei-aktionen > .knopf.befehle-knopf {
  width: auto;
  gap: 10px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--linie);
  border-radius: 9px;
  background: var(--flaeche);
  color: var(--tinte-2);
  font-size: var(--groesse-klein);
  font-weight: 400;
  box-shadow: var(--lichtkante);
}
.datei-aktionen > .knopf.befehle-knopf svg { width: 15px; height: 15px; }
.datei-aktionen > .knopf.befehle-knopf:hover:not(:disabled) { border-color: var(--linie-2); background: var(--flaeche); color: var(--tinte); }
.befehle-trenner { margin: 0 4px; }
.befehle-lupe { display: none; }
@media (max-width: 1180px) {
  .datei-aktionen > .knopf.befehle-knopf { width: 36px; padding: 0; justify-content: center; }
  .datei-aktionen > .knopf.befehle-knopf > :not(svg) { display: none; }
}
@media (max-width: 820px) {
  .datei-pfad li:not(.pfad-datei) { display: none; }
  .datei-pfad li + li::before { content: none; }
  .datei-aktionen > .knopf.befehle-knopf { width: 44px; min-height: 44px; border: 0; background: transparent; box-shadow: none; }
}
@media (max-width: 420px) {
  body[data-ansicht="werkzeug"] .kopf .datei-aktionen > .knopf.befehle-knopf { width: 40px; }
}
/* Touch und schmale Bildschirme: keine Tastenhinweise; „Esc“ wird zum Kreuz */
.befehle-zu > svg { display: none; width: 20px; height: 20px; color: var(--tinte-2); }
@media (hover: none), (max-width: 767px) {
  .befehl > kbd, .seitenleiste-suche kbd, .befehle-knopf kbd, .datei-oeffnen-kopf kbd, .befehle-zu > kbd { display: none; }
  .befehle-zu > svg { display: block; }
}
/* Telefon: Der Name des Werkzeugs steht schon in der Werkzeugwahl oben – die Überschrift bleibt für Vorleser. */
@media (max-width: 820px) {
  .editor-panel > .panel-kopf { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 767px) {
  body[data-ansicht]:not([data-ansicht="werkzeug"]) .befehle-lupe { display: grid; }
}

/* ─────────── Schritt 2: Befehlsfenster (js/befehle.js) ─────────── */

.befehle-huelle { position: fixed; inset: 0; z-index: 60; }
.befehle-schleier { position: absolute; inset: 0; background: var(--schleier); }
.befehle {
  position: absolute;
  top: 96px;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 128px);
  overflow: hidden;
  border: 1px solid var(--linie-2);
  border-radius: var(--radius-xl);
  background: var(--erhoeht);
  box-shadow: var(--schatten-xl);
  transform: translateX(-50%);
}
.befehle-kopf { display: flex; flex: none; align-items: center; gap: 12px; height: 56px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--linie); }
.befehle-kopf:focus-within { box-shadow: inset 0 -2px 0 var(--fokus-farbe); }
.befehle-kopf > svg { flex: none; width: 18px; height: 18px; color: var(--tinte-3); }
.befehle-eingabe { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--tinte); font-size: 1rem; outline: none; }
.befehle-eingabe::placeholder { color: var(--tinte-3); opacity: 1; }
.befehle-zu { display: grid; place-items: center; min-width: 44px; min-height: 36px; padding: 0; border: 0; border-radius: var(--radius-klein); background: transparent; cursor: pointer; }
.befehle-zu:hover kbd { border-color: var(--linie-2); color: var(--tinte); }
.befehle-liste { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px; scrollbar-width: thin; }
.befehle-gruppe-titel { padding: 10px 10px 4px; color: var(--tinte-3); font-size: 0.75rem; font-weight: 500; }
.befehl { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: var(--radius); cursor: pointer; }
.befehl[aria-selected="true"] { background: var(--hover); box-shadow: inset 2px 0 0 var(--akzent); }
.befehl-symbol { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-klein); background: var(--hover); color: var(--tinte-2); }
.befehl[aria-selected="true"] .befehl-symbol { background: var(--akzent-wasch); color: var(--akzent-ton); }
.befehl-symbol svg { width: 16px; height: 16px; }
.befehl-texte { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.befehl-name, .befehl-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.befehl-name { font-weight: 500; }
.befehl-text { color: var(--tinte-3); font-size: 0.75rem; }
.befehl > kbd { flex: none; }
.befehle-leer { padding: 18px 12px; color: var(--tinte-2); }
.befehle-fuss { display: flex; flex: none; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte-3); font-size: 0.75rem; }
.befehle-fuss kbd { padding: 0 5px; }
@media (max-width: 767px) {
  .befehle { top: 0; left: 0; width: 100%; max-height: 85dvh; border-width: 0 0 1px; border-radius: 0 0 var(--radius-xl) var(--radius-xl); transform: none; }
  .befehle-kopf { height: 60px; padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box; }
  .befehle-fuss { display: none; }
  .befehl { min-height: 52px; }
}

/* Übersicht „Tastenkürzel“ (Dialog) */
.tasten-uebersicht { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 16px 28px; }
.tasten-gruppe h3 { margin: 0 0 8px; color: var(--tinte-2); font-size: var(--groesse-klein); font-weight: 600; }
.tasten-liste { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 12px; margin: 0; font-size: var(--groesse-klein); }
.tasten-liste dt { display: flex; flex-wrap: wrap; gap: 4px; }
.tasten-liste dd { margin: 0; color: var(--tinte-2); }

/* ─────────── Schritt 2: Reiter Werkzeug · Seite · Dokument (js/eigenschaften.js) ─────────── */

.eigenschaften-reiter-huelle { flex: none; }
.eigenschaften-reiter { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--hover); }
.eigenschaften-reiter-knopf {
  flex: 1;
  min-height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-klein);
  background: transparent;
  color: var(--tinte-2);
  font-size: var(--groesse-klein);
  cursor: pointer;
}
.eigenschaften-reiter-knopf:hover { color: var(--tinte); }
.eigenschaften-reiter-knopf[aria-selected="true"] { background: var(--erhoeht); color: var(--tinte); font-weight: 500; box-shadow: 0 1px 2px rgb(12 17 23 / 0.1), 0 0 0 1px rgb(12 17 23 / 0.04), var(--lichtkante); }
@media (pointer: coarse) { .eigenschaften-reiter-knopf { min-height: 40px; } }
.reiter-bereich { display: grid; gap: 14px; min-width: 0; align-content: start; }
.reiter-titel { font-size: var(--groesse-h3); font-weight: 600; letter-spacing: -0.01em; }
.reiter-dateiname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reiter-abschnitt { display: grid; gap: 6px; }
.reiter-abschnitt h3 { color: var(--tinte-2); font-size: 0.75rem; font-weight: 500; }
.angaben {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
  font-size: 0.75rem;
}
.angaben dt { color: var(--tinte-3); }
.angaben dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.angaben .schutz { display: inline-flex; align-items: center; gap: 6px; color: var(--erfolg); font-weight: 500; }
.angaben .schutz svg { width: 13px; height: 13px; flex: none; }
.eintrag-liste { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.eintrag-knopf {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-klein);
  background: transparent;
  color: var(--tinte);
  font-size: var(--groesse-klein);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.eintrag-knopf:hover { background: var(--hover); }
.reiter-bereich > .knopf { justify-self: start; }
.reiter-bereich .knopf svg { width: 16px; height: 16px; }
.reiter-aktionen { display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 961px) {
  /* Reiter bleiben oben stehen, während der Inhalt darunter scrollt */
  .editor-panel .seitenkasten > .eigenschaften-reiter-huelle {
    position: sticky;
    top: -16px;
    z-index: 2;
    margin: -16px -16px 0;
    padding: 12px;
    border-bottom: 1px solid var(--linie);
    background: var(--seitenflaeche);
  }
}

/* ─────────── Schritt 2: Seitenvorschau (js/seitenspalte.js) ─────────── */

.seitenspalte { display: none; }
.seitenspalte-knopf, .seitenspalte-trenner { display: none !important; }
@media (min-width: 1200px) {
  body[data-ansicht="werkzeug"].mit-seitenspalte .rahmen { grid-template-columns: 60px 168px minmax(0, 1fr); }
  body[data-ansicht="werkzeug"].mit-seitenspalte .seitenspalte {
    position: sticky;
    top: var(--kopf-hoehe);
    z-index: 5;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: calc(100dvh - var(--kopf-hoehe));
    overflow-y: auto;
    padding: 14px 16px 24px;
    background: var(--seitenflaeche);
    border-right: 1px solid var(--linie);
    scrollbar-width: thin;
  }
  body[data-ansicht="werkzeug"] .seitenspalte-knopf { display: grid !important; }
  body[data-ansicht="werkzeug"] .seitenspalte-trenner { display: block !important; }
}
.seitenspalte-knopf[aria-pressed="true"] { background: var(--akzent-wasch); color: var(--akzent-ton); }
.seitenspalte-kopf { display: flex; align-items: baseline; justify-content: space-between; }
.seitenspalte-kopf h2 { color: var(--tinte-2); font-size: 0.75rem; font-weight: 500; }
.seitenspalte-zahl { color: var(--tinte-3); font-family: var(--schrift-mono); font-size: 0.75rem; }
.seitenspalte-liste { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0; padding: 0; list-style: none; }
.seiten-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 0;
  border-radius: var(--radius-klein);
  background: transparent;
  color: var(--tinte-3);
  font-size: 0.75rem;
  cursor: pointer;
}
.seiten-blatt { position: relative; display: block; width: 112px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px var(--linie), 0 4px 14px rgb(0 0 0 / 0.2); }
.seiten-blatt canvas { display: block; width: 100% !important; height: 100% !important; border-radius: 3px; }
.seiten-mini:hover .seiten-blatt { box-shadow: 0 0 0 1px var(--linie-2), 0 4px 14px rgb(0 0 0 / 0.22); }
.seiten-mini[aria-current="true"] { color: var(--tinte); }
.seiten-mini[aria-current="true"] .seiten-blatt { box-shadow: 0 0 0 2px var(--akzent), 0 4px 14px rgb(0 0 0 / 0.25); }
.seiten-nr { font-family: var(--schrift-mono); }
.seiten-plakette {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--hinweis);
  color: var(--hinweis-wasch);
  font-size: 0.6875rem;
  font-weight: 700;
}
