/*
 * XShare Designsystem. Eine Datei, feste Reihenfolge (UI-Plan Abschnitt 7):
 * 1 Schriften · 2 Tokens · 3 Reset · 4 Grundelemente · 5 Komponenten · 6 Seiten · 7 Utilities
 *
 * Regeln:
 * - Farben, Abstände, Radien nur über Tokens. Abgeleitete Farben per color-mix(), damit jede Markenfarbe
 *   aus /branding.css ohne Nacharbeit funktioniert.
 * - Keine Element-Selektoren innerhalb von Komponenten (kein „.card p“), jedes Teil hat eine eigene Klasse.
 *   Abstände zwischen Blöcken regeln die Layout-Utilities (.stack, .cluster), nicht die Komponenten selbst.
 * - Neue Komponenten unter „5“, neue Seiten unter „6“ anhängen.
 * - Bewegung nur mit Zweck: Siegel, Kopier-Rückmeldung, Dialog, Toast. Alles aus bei prefers-reduced-motion.
 */

/* ======================================================================
   1 Schriften (OFL, Lizenztexte in fonts/, eingebettet in die Binary)
   ====================================================================== */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/BricolageGrotesque-Bold-Latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/IBMPlexMono-Medium-Latin1.woff2") format("woff2");
}

/* ======================================================================
   2 Tokens
   ====================================================================== */

/* Markenfarben nur auf :root. /branding.css überschreibt sie mit den Werten aus dem Erscheinungsbild.
   --brand-base ist die Markenfarbe, wie sie eingestellt ist. --brand-text ist dieselbe Farbe, abgedunkelt bis sie auf Weiß
   als Schrift mindestens 4,5 : 1 hat (Links, Fokusring). --brand-dark/--brand-dark-ink sind die Varianten für den Dunkelmodus:
   eine dunkle Marke wie der Standard #101B33 wäre auf der dunklen Karte sonst unsichtbar. Alle vier berechnet der Server. */
:root {
  --brand-base: #101B33;
  --brand-base-ink: #FFFFFF;
  --brand-text: #101B33;
  --brand-dark: #728DC5;
  --brand-dark-ink: #0E1420;
  --brand: #101B33;
  --brand-ink: #FFFFFF;
}

/* Hellmodus. Gilt auch für .theme-light-Container (Empfänger-Vorschau in einer dunklen Seite).
   Dort stellt --brand: var(--brand-base) die helle Markenfarbe wieder her, die der Dunkelmodus auf :root ersetzt. */
.theme-light {
  --brand: var(--brand-base);
  --brand-ink: var(--brand-base-ink);
}
:root,
.theme-light {
  color-scheme: light;

  /* 3.1 Farben */
  --surface: #F1F3F6;
  --card: #FFFFFF;
  --line: #D7DCE4;
  --text: #101B33;
  --muted: #5B6577;
  --seal: #A8782B;       /* nur das Siegel, nie für Text */
  --ok: #167A4B;
  --warn: #9A6700;
  --danger: #B42318;

  /* Abgeleitete Farben */
  --line-strong: color-mix(in srgb, var(--line) 60%, var(--muted));
  --surface-sunken: color-mix(in srgb, var(--surface) 70%, var(--line));
  --brand-hover: color-mix(in srgb, var(--brand) 86%, #000);
  --brand-tint: color-mix(in srgb, var(--brand) 7%, var(--card));
  --brand-tint-strong: color-mix(in srgb, var(--brand) 14%, var(--card));
  --brand-link: var(--brand-text);
  --brand-edge: transparent;
  --brand-bar: var(--brand-link);
  --control-on: var(--brand);
  --control-on-ink: var(--brand-ink);
  --danger-ink: #FFFFFF;
  --ok-tint: color-mix(in srgb, var(--ok) 9%, var(--card));
  --warn-tint: color-mix(in srgb, var(--warn) 10%, var(--card));
  --danger-tint: color-mix(in srgb, var(--danger) 8%, var(--card));
  --danger-hover: color-mix(in srgb, var(--danger) 86%, #000);
  --backdrop: rgb(16 27 51 / 0.45);
  --shadow-recipient: 0 8px 32px rgb(16 27 51 / 0.08);
  --shadow-float: 0 12px 40px rgb(16 27 51 / 0.16), 0 2px 6px rgb(16 27 51 / 0.06);
  --toast-bg: #101B33;
  --toast-text: #F1F3F6;

  /* Zeichenfärbung im Geheimnis (UI-Plan 3.2): Ziffern kräftig blau, damit sie sich auch bei dunkler Marke
     deutlich von Buchstaben in --text abheben; Sonderzeichen in --danger. */
  --pw-digit: #1558D6;
  --pw-symbol: var(--danger);
}

:root {
  /* 3.2 Schrift */
  --font-display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --font-text: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --text-13: 13px;
  --text-14: 14px;
  --text-16: 16px;
  --text-20: 20px;
  --text-28: 28px;
  --text-40: 40px;
  --leading: 1.5;
  --leading-tight: 1.3;
  --leading-display: 1.15;
  --secret-size: 22px;
  --secret-tracking: 0.04em;

  /* 3.3 Abstände, Form, Bewegung (Raster 4 px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-card: 12px;
  --radius-control: 8px;
  --radius-small: 6px;
  --radius-pill: 999px;
  --ease-seal: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --duration-seal: 400ms;
  --duration-copy: 150ms;
  --duration-ui: 180ms;
  --focus-color: var(--brand-link);
  --focus-ring: 2px solid var(--focus-color);
  --focus-offset: 2px;

  /* Maße */
  --control-height: 44px;
  --control-height-small: 36px;
  --header-height: 60px;
  --content-width: 1100px;
  --public-width: 520px;
  --auth-width: 400px;
  --seal-size: 96px;
  --z-header: 30;
  --z-menu: 40;
  --z-toast: 60;
}

/* Dunkelmodus folgt dem System, ohne Umschalter. Öffentliche Seiten (html.theme-light) bleiben hell. */
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) {
    color-scheme: dark;
    --surface: #0E1420;
    --card: #161E2E;
    --line: #2A3448;
    --text: #E8ECF2;
    --muted: #9AA5B8;
    --seal: #C9974A;
    --ok: #3FB57A;
    --warn: #E0A526;
    --danger: #F0665C;

    /* Im Dunkelmodus gilt die serverseitig aufgehellte Markenfarbe (--brand-dark aus /branding.css, mindestens 3 : 1
       zur Karte und 5,5 : 1 zu ihrer Schrift). Links und Linien gehen noch etwas Richtung Textfarbe. */
    --brand: var(--brand-dark);
    --brand-ink: var(--brand-dark-ink);
    --brand-link: color-mix(in oklab, var(--brand) 75%, var(--text));
    --brand-edge: transparent;
    --brand-bar: var(--brand-link);
    /* Gewählte Checkboxen, Radios und Segmente: gefüllt mit der aufgehellten Marke, Schrift in Flächenfarbe. */
    --control-on: color-mix(in srgb, var(--brand) 18%, var(--text));
    --control-on-ink: var(--surface);
    --danger-ink: #0E1420;
    --brand-tint: color-mix(in srgb, var(--brand-link) 12%, var(--card));
    --brand-tint-strong: color-mix(in srgb, var(--brand-link) 20%, var(--card));
    --brand-hover: color-mix(in srgb, var(--brand) 80%, #fff);
    --danger-hover: color-mix(in srgb, var(--danger) 85%, #fff);
    --focus-color: var(--brand-link);
    --backdrop: rgb(4 7 12 / 0.65);
    --shadow-float: 0 12px 40px rgb(0 0 0 / 0.5), 0 0 0 1px var(--line);
    --toast-bg: #E8ECF2;
    --toast-text: #101B33;
    --pw-digit: #7EB0FF;
  }
}

/* ======================================================================
   3 Reset
   ====================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}
img,
svg {
  display: block;
  max-width: 100%;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button,
summary {
  cursor: pointer;
}
ul[role="list"],
ol[role="list"] {
  list-style: none;
}
table {
  border-collapse: collapse;
}
[hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ======================================================================
   4 Grundelemente
   ====================================================================== */
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--text-16);
  font-weight: 400;
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}
a {
  color: var(--brand-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
::selection {
  background: color-mix(in srgb, var(--brand-link) 25%, transparent);
}
code,
kbd,
samp {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.92em;
}
kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius-small);
  background: var(--card);
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-28);
  font-weight: 700;
  line-height: var(--leading-display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.display-title {
  font-family: var(--font-display);
  font-size: var(--text-40);
  font-weight: 700;
  line-height: var(--leading-display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.section-title {
  font-size: var(--text-20);
  font-weight: 600;
  line-height: var(--leading-tight);
}
.lead {
  color: var(--muted);
  max-width: 64ch;
  text-wrap: pretty;
}
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: calc(-1 * var(--space-12));
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-control);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 500;
}
.skip-link:focus {
  top: var(--space-2);
}
.noscript-note {
  padding: var(--space-3) var(--space-4);
  background: var(--warn-tint);
  color: var(--text);
  font-size: var(--text-14);
  text-align: center;
}

/* ======================================================================
   5 Komponenten
   ====================================================================== */

/* ---------- .card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-6);
}
.card--flush {
  padding: 0;
  overflow: hidden;
}
.card--raised {
  border-color: transparent;
  box-shadow: var(--shadow-recipient);
}
.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.card--flush .card__head {
  margin: 0;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--line);
}
.card__title {
  font-size: var(--text-20);
  font-weight: 600;
  line-height: var(--leading-tight);
}
.card__subtitle {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-14);
}
.card__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

/* ---------- .btn ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: var(--text-16);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--duration-copy), color var(--duration-copy), border-color var(--duration-copy), box-shadow var(--duration-copy);
}
.btn:hover {
  text-decoration: none;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn--primary {
  background: var(--brand);
  border-color: var(--brand-edge);
  color: var(--brand-ink);
}
.btn--primary:hover {
  background: var(--brand-hover);
}
.btn--secondary {
  background: var(--card);
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--secondary:hover {
  border-color: var(--muted);
  background: var(--brand-tint);
}
.btn--danger {
  background: var(--danger);
  color: var(--danger-ink);
}
.btn--danger:hover {
  background: var(--danger-hover);
}
.btn--danger-quiet {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
}
.btn--danger-quiet:hover {
  background: var(--danger-tint);
  border-color: var(--danger);
}
/* „leise“: Aktionen ohne Gewicht, z. B. in Tabellenzeilen oder „Abbrechen“ */
.btn--ghost {
  background: transparent;
  color: var(--brand-link);
}
.btn--ghost:hover {
  background: var(--brand-tint);
}
.btn--small {
  min-height: var(--control-height-small);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-14);
}
.btn--block {
  width: 100%;
  white-space: normal;
}
.btn--copied,
.btn--copied:hover {
  background: var(--ok-tint);
  border-color: var(--ok);
  color: var(--ok);
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn[aria-busy="true"] {
  color: transparent;
  pointer-events: none;
}
.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--brand-ink);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.btn--secondary[aria-busy="true"]::after,
.btn--ghost[aria-busy="true"]::after {
  border-color: var(--text);
  border-right-color: transparent;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- .field ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field__label {
  font-size: var(--text-14);
  font-weight: 500;
  color: var(--text);
}
.field__optional {
  color: var(--muted);
  font-weight: 400;
}
.field__control {
  position: relative;
  display: flex;
  align-items: stretch;
}
.field__input {
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  font-size: var(--text-16);
  line-height: 1.4;
  transition: border-color var(--duration-copy), box-shadow var(--duration-copy);
}
.field__input:hover {
  border-color: var(--muted);
}
/* Derselbe 2-px-Fokusring wie überall (UI-Plan 3.3), dazu der Rand in Fokusfarbe. */
.field__input:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 1px;
  border-color: var(--focus-color);
}
.field__input:disabled,
.field__input:read-only:not(select) {
  background: var(--surface);
  color: var(--muted);
}
.field__input--mono {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: var(--secret-tracking);
}
.field__input--code {
  max-width: 12ch;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-20);
  letter-spacing: 0.3em;
  text-align: center;
}
.field__input--textarea {
  min-height: 112px;
  resize: vertical;
}
.field__input--select {
  appearance: none;
  padding-right: var(--space-8);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field__control--action .field__input {
  padding-right: 104px;
}
.field__action {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--brand-link);
  font-size: var(--text-14);
  font-weight: 500;
}
.field__action:hover {
  background: var(--brand-tint);
}
.field__hint {
  color: var(--muted);
  font-size: var(--text-13);
  line-height: 1.45;
}
.field__error {
  display: flex;
  gap: 6px;
  color: var(--danger);
  font-size: var(--text-13);
  font-weight: 500;
  line-height: 1.45;
}
.field__error::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--card);
  font-size: 11px;
  font-weight: 600;
}
.field--invalid .field__input {
  border-color: var(--danger);
}
.field--invalid .field__input:focus-visible {
  outline-color: var(--danger);
  border-color: var(--danger);
}
.field--locked .field__label::after {
  content: " · gesperrt";
  color: var(--muted);
  font-weight: 400;
}

/* ---------- .check (Checkbox, Radio) ---------- */
.check {
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: var(--space-3);
  align-items: start;
}
.check__input {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  background: var(--card);
  display: grid;
  place-items: center;
  transition: background-color var(--duration-copy), border-color var(--duration-copy);
}
.check__input[type="radio"] {
  border-radius: 50%;
}
.check__input:hover {
  border-color: var(--muted);
}
.check__input:checked {
  border-color: var(--control-on);
  background: var(--control-on);
}
.check__input[type="checkbox"]:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  margin-top: -2px;
  border-left: 2px solid var(--control-on-ink);
  border-bottom: 2px solid var(--control-on-ink);
  transform: rotate(-45deg);
}
.check__input[type="radio"]:checked {
  background: var(--card);
  box-shadow: inset 0 0 0 5px var(--control-on);
}
.check__input:disabled {
  opacity: 0.5;
}
.check__label {
  font-size: var(--text-16);
  line-height: 1.5;
}
.check__hint {
  grid-column: 2;
  color: var(--muted);
  font-size: var(--text-13);
}

/* ---------- .segmented (Auswahl aus wenigen Werten, z. B. Gültigkeit 1 Std · 24 Std · 3 Tage) ---------- */
.segmented {
  border: 0;
  min-width: 0;
}
.segmented__legend {
  margin-bottom: 6px;
  font-size: var(--text-14);
  font-weight: 500;
}
.segmented__track {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.segmented__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.segmented__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-small);
  color: var(--muted);
  font-size: var(--text-14);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--duration-copy), color var(--duration-copy);
}
.segmented__label:hover {
  color: var(--text);
  background: var(--card);
}
.segmented__input:checked + .segmented__label {
  background: var(--control-on);
  color: var(--control-on-ink);
  box-shadow: 0 1px 2px rgb(16 27 51 / 0.12);
}
.segmented__input:focus-visible + .segmented__label {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.segmented__input:disabled + .segmented__label {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- .radio-card (Schutzart wählen: Titel, Erklärung, optional gesperrt mit Grund) ---------- */
.radio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-3);
  border: 0;
  min-width: 0;
}
.radio-cards__legend {
  grid-column: 1 / -1;
  margin-bottom: -6px;
  font-size: var(--text-14);
  font-weight: 500;
}
.radio-card {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-content: start;
  column-gap: var(--space-3);
  row-gap: 2px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--card);
  cursor: pointer;
  transition: border-color var(--duration-copy), background-color var(--duration-copy), box-shadow var(--duration-copy);
}
.radio-card:hover {
  border-color: var(--muted);
}
.radio-card__input {
  appearance: none;
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--card);
  cursor: inherit;
  transition: box-shadow var(--duration-copy), border-color var(--duration-copy);
}
.radio-card__input:checked {
  border-color: var(--control-on);
  box-shadow: inset 0 0 0 5px var(--control-on);
}
.radio-card__input:focus-visible {
  outline: none;
}
.radio-card:has(.radio-card__input:checked) {
  border-color: var(--control-on);
  background: var(--brand-tint);
  box-shadow: inset 0 0 0 1px var(--control-on);
}
.radio-card:has(.radio-card__input:focus-visible) {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.radio-card:has(.radio-card__input:disabled) {
  cursor: not-allowed;
  background: var(--surface);
}
.radio-card:has(.radio-card__input:disabled) .radio-card__title {
  color: var(--muted);
}
.radio-card__title {
  font-size: var(--text-16);
  font-weight: 500;
  line-height: 1.4;
}
.radio-card__text {
  grid-column: 2;
  color: var(--muted);
  font-size: var(--text-13);
  line-height: 1.45;
}
.radio-card__badge {
  grid-column: 2;
  justify-self: start;
  margin-top: var(--space-1);
}

/* ---------- .switch (Ein/Aus, z. B. „Link per E-Mail schicken“) ---------- */
.switches {
  display: flex;
  flex-direction: column;
  border: 0;
  min-width: 0;
}
.switches__legend {
  font-size: var(--text-14);
  font-weight: 500;
}
.switch {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) 0;
  cursor: pointer;
}
.switch + .switch {
  border-top: 1px solid var(--line);
}
.switch__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.switch__label {
  font-size: var(--text-16);
  font-weight: 500;
}
.switch__hint {
  color: var(--muted);
  font-size: var(--text-13);
}
.switch__input {
  appearance: none;
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  cursor: pointer;
  transition: background-color var(--duration-ui) var(--ease-out);
}
.switch__input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgb(16 27 51 / 0.3);
  transition: transform var(--duration-ui) var(--ease-out);
}
.switch__input:checked {
  background: var(--control-on);
}
.switch__input:checked::after {
  transform: translateX(18px);
  background: var(--control-on-ink);
}
.switch__input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.switch:has(.switch__input:disabled) {
  cursor: not-allowed;
}
.switch:has(.switch__input:disabled) .switch__label {
  color: var(--muted);
}

/* ---------- .password-display (entschlüsseltes Geheimnis: Mono 22 px, Zeichen gefärbt, Kopieren) ---------- */
.password-display {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.password-display__box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.password-display__value {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--secret-size);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: var(--secret-tracking);
  overflow-wrap: anywhere;
  font-variant-ligatures: none;
}
.password-display__value--multiline {
  font-size: var(--text-16);
  white-space: pre-wrap;
}
/* Zeichenfärbung wie in Passwort-Managern (UI-Plan 3.2). Gesetzt im Browser (app.js colorizeSecret), der Server sieht nichts. */
.pw-digit {
  color: var(--pw-digit);
}
.pw-symbol {
  color: var(--pw-symbol);
}
.pw-letter {
  color: var(--text);
}
.pw-space {
  border-radius: 2px;
  background: color-mix(in srgb, var(--warn) 25%, transparent);
}
.password-display__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  color: var(--muted);
  font-size: var(--text-13);
}
.password-display__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ---------- .stat (Kennzahlen in der Kopfzeile) ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: var(--space-3);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
}
.stat__label {
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 500;
}
.stat__value {
  font-size: var(--text-28);
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat__note {
  color: var(--muted);
  font-size: var(--text-13);
}
.stat__note--warn {
  color: var(--warn);
}

/* ---------- .contrast-check (Markenfarbe prüfen, Erscheinungsbild) ---------- */
/* Farben kommen aus --swatch-bg/--swatch-ink. Phase 3 setzt sie beim Tippen per element.style.setProperty (CSSOM, CSP-konform). */
.contrast-check {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
}
.contrast-check__swatch {
  display: grid;
  place-items: center;
  min-height: 72px;
  border-radius: var(--radius-small);
  background: var(--swatch-bg, var(--brand));
  color: var(--swatch-ink, var(--brand-ink));
  box-shadow: inset 0 0 0 1px rgb(16 27 51 / 0.1);
  font-weight: 500;
}
.contrast-check__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.contrast-check__ratio {
  font-size: var(--text-20);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.contrast-check__text {
  color: var(--muted);
  font-size: var(--text-13);
}
.contrast-check--low {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
  background: var(--warn-tint);
}
@media (max-width: 480px) {
  .contrast-check {
    grid-template-columns: 1fr;
  }
}

/* ---------- .icon (Strich-Icons als Inline-SVG, erben die Schriftfarbe) ---------- */
.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--large {
  width: 28px;
  height: 28px;
}

/* ---------- .recipient-step (Schutzschritt auf der Empfängerseite, einer nach dem anderen) ---------- */
.recipient-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.recipient-step__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.recipient-step__title {
  font-size: var(--text-16);
  font-weight: 600;
}
.recipient-step__progress {
  flex: none;
  white-space: nowrap;
  color: var(--muted);
  font-size: var(--text-13);
  font-variant-numeric: tabular-nums;
}
.recipient-step__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}
.recipient-step__resend {
  color: var(--muted);
  font-size: var(--text-13);
}
.recipient-trust {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: var(--text-13);
}
.recipient-trust__summary {
  color: var(--muted);
  list-style: none;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.recipient-trust__summary::-webkit-details-marker {
  display: none;
}
.recipient-trust__text {
  max-width: 44ch;
  margin-top: var(--space-2);
  color: var(--muted);
  text-align: center;
}

/* ---------- .chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.chip--active {
  border-color: var(--brand-link);
  color: var(--brand-link);
}
.chip--opened {
  border-color: color-mix(in srgb, var(--ok) 55%, transparent);
  background: var(--ok-tint);
  color: var(--ok);
}
.chip--expired {
  background: var(--surface);
  color: var(--muted);
}
.chip--expired::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px currentColor;
}
.chip--revoked {
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
  background: var(--danger-tint);
  color: var(--danger);
}
.chip--warn {
  border-color: color-mix(in srgb, var(--warn) 55%, transparent);
  background: var(--warn-tint);
  color: var(--warn);
}
.chip--neutral::before {
  display: none;
}

/* ---------- .notice (Hinweis im Seitenfluss) ---------- */
.notice {
  display: grid;
  grid-template-columns: 4px 1fr;
  column-gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
}
.notice::before {
  content: "";
  grid-row: 1 / span 2;
  border-radius: 2px;
  background: var(--brand-link);
}
.notice__title {
  font-size: var(--text-14);
  font-weight: 600;
}
.notice__text {
  grid-column: 2;
  color: var(--text);
  font-size: var(--text-14);
}
.notice--ok {
  background: var(--ok-tint);
  border-color: color-mix(in srgb, var(--ok) 30%, var(--line));
}
.notice--ok::before {
  background: var(--ok);
}
.notice--warn {
  background: var(--warn-tint);
  border-color: color-mix(in srgb, var(--warn) 30%, var(--line));
}
.notice--warn::before {
  background: var(--warn);
}
.notice--danger {
  background: var(--danger-tint);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}
.notice--danger::before {
  background: var(--danger);
}

/* ---------- .copy (Wert mit Kopierknopf: Link, Token, Passwort) ---------- */
.copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.copy__label {
  font-size: var(--text-14);
  font-weight: 500;
}
.copy__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.copy__value {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: var(--space-2) 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-14);
  letter-spacing: 0.02em;
  white-space: nowrap;
  scrollbar-width: thin;
}
.copy__value--secret {
  font-size: var(--secret-size);
  letter-spacing: var(--secret-tracking);
}
.copy__hint {
  color: var(--muted);
  font-size: var(--text-13);
}

/* ---------- .table (Handy: Karten statt Spalten, Zellen tragen data-label) ---------- */
.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--line);
}
.table-tools__search {
  flex: 1 1 240px;
}
.table-tools__filter {
  flex: 0 1 200px;
}
.table-tools__count {
  margin-left: auto;
  padding-bottom: var(--space-2);
  color: var(--muted);
  font-size: var(--text-13);
  font-variant-numeric: tabular-nums;
}
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  font-size: var(--text-14);
}
.table__head {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.table__head:first-child,
.table__cell:first-child {
  padding-left: var(--space-6);
}
.table__head:last-child,
.table__cell:last-child {
  padding-right: var(--space-6);
}
.table__head--end,
.table__cell--end {
  text-align: right;
}
.table__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 4px;
  margin: -2px -4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
}
.table__sort:hover {
  color: var(--text);
}
.table__sort::after {
  content: "↕";
  opacity: 0.45;
  font-size: 12px;
}
[aria-sort="ascending"] > .table__sort::after {
  content: "↑";
  opacity: 1;
}
[aria-sort="descending"] > .table__sort::after {
  content: "↓";
  opacity: 1;
}
[aria-sort="ascending"] > .table__sort,
[aria-sort="descending"] > .table__sort {
  color: var(--text);
}
.table__row:hover {
  background: color-mix(in srgb, var(--brand-tint) 60%, transparent);
}
.table__cell {
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table__row:last-child .table__cell {
  border-bottom: 0;
}
.table__cell--num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table__cell--nowrap {
  white-space: nowrap;
}
.table__primary {
  display: block;
  font-weight: 500;
  color: var(--text);
}
.table__sub {
  display: block;
  color: var(--muted);
  font-size: var(--text-13);
}
.table__warn {
  color: var(--warn);
  font-weight: 500;
}
.table__actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-1);
}
.table__empty {
  padding: var(--space-8) var(--space-6);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .table-tools {
    padding: var(--space-4);
  }
  .table-tools__count {
    width: 100%;
    margin-left: 0;
    padding-bottom: 0;
  }
  .table--stack,
  .table--stack .table__body,
  .table--stack .table__row,
  .table--stack .table__cell {
    display: block;
  }
  .table--stack .table__header {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .table--stack .table__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
  }
  .table--stack .table__row {
    display: grid;
    grid-template-columns: minmax(96px, auto) 1fr;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--card);
  }
  .table--stack .table__row:hover {
    background: var(--card);
  }
  .table--stack .table__cell,
  .table--stack .table__cell:first-child,
  .table--stack .table__cell:last-child {
    display: contents;
  }
  .table--stack .table__cell::before {
    content: attr(data-label);
    padding: var(--space-1) var(--space-3) var(--space-1) 0;
    color: var(--muted);
    font-size: var(--text-13);
  }
  .table--stack .table__cell > * {
    padding: var(--space-1) 0;
  }
  .table--stack .table__cell--lead::before {
    display: none;
  }
  .table--stack .table__cell--lead > * {
    grid-column: 1 / -1;
    padding-bottom: var(--space-2);
  }
  .table--stack .table__cell--end {
    text-align: left;
  }
  .table--stack .table__cell--end::before {
    display: none;
  }
  .table--stack .table__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--line);
  }
  .table--stack .table__empty-row .table__cell::before {
    display: none;
  }
}

/* ---------- .empty-state ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
}
.empty-state__mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: var(--text-28);
  font-weight: 700;
}
.empty-state__title {
  font-size: var(--text-20);
  font-weight: 600;
  line-height: var(--leading-tight);
}
.empty-state__text {
  max-width: 42ch;
  color: var(--muted);
  text-wrap: pretty;
}
.empty-state__action {
  margin-top: var(--space-2);
}

/* ---------- .tabs (Reiterleiste der Verwaltung) ---------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.tabs__link {
  position: relative;
  padding: var(--space-3) var(--space-3);
  color: var(--muted);
  font-size: var(--text-14);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.tabs__link:hover {
  color: var(--text);
}
.tabs__link[aria-current="page"] {
  color: var(--text);
}
.tabs__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand-bar);
}

/* ---------- .dialog (natives <dialog>: Fokus bleibt im Dialog, Esc schließt) ---------- */
.dialog {
  width: min(480px, calc(100vw - 2 * var(--space-4)));
  max-height: calc(100dvh - 2 * var(--space-8));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-float);
}
.dialog::backdrop {
  background: var(--backdrop);
}
.dialog[open] {
  animation: dialog-in var(--duration-ui) var(--ease-out);
}
.dialog[open]::backdrop {
  animation: fade-in var(--duration-ui) var(--ease-out);
}
.dialog__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
}
.dialog__title {
  font-size: var(--text-20);
  font-weight: 600;
  line-height: var(--leading-tight);
}
.dialog__text {
  color: var(--muted);
}
.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---------- .toast (Rückmeldung nach Aktionen, aria-live) ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: min(440px, calc(100vw - 2 * var(--space-4)));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--radius-control);
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: var(--shadow-float);
  font-size: var(--text-14);
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in var(--duration-ui) var(--ease-out);
}
.toast::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-link);
}
.toast--ok::before {
  background: var(--ok);
}
.toast--warn::before {
  background: var(--warn);
}
.toast--danger::before {
  background: var(--danger);
}
.toast__text {
  flex: 1;
}
.toast__close {
  flex: none;
  padding: var(--space-1) var(--space-2);
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: inherit;
  opacity: 0.7;
  font-size: var(--text-13);
}
.toast__close:hover {
  opacity: 1;
}
.toast--leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--duration-ui), transform var(--duration-ui);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- .seal (Signatur: Siegellack; .seal--broken bricht ihn entlang eines Risses) ---------- */
/* Flacher, matter Lack statt Münze: kein Glanzpunkt, kein Metallrand. Der Rand ist leicht unrund wie gegossener Lack,
   in der Mitte liegt die eingedrückte Prägefläche mit der erhabenen Initiale. Nur Tokens, jede --seal-Farbe funktioniert. */
.seal {
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--seal-size);
  height: var(--seal-size);
  filter: drop-shadow(0 1px 1px rgb(16 27 51 / 0.16)) drop-shadow(0 2px 3px color-mix(in srgb, var(--seal) 22%, transparent));
}
.seal--small {
  --seal-size: 56px;
}
.seal--large {
  --seal-size: 128px;
}
.seal__piece {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  /* Unrunder Rand aus seal-mask.svg (eigene Datei, CSP-konform); ohne Maskenunterstützung bleibt der Kreis. */
  mask: url("seal-mask.svg") center / 100% 100% no-repeat;
  /* Matte Fläche: nur ein weicher Verlauf zum Rand hin, wo der Lack dicker und dunkler ist. Kein Glanzpunkt. */
  background: radial-gradient(closest-side, var(--seal) 0 62%, color-mix(in srgb, var(--seal) 90%, #000) 86%, color-mix(in srgb, var(--seal) 80%, #000));
  transition: transform var(--duration-seal) var(--ease-seal), opacity var(--duration-seal) var(--ease-seal);
}
/* Prägefläche: vom Stempel eingedrückt, oben dunkle, unten helle Kante. */
.seal__piece::before {
  content: "";
  position: absolute;
  inset: 19% 18% 17% 19%;
  border-radius: 49% 51% 53% 47% / 51% 48% 52% 49%;
  background: color-mix(in srgb, var(--seal) 92%, #000);
  box-shadow:
    inset 0 calc(var(--seal-size) * 0.022) calc(var(--seal-size) * 0.03) color-mix(in srgb, var(--seal) 60%, #000),
    inset 0 calc(var(--seal-size) * -0.012) calc(var(--seal-size) * 0.02) color-mix(in srgb, var(--seal) 80%, #fff),
    0 1px 0 color-mix(in srgb, var(--seal) 75%, #fff);
}
/* Zwei gezackte Hälften; a reicht knapp unter b, damit im Ganzen keine helle Naht durch Kantenglättung bleibt.
   Gebrochen wird die Naht zum Riss. */
.seal__piece--a {
  clip-path: polygon(0 0, 53.8% 0, 47.8% 14%, 55.8% 29%, 45.8% 47%, 54.8% 63%, 47.8% 81%, 51.8% 100%, 0 100%);
}
.seal__piece--b {
  clip-path: polygon(53% 0, 100% 0, 100% 100%, 51% 100%, 47% 81%, 54% 63%, 45% 47%, 55% 29%, 47% 14%);
}
.seal__initial {
  position: relative;
  font-family: var(--font-display);
  font-size: calc(var(--seal-size) * 0.36);
  font-weight: 700;
  line-height: 1;
  color: color-mix(in srgb, var(--seal) 88%, #fff);
  text-shadow: 0 -1px 0 color-mix(in srgb, var(--seal) 60%, #000), 0 1px 0 color-mix(in srgb, var(--seal) 60%, #fff);
  user-select: none;
}
/* Gebrochen: die Hälften weichen nur ein Stück auseinander, der Spalt liest sich als Riss im Lack. */
.seal--broken .seal__piece--a {
  transform: translate(-5%, 2%) rotate(-6deg);
}
.seal--broken .seal__piece--b {
  transform: translate(5%, -1%) rotate(5deg);
}
.seal--spent .seal__piece {
  filter: grayscale(0.6) brightness(0.97);
  opacity: 0.75;
}

/* ---------- .menu (Aufklappmenü per <details>, app.js schließt bei Esc und Klick daneben) ---------- */
.menu {
  position: relative;
}
.menu__summary {
  list-style: none;
}
.menu__summary::-webkit-details-marker {
  display: none;
}
.menu__caret {
  width: 0;
  height: 0;
  margin-left: 6px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform var(--duration-copy);
}
.menu[open] .menu__caret {
  transform: rotate(180deg);
}
.menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
  box-shadow: var(--shadow-float);
  animation: dialog-in var(--duration-copy) var(--ease-out);
}
.menu--end .menu__panel {
  left: auto;
  right: 0;
}
.menu__heading {
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--muted);
  font-size: var(--text-13);
}
.menu__form {
  display: contents;
}
.menu__item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text);
  font-size: var(--text-14);
  text-align: left;
  text-decoration: none;
}
.menu__item:hover,
.menu__item:focus-visible {
  background: var(--brand-tint);
  text-decoration: none;
}
.menu__item[aria-current="page"] {
  color: var(--brand-link);
  font-weight: 500;
}
.menu__item--danger {
  color: var(--danger);
}
.menu__divider {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--line);
}

/* ---------- .avatar (Initialen im Benutzermenü) ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-tint-strong);
  color: var(--brand-link);
  font-size: var(--text-13);
  font-weight: 600;
}

/* ---------- .skeleton (Ladezustand) ---------- */
.skeleton {
  display: block;
  height: 1em;
  border-radius: var(--radius-small);
  background: linear-gradient(90deg, var(--surface-sunken) 0 40%, var(--surface) 50%, var(--surface-sunken) 60% 100%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton--short {
  width: 60%;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

/* ---------- .recipient-card (Empfängerkarte, auch als Live-Vorschau in Neue Freigabe und Erscheinungsbild) ---------- */
.recipient-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-8);
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-recipient);
}
.recipient-card__logo {
  max-height: 40px;
  width: auto;
}
.recipient-card__brand {
  font-family: var(--font-display);
  font-size: var(--text-20);
  font-weight: 700;
  line-height: 1;
}
.recipient-card__sender {
  color: var(--muted);
  font-size: var(--text-14);
}
.recipient-card__title {
  margin-top: calc(-1 * var(--space-3));
  font-family: var(--font-display);
  font-size: var(--text-40);
  font-weight: 700;
  line-height: var(--leading-display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.recipient-card__label {
  font-size: var(--text-20);
  font-weight: 500;
  line-height: var(--leading-tight);
}
.recipient-card__meta {
  margin-top: calc(-1 * var(--space-3));
  color: var(--muted);
  font-size: var(--text-14);
}
.recipient-card__seal {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-6) 0 var(--space-2);
}
.recipient-card__note {
  color: var(--muted);
  font-size: var(--text-14);
  text-wrap: pretty;
}
.recipient-card--preview {
  padding: var(--space-6);
}
.recipient-card--preview .recipient-card__title {
  font-size: var(--text-28);
}

/* ======================================================================
   6 Seiten
   ====================================================================== */

/* ---------- Backend-Rahmen ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-top: 3px solid var(--brand-bar);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
}
.app-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  max-width: var(--content-width);
  min-height: calc(var(--header-height) - 4px);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  color: var(--text);
  text-decoration: none;
}
.wordmark:hover {
  text-decoration: none;
}
.wordmark__logo {
  height: 28px;
  width: auto;
}
.wordmark__text {
  font-family: var(--font-display);
  font-size: var(--text-20);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}
.app-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.app-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: var(--text-14);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.app-nav__link:hover {
  color: var(--text);
  background: var(--brand-tint);
  text-decoration: none;
}
.app-nav__link--active,
.app-nav__link[aria-current="page"] {
  color: var(--brand-link);
  background: var(--brand-tint);
}
.app-nav__user {
  gap: var(--space-2);
  padding-left: var(--space-1);
  color: var(--text);
}
.app-header__end {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* Handy-Menü: eigener Knopf, Navigation als Panel unter der Kopfleiste. */
.nav-drawer {
  display: none;
}
.nav-drawer__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  font-size: var(--text-14);
  font-weight: 500;
  list-style: none;
}
.nav-drawer__toggle::-webkit-details-marker {
  display: none;
}
.nav-drawer__icon {
  position: relative;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
  transition: transform var(--duration-copy), box-shadow var(--duration-copy);
}
.nav-drawer[open] .nav-drawer__icon {
  transform: rotate(45deg);
  box-shadow: none;
}
.nav-drawer[open] .nav-drawer__icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(90deg);
}
/* absolut zur sticky Kopfleiste (.app-header ist der nächste positionierte Vorfahr) */
.nav-drawer__panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  padding: var(--space-3) var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-float);
}
.nav-drawer__link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-control);
  color: var(--text);
  font-size: var(--text-16);
  font-weight: 500;
  text-decoration: none;
}
.nav-drawer__link:hover {
  background: var(--brand-tint);
}
.nav-drawer__link[aria-current="page"] {
  color: var(--brand-link);
  background: var(--brand-tint);
}
.nav-drawer__group {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-1);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-13);
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-12);
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}
.page-head__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

@media (max-width: 860px) {
  .app-nav,
  .app-header__end .menu {
    display: none;
  }
  .nav-drawer {
    display: block;
    margin-left: auto;
  }
  .app-header__inner {
    gap: var(--space-3);
  }
}
@media (max-width: 560px) {
  .app-main {
    gap: var(--space-4);
    padding: var(--space-6) var(--space-4) var(--space-12);
  }
  .card {
    padding: var(--space-4);
  }
  .card--flush {
    padding: 0;
  }
  .card--flush .card__head {
    padding: var(--space-4);
  }
  .page-head__actions,
  .page-head__actions .btn {
    width: 100%;
  }
}

/* ---------- Öffentlicher Rahmen (Empfängerseite, Anmeldung, Fehler) ---------- */
.public-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: calc(var(--public-width) + 2 * var(--space-4));
  margin: 0 auto;
  padding: var(--space-12) var(--space-4);
}
.public-main--narrow {
  max-width: calc(var(--auth-width) + 2 * var(--space-4));
}
.public-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-8);
}
.public-card__brand {
  margin-bottom: var(--space-2);
}
.public-card__logo {
  max-height: 40px;
  width: auto;
}
.public-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1) var(--space-2);
  color: var(--muted);
  font-size: var(--text-13);
}
.public-footer__item + .public-footer__item::before {
  content: "·";
  margin-right: var(--space-2);
}
.public-footer__link {
  color: var(--muted);
}
@media (max-width: 560px) {
  .public-main {
    padding: var(--space-4);
  }
  .public-card,
  .recipient-card {
    padding: var(--space-6) var(--space-4);
  }
  .display-title,
  .recipient-card__title {
    font-size: var(--text-28);
  }
}

/* ---------- Empfängerseite ---------- */
.recipient-opened {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.recipient-opened__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.recipient-opened__when {
  color: var(--muted);
  font-size: var(--text-14);
}

/* ---------- Komponentenübersicht (Startseite in Phase 0) ---------- */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--space-6);
}
.showcase-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.showcase-group__label {
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 500;
}
.showcase-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: var(--space-6);
  align-items: start;
}
.showcase-preview {
  padding: var(--space-6);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.showcase-seals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8);
}
.showcase-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted);
  font-size: var(--text-13);
}
/* Nur für die Übersicht: eine absichtlich zu helle Markenfarbe, damit die Kontrastwarnung sichtbar ist. */
.contrast-check--sample-yellow {
  --swatch-bg: #FFD400;
  --swatch-ink: #FFFFFF;
}
.showcase-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.hero-intro {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
@media (max-width: 560px) {
  .showcase-preview {
    padding: var(--space-3);
  }
}
@media (max-width: 900px) {
  .showcase-split {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 560px) {
  .hero-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
}

/* === Phase 1: Konten === */

/* ---------- Anmeldung, 2FA, Einladung, Passwort (im öffentlichen Rahmen) ---------- */
.auth {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.auth__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.auth__eyebrow {
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.auth__lead {
  color: var(--muted);
  text-wrap: pretty;
}
.auth__account {
  font-family: var(--font-mono);
  font-size: var(--text-14);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.auth__mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--brand-tint);
  color: var(--brand-link);
}
.auth__mark--muted {
  background: var(--surface-sunken);
  color: var(--muted);
}
.auth__mark--ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.auth__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.auth__static {
  padding: var(--space-2) 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.auth__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-14);
}
.auth__link {
  font-weight: 500;
}
.auth__fine {
  color: var(--muted);
  font-size: var(--text-13);
  text-align: center;
  text-wrap: pretty;
}
.auth__switch {
  display: flex;
  justify-content: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

/* ---------- Stärke eines neuen Passworts: Linie mit vier Stufen, keine Ampelwörter ---------- */
.new-password {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.strength {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.strength__track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}
.strength__bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-link);
  transition: width var(--duration-ui) var(--ease-out);
}
.strength__bar[data-level="1"] {
  width: 25%;
  background: var(--muted);
}
.strength__bar[data-level="2"] {
  width: 50%;
}
.strength__bar[data-level="3"] {
  width: 75%;
}
.strength__bar[data-level="4"] {
  width: 100%;
  background: var(--ok);
}
/* Vor der ersten Eingabe keine leere Linie und keinen Leerraum zeigen. */
.strength--idle {
  display: none;
}
.strength__note {
  min-height: 1.5em;
  color: var(--muted);
  font-size: var(--text-13);
}

/* ---------- Mein Konto ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  align-items: start;
}
.facts {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-4);
  border-top: 1px solid var(--line);
}
.facts__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-14);
}
.facts__row:last-child {
  border-bottom: 0;
}
.facts__term {
  color: var(--muted);
}
.facts__value {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.facts__value--warn {
  color: var(--warn);
}
.account-sessions__empty {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-14);
}
@media (max-width: 900px) {
  .account-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- 2FA einrichten und Wiederherstellungscodes ---------- */
.auth--wide {
  gap: var(--space-8);
}
.setup-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 760px;
}
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.setup-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--space-4);
}
.setup-step__num {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--brand-ink);
  font-size: var(--text-14);
  font-weight: 600;
}
.setup-step__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.setup-step__title {
  font-size: var(--text-16);
  font-weight: 600;
  line-height: 32px;
}
.setup-step__text {
  color: var(--muted);
  font-size: var(--text-14);
}
.setup-step__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 360px;
}
.auth--wide .setup-step__form {
  max-width: none;
}
.qr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-6);
}
/* QR-Codes brauchen dunkle Module auf hellem Grund, auch im Dunkelmodus; .theme-light liefert die hellen Tokens. */
.qr__code {
  flex: none;
  width: 184px;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
}
.qr__svg {
  width: 100%;
  height: auto;
}
.qr__bg {
  fill: var(--card);
}
.qr__fg {
  fill: var(--text);
}
.qr__manual {
  flex: 1 1 220px;
  min-width: 0;
}
/* Der Schlüssel hat 39 Zeichen in Mono und würde sonst über den Kartenrand laufen. */
.qr__manual .copy__value {
  white-space: normal;
  overflow-wrap: anywhere;
}
.auth--wide .qr {
  flex-direction: column;
  align-items: stretch;
}
.auth--wide .qr__manual {
  flex: none;
}
.auth--wide .qr__code {
  align-self: center;
}
.codes {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-sunken);
}
.codes__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-16);
  font-weight: 500;
  letter-spacing: var(--secret-tracking);
  font-variant-numeric: tabular-nums;
  counter-reset: code;
}
.codes__item {
  counter-increment: code;
}
.codes__item::before {
  content: counter(code, decimal-leading-zero) " ";
  color: var(--muted);
  font-size: var(--text-13);
}
.codes__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}
@media (max-width: 380px) {
  .codes__list {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media print {
  .codes__actions {
    display: none;
  }
}

/* === Phase 2: Freigaben === */

/* ---------- Empfängerseite /s/{id} ---------- */
.recipient,
.recipient__view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.recipient__seal {
  display: inline-grid;
}
.recipient-step__text {
  color: var(--muted);
  font-size: var(--text-14);
}
.recipient-step__error {
  color: var(--danger);
  font-size: var(--text-14);
}
.recipient-step-done {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  background: var(--ok-tint);
  color: var(--ok);
  font-size: var(--text-14);
  font-weight: 500;
}
.recipient-gone {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.recipient-gone__text {
  color: var(--muted);
  font-size: var(--text-14);
}
.recipient-error {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-2) 0 var(--space-4);
}
.recipient-error__mark {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--warn-tint);
  color: var(--warn);
}
.recipient-error__mark--danger {
  background: var(--danger-tint);
  color: var(--danger);
}
.recipient-error__text {
  color: var(--muted);
  text-wrap: pretty;
}
.recipient-error .display-title:focus {
  outline: none;
}

/* ---------- Freigaben (Liste) ---------- */
.share-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-6);
}
.share-list-empty__alt {
  font-size: var(--text-14);
}
.table-tools__scope {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 0 1 280px;
  padding-bottom: var(--space-1);
}
.share-list__nolink {
  max-width: 22ch;
  color: var(--muted);
  font-size: var(--text-13);
  line-height: var(--leading-tight);
  cursor: help;
}

/* ---------- Neue Freigabe ---------- */
.share-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: var(--space-6);
  align-items: start;
}
.share-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.share-form__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: 0 0 var(--space-6);
  border: 0;
  border-bottom: 1px solid var(--line);
}
.share-form__legend {
  margin-bottom: var(--space-4);
  font-size: var(--text-20);
  font-weight: 600;
  line-height: var(--leading-tight);
}
.share-form__tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: calc(-1 * var(--space-2));
}
.share-form__advice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-14);
}
.share-form__submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.share-form__status {
  color: var(--muted);
  font-size: var(--text-14);
}
.share-preview {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.share-preview__title {
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 500;
}
.share-preview__frame {
  padding: var(--space-6);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.share-preview__placeholder {
  color: var(--muted);
}
.share-preview__step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: var(--text-14);
}
.share-preview__button {
  pointer-events: none;
}
.share-preview__hint {
  color: var(--muted);
  font-size: var(--text-13);
}
@media (max-width: 900px) {
  .share-compose {
    grid-template-columns: minmax(0, 1fr);
  }
  .share-preview {
    position: static;
  }
}
@media (max-width: 560px) {
  .share-preview__frame {
    padding: var(--space-3);
  }
}

/* ---------- Ergebnisseite ---------- */
.share-result__head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.share-result__mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ok-tint);
  color: var(--ok);
}
.share-snippet {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.share-snippet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.share-snippet__text {
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-family: var(--font-text);
  font-size: var(--text-14);
  line-height: var(--leading);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* === Phase 4: MCP === */

/* ---------- MCP-Verbindung ---------- */
.mcp-about {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-6) var(--space-8);
}
.mcp-about__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.mcp-about__lead {
  max-width: 62ch;
  color: var(--text);
  line-height: var(--leading);
}
.mcp-tools {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: var(--space-6);
  border-left: 1px solid var(--line);
}
.mcp-tools__title {
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 600;
}
.mcp-tools__list {
  display: flex;
  flex-direction: column;
}
.mcp-tools__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
}
.mcp-tools__row:last-child {
  border-bottom: 0;
}
.mcp-tools__name {
  color: var(--brand-link);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-14);
}
.mcp-tools__text {
  color: var(--muted);
  font-size: var(--text-13);
}
.mcp-new {
  border-color: var(--ok);
}
.mcp-new__head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.mcp-new__mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ok-tint);
  color: var(--ok);
}
.mcp-code {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.mcp-code__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.mcp-code__block {
  padding: var(--space-4);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-13);
  line-height: var(--leading);
  white-space: pre;
  scrollbar-width: thin;
}
.mcp-code__block--wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 900px) {
  .mcp-about {
    grid-template-columns: minmax(0, 1fr);
  }
  .mcp-tools {
    padding-left: 0;
    padding-top: var(--space-4);
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* === Phase 3: Verwaltung === */

/* ---------- Rahmen der Verwaltungsseiten ---------- */
.admin-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.admin-head__eyebrow {
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.admin-tabs {
  margin-top: var(--space-4);
}
.admin-empty {
  padding: var(--space-6);
}
/* Kennzahlen der Verwaltung sind kurz: auf dem Handy zwei nebeneinander statt vier untereinander. */
.admin .stats {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}
.inline-form {
  display: contents;
}
.table__row--muted .table__primary,
.table__row--muted .table__sub {
  color: var(--muted);
}
/* Mit Logo ersetzt das Bild den Schriftzug in der Kopfleiste; der Name bleibt für Screenreader. Auf dunkler Kopfleiste
   liegt das Logo auf einer hellen Fläche, weil Kundenlogos meist für hellen Grund gemacht sind. */
.wordmark:has(.wordmark__logo) .wordmark__text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) .wordmark__logo {
    padding: 3px 8px;
    border-radius: var(--radius-small);
    background: var(--text);
  }
}
.invite-result {
  border-color: color-mix(in srgb, var(--ok) 40%, var(--line));
  border-top: 4px solid var(--ok);
}

/* ---------- Erscheinungsbild ---------- */
.brand-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: var(--space-6);
  align-items: start;
}
.brand-form__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3) var(--space-4);
}
.color-field__row {
  display: flex;
  gap: var(--space-2);
}
.color-field__picker {
  flex: none;
  width: var(--control-height);
  height: var(--control-height);
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--card);
  cursor: pointer;
}
.color-field__picker:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.color-field__picker:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.color-field__hex {
  max-width: 160px;
  text-transform: uppercase;
}
.contrast-check__chip {
  display: inline-flex;
  margin-left: var(--space-2);
  vertical-align: middle;
}
.contrast-check__chip[hidden],
.contrast-check__text[hidden] {
  display: none;
}

.logo-field__current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
}
/* Karo-Muster zeigt, ob das Logo einen transparenten Hintergrund hat. */
.logo-field__thumb {
  display: grid;
  place-items: center;
  width: 160px;
  height: 64px;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: repeating-conic-gradient(var(--surface) 0 25%, var(--card) 0 50%) 0 0 / 12px 12px;
}
.logo-field__img {
  max-width: 100%;
  max-height: 48px;
  object-fit: contain;
}
.logo-field__none {
  color: var(--muted);
  font-size: var(--text-13);
}
.logo-field__meta {
  display: flex;
  flex: 1 1 140px;
  flex-direction: column;
  gap: 2px;
}
.logo-field__name {
  font-size: var(--text-14);
  font-weight: 500;
}
.logo-field__drop {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  color: var(--brand-link);
  cursor: pointer;
  transition: background-color var(--duration-copy), border-color var(--duration-copy);
}
.logo-field__drop:hover {
  border-color: var(--brand-link);
  background: var(--brand-tint);
}
.logo-field__drop:has(+ .logo-field__input:focus-visible) {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.logo-field__drop-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.logo-field__drop-title {
  color: var(--text);
  font-weight: 500;
}
/* Die echte Dateiauswahl bleibt bedienbar (Tastatur, Screenreader), sichtbar ist das gestaltete Label davor. */
.logo-field__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.field--invalid .logo-field__drop {
  border-color: var(--danger);
}

.brand-preview__sticky {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.brand-preview__label {
  color: var(--muted);
  font-size: var(--text-13);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
/* Die Bühne ist ein Stück Empfängerseite: immer hell, mit der Fläche der öffentlichen Seiten. */
.brand-preview__stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
}
.brand-preview__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1) var(--space-3);
  color: var(--muted);
  font-size: var(--text-13);
}
.brand-preview__link {
  color: var(--brand-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.recipient-card__brandrow {
  display: flex;
  align-items: center;
  min-height: 40px;
}
.recipient-card__greeting {
  margin-top: calc(-1 * var(--space-2));
  color: var(--text);
  font-size: var(--text-16);
  white-space: pre-line;
  text-wrap: pretty;
}

/* ---------- Richtlinien ---------- */
.policy-summary {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-4) var(--space-6);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-bar);
  border-radius: var(--radius-card);
  background: var(--brand-tint);
}
.policy-summary__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--brand-link);
}
.policy-summary__title {
  font-size: var(--text-16);
  font-weight: 600;
}
.policy-summary__text {
  margin-top: var(--space-1);
  max-width: 80ch;
  color: var(--text);
  text-wrap: pretty;
}
.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--space-4);
}
.checks {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.checks--invalid .check__input {
  outline: 1px solid var(--danger);
  outline-offset: 1px;
}

/* ---------- Versand ---------- */
.delivery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: var(--space-4);
  align-items: start;
}
.delivery-card .card__head {
  flex-wrap: nowrap;
}
.delivery-card .card__head > div {
  min-width: 0;
}
.delivery-card .card__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.delivery-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: var(--space-3);
}
.delivery-test {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.delivery-test__form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.delivery-test__form--sms {
  align-items: flex-end;
}
.delivery-test__form--sms .field {
  flex: 1 1 220px;
}
.delivery-test__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.delivery-test__title {
  font-weight: 600;
}

/* ---------- Protokoll ---------- */
.audit-tools .table-tools__search {
  flex: 2 1 280px;
}
.audit-tools .table-tools__filter {
  flex: 1 1 220px;
}
.audit-tools__range {
  display: flex;
  gap: var(--space-3);
}
.audit-tools__range[hidden] {
  display: none;
}
.audit-tools__actions {
  display: flex;
  gap: var(--space-2);
}
.audit-error {
  padding: var(--space-4) var(--space-6) 0;
}
.audit-count {
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-13);
  font-variant-numeric: tabular-nums;
}
.audit-table__detail {
  max-width: 280px;
  overflow-wrap: anywhere;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--line);
}
.pager__info {
  color: var(--muted);
  font-size: var(--text-14);
  font-variant-numeric: tabular-nums;
}
.pager__off {
  opacity: 0.5;
  pointer-events: none;
}
.audit-foot {
  padding: var(--space-3) var(--space-6) var(--space-4);
  border-top: 1px solid var(--line);
}

@media (max-width: 960px) {
  .brand-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .brand-preview__sticky {
    position: static;
  }
}
@media (max-width: 560px) {
  .delivery-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .policy-summary {
    padding: var(--space-4);
  }
  .admin-empty {
    padding: var(--space-4);
  }
  .audit-tools__range {
    flex-direction: column;
  }
  .brand-form__foot .btn {
    width: 100%;
  }
}

/* ======================================================================
   7 Utilities
   ====================================================================== */
.text-muted {
  color: var(--muted);
}
.text-small {
  font-size: var(--text-13);
}
.text-ok {
  color: var(--ok);
}
.text-warn {
  color: var(--warn);
}
.text-danger {
  color: var(--danger);
}
.mono {
  font-family: var(--font-mono);
  font-weight: 500;
}
.nums {
  font-variant-numeric: tabular-nums;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stack--tight {
  gap: var(--space-2);
}
.stack--loose {
  gap: var(--space-6);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.cluster--end {
  justify-content: flex-end;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--space-4);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
