/* ================= Feder – Styles (Zackzeit-Designsprache) ================= */

@font-face {
  font-family: "Geist Variable";
  font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/geist-latin.woff2") format("woff2-variations"), url("fonts/geist-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Variable";
  font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/geist-latin-ext.woff2") format("woff2-variations"), url("fonts/geist-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #F6F7F5;
  --surface: #FFFFFF;
  --surface-2: #EEF1EE;
  --surface-3: #E3E7E4;
  --canvas: #EEF1EE;
  --grid: rgba(27, 30, 28, .045);
  --line: #DCE1DD;
  --line-2: #C9D0CB;
  --ink: #1B1E1C;
  --ink-2: #343936;
  --muted: #5E6461;
  --faint: #8A918C;
  --brand: #2F7D50;
  --brand-hover: #276A44;
  --brand-ink: #FFFFFF;
  --brand-soft: #E2F0E6;
  --brand-2: #5AA878;
  --bad: #A8433B;
  --bad-soft: #F8E3E0;
  --pill: #1B1E1C;
  --pill-ink: #FFFFFF;
  --ring: rgba(47, 125, 80, .16);
  --shadow-1: 0 1px 2px rgba(20,40,28,.05), 0 1px 1px rgba(20,40,28,.03);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 30px 60px rgba(20, 40, 28, .22);
  --r: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* auf dem weißen Papier immer gleich, unabhängig vom Farbschema */
  --paper-accent: #2F7D50;
  --paper-accent-soft: rgba(47, 125, 80, .10);
  --paper-accent-line: rgba(47, 125, 80, .45);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1411;
    --surface: #171D19;
    --surface-2: #1F2722;
    --surface-3: #28312B;
    --canvas: #0B0F0D;
    --grid: rgba(234, 241, 236, .035);
    --line: #2A332D;
    --line-2: #37423B;
    --ink: #EAF1EC;
    --ink-2: #CBD6CF;
    --muted: #9DAAA2;
    --faint: #75827A;
    --brand: #5AA878;
    --brand-hover: #6DB889;
    --brand-ink: #0D1A12;
    --brand-soft: #1D3226;
    --bad: #E58A80;
    --bad-soft: #3A2220;
    --pill: #EAF1EC;
    --pill-ink: #0F1411;
    --ring: rgba(90, 168, 120, .25);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 30px 60px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
#app[data-view="start"] .editor { display: none; }
#app[data-view="editor"] .start { display: none; }

/* ---------- Buttons (Pillen wie bei Zackzeit) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s, transform .12s var(--ease), box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.primary:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn.big { height: 56px; padding: 0 28px; font-size: 17px; }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.icon-btn svg { width: 21px; height: 21px; }

/* ---------- Startbildschirm ---------- */
.start {
  flex: 1; overflow: auto;
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 580px) minmax(0, 1fr);
  column-gap: clamp(24px, 4vw, 80px);
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(47, 125, 80, .10), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--bg);
}
.start-inner { grid-column: 2; width: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 24px; letter-spacing: -.04em; margin-bottom: 36px; }
.brand img { border-radius: 11px; }
.start h1 { font-size: clamp(32px, 7vw, 48px); line-height: 1.04; letter-spacing: -.045em; font-weight: 650; margin: 0 0 16px; text-wrap: balance; }
.start h1 em { font-style: normal; color: var(--brand); }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 30px; max-width: 30em; text-wrap: pretty; }
.drop-hint { color: var(--faint); font-size: 13px; margin: 12px 0 0 4px; }
/* Versprechen: was Feder anders macht als Abo-Anbieter */
.promise { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: -14px 0 26px; }
.promise li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600; }
.promise li::before { content: ""; width: 12px; height: 12px; flex: none; background: currentColor;
  -webkit-mask: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 12.5l5 5 10-11' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
          mask: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 12.5l5 5 10-11' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.legal-link { margin: 14px 0 0 2px; font-size: 13px; }
.facts { list-style: none; padding: 0; margin: 40px 0 0; display: grid; gap: 10px; }
.facts li {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--shadow-1);
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.facts li:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: var(--shadow); }
.facts .dot { position: relative; flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.facts .dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid var(--brand); opacity: 0;
  animation: dot-pulse 4.2s cubic-bezier(.2, .6, .3, 1) infinite;
}
.facts li:nth-child(2) .dot::after { animation-delay: 1.4s; }
.facts li:nth-child(3) .dot::after { animation-delay: 2.8s; }
.facts li:hover .dot::after { animation-duration: 2s; animation-delay: 0s; }
@keyframes dot-pulse { 0% { transform: scale(.7); opacity: .6; } 60%, 100% { transform: scale(2.6); opacity: 0; } }
.facts strong { display: block; font-size: 14px; font-weight: 650; }
.facts div span { display: block; color: var(--muted); font-size: 13px; }
/* Live-Zahlen – nur echte, anonym gezählte Werte */
.stats-wrap { margin: 28px 0 0; }
.stats-title { display: block; margin: 0 0 8px 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); }
.stat-num { font-size: 26px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats:not(.is-live) .stat-num { color: var(--line-2); }
.stats.is-live .stat-num { color: var(--ink); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.stat-sub { font-size: 11.5px; color: var(--faint); line-height: 1.35; }
.stats-note { margin: 8px 2px 0; font-size: 12px; color: var(--faint); }
@media (max-width: 480px) {
  .stats-grid { gap: 8px; }
  .stat { padding: 11px 11px 12px; }
  .stat-num { font-size: 21px; }
  .stat-label { font-size: 11.5px; line-height: 1.3; }
  .stat-sub { font-size: 10.5px; }
}
.install { margin-top: 24px; }
.install-hint { color: var(--muted); font-size: 13px; margin-top: 20px; }
@media (max-width: 620px) { .btn.big { width: 100%; } }

/* ---------- Sponsor-Plätze im Feder-Stil (PLAN.md Abschnitt 13) ----------
   Jedes Logo: einfarbig in Feder-Tinte, gleiches optisches Gewicht, gleicher Takt, reihum ein Spotlight.
   Immer als „Sponsor“ gekennzeichnet, nie im Arbeitsbereich. */
@property --fx { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fy { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --lift { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --rz { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --ryx { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --sc { syntax: "<number>"; inherits: false; initial-value: 1; }
@property --pop { syntax: "<number>"; inherits: false; initial-value: 1; }

/* Logos ruhen in neutralem Grau (hell wie dunkel gut lesbar) und leuchten nur ab und zu in Originalfarbe auf.
   Plakette: dunkle Logos bekommen beim Aufleuchten im Dunkelmodus eine helle Fläche (und umgekehrt). */
:root { --sp-ink: #5F6863; --sp-alpha: .62; --sp-plate-dark: transparent; --sp-plate-light: rgba(23, 29, 25, .92); --sp-glow: rgba(47, 125, 80, .22); }
@media (prefers-color-scheme: dark) { :root { --sp-ink: #C3CDC6; --sp-alpha: .52; --sp-plate-dark: rgba(246, 247, 245, .94); --sp-plate-light: transparent; --sp-glow: rgba(90, 168, 120, .28); } }

.start { grid-template-rows: minmax(max-content, 1fr) auto; }
.start-inner { grid-row: 1; }
.sp-rail { position: relative; grid-row: 1; align-self: stretch; min-height: 580px; min-width: 0; container-type: inline-size; }
.sp-rail.left { grid-column: 1; }
.sp-rail.right { grid-column: 3; }
.sp-pos {
  position: absolute; top: var(--y, 0);
  transform: translate(calc(var(--px, 0) * var(--depth, .5) * -14px), calc(var(--py, 0) * var(--depth, .5) * -10px));
  transition: transform 1s cubic-bezier(.2, .8, .2, 1);
}
.sp-rail.right .sp-pos { left: var(--x, 0); }
.sp-rail.left .sp-pos { right: var(--x, 0); }
.sp-local { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 30px 0 4px; }
.sp-local-label, .sp-band-label {
  display: block; width: 100%; text-align: center; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); opacity: .8; margin-bottom: 2px;
}
.sp-band { display: none; }
.sp-note { margin: 26px 0 0; color: var(--faint); font-size: 12.5px; }
.link-btn { border: 0; padding: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Karte – für alle Sponsoren identisch */
.sp {
  position: relative; flex: none; display: block;
  padding: 0; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--faint); cursor: pointer; font: inherit;
  transform: perspective(900px) translate(var(--fx), calc(var(--fy) + var(--lift)))
             rotateY(calc(var(--ry, 0deg) * var(--persp, 1) + var(--ryx))) rotate(calc(var(--tilt, 0deg) * var(--tilt-k, 1) + var(--rz)))
             scale(calc(var(--sc) * var(--pop)));
  transition: --lift .45s var(--ease), --pop .9s cubic-bezier(.3, 1.4, .5, 1), border-color .6s, background .9s, box-shadow .9s, color .45s;
  animation-delay: var(--delay, 0s);
}
.sp-l { width: min(300px, 64cqw); aspect-ratio: 300 / 172; border-radius: 22px; }
.sp-m { width: min(222px, 48cqw); aspect-ratio: 222 / 124; }
.sp-s { width: min(152px, 34cqw); aspect-ratio: 152 / 88; border-radius: 15px; }
.sp-xs { width: 116px; height: 60px; border-radius: 14px; }
.sp:hover, .sp:focus-visible { --lift: -4px; border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); background: color-mix(in srgb, var(--surface) 85%, transparent); box-shadow: var(--shadow); }
.sp-tag { position: absolute; top: 8px; left: 12px; font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); opacity: .75; }
.sp-s .sp-tag { top: 6px; left: 10px; font-size: 9px; }

/* Logo-Fläche: einfarbige Schablone + Originalfarbe für Spotlight/Hover */
.sp-logo { position: absolute; left: 12%; right: 12%; top: 26%; bottom: 18%; transform: scale(var(--fit, .85)); transition: transform .6s var(--ease); }
.sp-xs .sp-logo { left: 13%; right: 13%; top: 20%; bottom: 20%; }
.sp-mono {
  position: absolute; inset: 0; background: var(--sp-ink);
  -webkit-mask: var(--mask) center / contain no-repeat; mask: var(--mask) center / contain no-repeat;
  opacity: var(--sp-alpha);
  transition: opacity 1.3s cubic-bezier(.4, 0, .2, 1);
}
.sp-color { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; user-select: none; -webkit-user-drag: none;
  transition: opacity 1.3s cubic-bezier(.4, 0, .2, 1); }
.sp.spot .sp-mono, .sp:hover .sp-mono, .sp:focus-visible .sp-mono { opacity: 0; }
.sp.spot .sp-color, .sp:hover .sp-color, .sp:focus-visible .sp-color { opacity: 1; }
.sp.spot .sp-logo { transform: scale(calc(var(--fit, .85) * 1.04)); }
/* Aufleuchten: kurzer, weicher Auftritt mit Schein – fällt ins Auge, ohne zu blinken */
.sp.has-logo.spot { --pop: 1.05; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: 0 0 0 4px var(--sp-glow), 0 18px 44px rgba(0, 0, 0, .14); }
.sp.has-logo.spot.ink-dark { background: var(--sp-plate-dark); }
.sp.has-logo.spot.ink-light { background: var(--sp-plate-light); }
.sp.has-logo.spot.ink-dark .sp-tag { color: #5F6863; }
.sp.pending .sp-mono { opacity: 0; }
/* Notlösung, falls ein Logo nicht als Schablone gelesen werden kann */
.sp.no-mask .sp-mono { display: none; }
.sp.no-mask .sp-color { opacity: var(--sp-alpha); filter: grayscale(1) contrast(.9); }
.sp.no-mask.spot .sp-color, .sp.no-mask:hover .sp-color { opacity: 1; filter: none; }

/* freie Plätze */
.sp.is-free {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1.5px dashed color-mix(in srgb, var(--line-2) 80%, transparent); background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  animation: sp-float 10s ease-in-out infinite; animation-delay: var(--delay, 0s);
}
.sp.is-free:hover { color: var(--brand); border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 40%, transparent); }
.sp-plus { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 4px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 17px; line-height: 1; transition: transform .45s var(--ease); }
.sp:hover .sp-plus { transform: rotate(90deg); }
.sp-free-t { font-size: 12.5px; font-weight: 600; }
.sp-free-p { font-size: 11px; opacity: .85; }
.sp-s .sp-plus, .sp-xs .sp-plus { width: 20px; height: 20px; font-size: 13px; margin-bottom: 2px; }
.sp-s .sp-free-t, .sp-xs .sp-free-t { font-size: 11px; }
.sp-xs .sp-free-p { font-size: 10px; }

/* Bewegung – sechs klar unterscheidbare Arten, alle weich und langsam, zeitversetzt */
.sp.m-float { animation: sp-float 7s ease-in-out infinite; animation-delay: var(--delay, 0s); }            /* auf und ab */
.sp.m-swing { animation: sp-swing 6.5s ease-in-out infinite; animation-delay: var(--delay, 0s); transform-origin: 50% -30%; } /* Pendel */
.sp.m-tilt { animation: sp-tilt 9s ease-in-out infinite; animation-delay: var(--delay, 0s); }              /* dreht sich zur Seite */
.sp.m-orbit { animation: sp-orbit 11s linear infinite; animation-delay: var(--delay, 0s); }               /* kleiner Kreis */
.sp.m-breathe { animation: sp-breathe 5.5s ease-in-out infinite; animation-delay: var(--delay, 0s); }     /* atmet groß und klein */
.sp.m-shine { animation: sp-float 12s ease-in-out infinite; animation-delay: var(--delay, 0s); overflow: hidden; } /* Lichtstreifen */
.sp.m-shine::after { content: ""; position: absolute; inset: -20% auto -20% -60%; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--surface) 75%, transparent) 50%, transparent);
  transform: skewX(-18deg) translateX(-120%); animation: sp-shine 6s ease-in-out infinite; animation-delay: var(--delay, 0s); }
.sp.m-shine.spot::after { animation-duration: 2.4s; }
.sp.spot .sp-logo, .sp:hover .sp-logo, .sp:focus-visible .sp-logo { animation: none; }
@keyframes sp-float { 0%, 100% { --fy: 0px; } 50% { --fy: -10px; } }
@keyframes sp-swing { 0%, 100% { --rz: -2.6deg; } 50% { --rz: 2.6deg; } }
@keyframes sp-tilt { 0%, 100% { --ryx: -13deg; --fy: 0px; } 50% { --ryx: 13deg; --fy: -3px; } }
@keyframes sp-orbit { 0% { --fx: 7px; --fy: 0px; } 25% { --fx: 0px; --fy: 6px; } 50% { --fx: -7px; --fy: 0px; } 75% { --fx: 0px; --fy: -6px; } 100% { --fx: 7px; --fy: 0px; } }
@keyframes sp-breathe { 0%, 100% { --sc: .97; } 50% { --sc: 1.045; } }
@keyframes sp-shine { 0%, 62% { transform: skewX(-18deg) translateX(-120%); } 100% { transform: skewX(-18deg) translateX(420%); } }
@media (prefers-reduced-motion: reduce) { .sp, .sp *, .sp::after, .sp-band-track, .facts .dot::after { animation: none !important; } .sp-pos { transition: none; } }

/* Handy und Tablet: Sponsoren-Bühne – Gruppen blenden nacheinander ein
   (Groß allein, Mittel zu zweit, Klein zu dritt, Lokal zu sechst) */
.sp-band { margin: 30px 0 0; }
.sp-stage-wrap { position: relative; height: var(--stage-h, 132px); touch-action: pan-y; }
.sp-scene {
  position: absolute; inset: 0; display: grid; gap: 10px; align-items: center; justify-items: stretch;
  pointer-events: none; visibility: hidden;
  transition: visibility 0s linear .7s;
}
.sp-scene.in { pointer-events: auto; visibility: visible; transition: visibility 0s; }
.sp-scene .sp {
  width: 100%; height: 100%; aspect-ratio: auto; --tilt-k: .35; --persp: 0;
  opacity: 0; translate: 0 8px; scale: .97;
  transition: opacity .6s var(--ease) var(--d, 0s), translate .7s var(--ease) var(--d, 0s), scale .7s var(--ease) var(--d, 0s),
              --lift .45s var(--ease), border-color .45s, background .45s, box-shadow .45s, color .45s;
}
.sp-scene .sp { transition-duration: .45s, .45s, .45s, .45s, .45s, .45s, .45s, .45s; transition-delay: 0s; }
.sp-scene.in .sp {
  opacity: 1; translate: 0 0; scale: 1;
  /* erst einblenden, wenn die vorige Gruppe ausgeblendet ist */
  transition-duration: .6s, .7s, .7s, .45s, .45s, .45s, .45s, .45s;
  transition-delay: calc(var(--d, 0s) + .45s), calc(var(--d, 0s) + .45s), calc(var(--d, 0s) + .45s), 0s, 0s, 0s, 0s, 0s;
}
.sc-l { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.sc-l .sp { max-width: 480px; border-radius: 22px; }
.sc-m { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sc-m .sp { height: 88%; }
.sc-s { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sc-s .sp { height: 74%; }
.sc-xs { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sc-xs .sp { height: 100%; }
.sp-scene .sp-tag { top: 7px; left: 11px; }
.sp-scene .sp-s .sp-tag, .sp-scene .sp-xs .sp-tag { display: none; }
.sp-dots { display: flex; justify-content: center; gap: 2px; margin-top: 8px; }
.sp-dot { width: 22px; height: 18px; padding: 6px 4px; border: 0; background: transparent; cursor: pointer; }
.sp-dot::before { content: ""; display: block; width: 6px; height: 6px; margin: 0 auto; border-radius: 3px; background: var(--line-2); transition: width .35s var(--ease), background .35s; }
.sp-dot.on::before { width: 16px; background: var(--brand); }
@media (min-width: 641px) and (max-width: 1100px) {
  .sp-stage-wrap { --stage-h: 150px; }
  .sc-l .sp { max-width: 540px; }
  .sc-xs { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
  .sc-xs .sp { height: 62%; }
}
@media (prefers-reduced-motion: reduce) { .sp-scene .sp { translate: none; scale: none; } }
@media (max-width: 1100px) {
  .start { grid-template-columns: minmax(0, 580px); justify-content: center; }
  .start-inner { grid-column: 1; }
  .sp-rail, .sp-local { display: none !important; }
  .sp-band { display: block; }
}
@media (max-width: 1100px) { .sp-band[hidden] { display: none; } }

/* „Fertig“-Bildschirm nach dem Speichern */
.done-screen {
  position: fixed; inset: 0; z-index: 55;
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px) minmax(0, 1fr); grid-template-rows: minmax(max-content, 1fr) auto;
  column-gap: clamp(24px, 4vw, 80px);
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(700px 400px at 50% 40%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 48px 48px, var(--bg);
  overflow: auto; animation: fade .25s ease-out;
}
.done-center { grid-column: 2; grid-row: 1; text-align: center; }
.done-check { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 0 0 10px var(--brand-soft); animation: done-pop .5s cubic-bezier(.3, .7, .4, 1.35) both; }
.done-check svg { width: 42px; height: 42px; stroke-width: 2.6; stroke-dasharray: 30; stroke-dashoffset: 30; animation: done-draw .5s .25s ease-out forwards; }
.done-center h2 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.035em; font-weight: 650; }
.done-center p { margin: 0 auto 22px; color: var(--muted); max-width: 26em; }
.done-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.done-screen .sp-band { grid-column: 1 / -1; }
@keyframes done-pop { from { transform: scale(.4); opacity: 0; } }
@keyframes done-draw { to { stroke-dashoffset: 0; } }
@media (max-width: 1100px) { .done-screen { grid-template-columns: minmax(0, 460px); justify-content: center; } .done-center { grid-column: 1; } }

/* ---------- Editor-Layout ---------- */
.editor { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

.topbar {
  display: flex; align-items: center; gap: 4px;
  margin: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  padding: 6px 6px 6px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow);
  position: relative; z-index: 10;
}
.doc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; padding: 0 6px; }
.doc-title span { font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-title small { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.zoom { display: flex; align-items: center; }
.zoom-label { min-width: 54px; height: 40px; border: 0; background: transparent; border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.zoom-label:hover { background: var(--surface-2); color: var(--ink); }
.save-btn { margin-left: 4px; }

.toolbar {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 8px auto 0; max-width: calc(100% - 20px);
  padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow);
  position: relative; z-index: 9;
}
.mode-switch { display: flex; flex: none; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.mode-switch button {
  height: 34px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s;
}
.mode-switch button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tools { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tools::-webkit-scrollbar { display: none; }
.tool {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 70px; padding: 5px 8px 4px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
  font-size: 11.5px; font-weight: 550;
  transition: background .15s, color .15s;
}
.tool svg { width: 22px; height: 22px; }
.tool:hover { background: var(--surface-2); }
.tool[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
[data-mode="prepare"] .toolbar { box-shadow: 0 0 0 3px var(--ring), var(--shadow); }

.main { flex: 1; min-height: 0; position: relative; }
.viewer {
  position: absolute; inset: 0;
  overflow: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--canvas);
}
.editor { background: var(--canvas); }
/* Bundesweite Partner neben dem Dokument – nur, wenn links/rechts genug freier Platz ist */
.side-sp { position: absolute; top: 0; bottom: 0; z-index: 2; pointer-events: none; display: flex; align-items: center; justify-content: center;
  padding: 0 clamp(24px, 3vw, 48px) 90px; }
.side-sp.left { left: 0; }
.side-sp.right { right: 0; }
.side-sp[hidden] { display: none; }
.side-card { pointer-events: auto; width: min(280px, 100%); transition: opacity 1s var(--ease), translate 1.1s var(--ease), scale 1.1s cubic-bezier(.3, 1.3, .5, 1); }
.side-card .sp { width: 100%; aspect-ratio: 300 / 172; border-radius: 22px; }
.side-card.enter { opacity: 0; translate: 0 22px; scale: .9; }
.side-card.out { opacity: 0; translate: 0 -14px; scale: .96; pointer-events: none; position: absolute; }
.pages {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 18px 24px 140px;
  width: max-content; min-width: 100%;
  transform-origin: 0 0;
}

@media (max-width: 720px) {
  .topbar { margin: max(8px, env(safe-area-inset-top)) 8px 0; }
  .editor .toolbar {
    order: 3; flex-direction: column; gap: 4px; align-items: stretch;
    margin: 0 8px max(8px, env(safe-area-inset-bottom)); max-width: none;
    border-radius: 22px; padding: 5px;
  }
  .mode-switch button { flex: 1; height: 30px; }
  .tools { justify-content: space-between; }
  .tool { min-width: 0; flex: 1; padding: 5px 2px 3px; font-size: 10.5px; border-radius: 14px; }
  .pages { padding: 10px 8px 24px; gap: 10px; }
  .save-btn span { display: none; }
  .save-btn { width: 40px; height: 40px; padding: 0; }
}
@media (max-width: 480px) { .zoom { display: none; } }

/* ---------- Seiten ---------- */
.page {
  position: relative; flex: none;
  background: #fff; border-radius: 4px;
  box-shadow: 0 1px 2px rgba(20,40,28,.10), 0 10px 30px rgba(20,40,28,.10);
}
.page > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 4px; }
.field-layer, .item-layer { position: absolute; inset: 0; }
.item-layer { pointer-events: none; }

.placing .page { touch-action: none; cursor: crosshair; }
.placing .field-layer,
.placing .item { pointer-events: none !important; }

/* ---------- Formularfelder aus der PDF ---------- */
.fld {
  position: absolute; margin: 0; border: 0; border-radius: 3px;
  padding: 0 .25em;
  background: var(--paper-accent-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 125, 80, .30);
  color: #000;
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.15; outline: none; color-scheme: light;
}
.fld:hover { background: rgba(47, 125, 80, .16); }
.fld:focus { background: rgba(255, 255, 255, .96); box-shadow: inset 0 0 0 2px var(--paper-accent); }
.fld[readonly], .fld:disabled { background: transparent; box-shadow: none; cursor: default; }
textarea.fld { resize: none; padding: .15em .25em; overflow: hidden; }
select.fld { padding: 0 .1em; -webkit-appearance: none; appearance: none; }
.fld-checkbox, .fld-radio { padding: 0; display: grid; place-items: center; }
.fld-checkbox::after {
  content: ""; width: 72%; height: 72%;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 12.5l5 5 10-11' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s;
}
.fld-checkbox[aria-checked="true"]::after { opacity: 1; transform: none; }
.fld-radio { border-radius: 50%; }
.fld-radio::after { content: ""; width: 50%; height: 50%; border-radius: 50%; background: #000; opacity: 0; transform: scale(.4); transition: opacity .12s, transform .12s; }
.fld-radio[aria-checked="true"]::after { opacity: 1; transform: none; }
.fld-sig, .ph-sig {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--paper-accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--paper-accent);
  border-radius: 6px;
  color: var(--paper-accent); font: 600 13px var(--font);
  animation: sig-pulse 2.4s ease-in-out infinite;
  overflow: hidden; white-space: nowrap;
}
.fld-sig svg, .ph-sig svg { width: 18px; height: 18px; flex: none; }
.fld-sig.signed { display: none; }
@keyframes sig-pulse { 50% { background: rgba(47, 125, 80, .2); } }
@media (prefers-reduced-motion: reduce) { .fld-sig, .ph-sig { animation: none; } }

/* ---------- Eigene Elemente ---------- */
.item { position: absolute; pointer-events: auto; touch-action: none; cursor: move; user-select: none; -webkit-user-select: none; }
.item.selected { z-index: 4; outline: 1.5px solid var(--paper-accent); outline-offset: 2px; }
.item img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; -webkit-user-drag: none; }
.item svg.mark { width: 100%; height: 100%; display: block; stroke-width: 2.6; pointer-events: none; }
.item-rect { background: #fff; }
.item-rect:not(.selected) { outline: 1px dashed rgba(47, 125, 80, .35); outline-offset: 0; }
.item-rect.selected { outline-style: dashed; }

.item textarea {
  display: block; width: 100%; height: 100%;
  margin: 0; border: 0; background: transparent; resize: none; overflow: hidden;
  font-family: Helvetica, Arial, sans-serif; line-height: 1.2; color: inherit;
  white-space: pre-wrap; overflow-wrap: break-word;
  outline: none; pointer-events: none; cursor: move;
  color-scheme: light;
}
.item textarea::placeholder { color: rgba(47, 125, 80, .6); }
.item.editing { cursor: text; outline: 1.5px solid var(--paper-accent); outline-offset: 2px; background: rgba(255, 255, 255, .7); }
.item.editing textarea { pointer-events: auto; cursor: text; user-select: text; -webkit-user-select: text; }

/* Vorbereitete Felder (Platzhalter) */
.item-field {
  border-radius: 4px;
  background: var(--paper-accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--paper-accent-line);
  color: #111;
}
.item-field .ph-label {
  position: absolute; left: 0; bottom: 100%; margin-bottom: 2px;
  padding: 1px 6px; border-radius: 999px;
  background: var(--paper-accent); color: #fff;
  font: 600 10px/1.5 var(--font); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s;
}
[data-mode="prepare"] .item-field .ph-label, .item-field.selected .ph-label { opacity: 1; }
[data-mode="prepare"] .item-field { box-shadow: inset 0 0 0 1.5px var(--paper-accent); background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(47,125,80,.05) 6px 12px); }
[data-mode="fill"] .item-field { cursor: pointer; touch-action: pan-x pan-y; }
[data-mode="fill"] .item-field.kind-text, [data-mode="fill"] .item-field.kind-date { cursor: text; }
.item-field .ph-sig { position: absolute; inset: 0; box-shadow: none; background: transparent; }
.item-field.signed { background: transparent; box-shadow: none; }
.item-field.signed .ph-sig { display: none; }
/* Beschriftung nach Feldbreite: schmal „Unterschreiben“ (die Person steht schon am Feld), breit „Kunde unterschreibt hier“ */
.item-field.kind-sig { container-type: inline-size; }
.ph-sig .ph-long, .ph-sig .ph-short { display: none; white-space: nowrap; }
@container (min-width: 130px) { .ph-sig .ph-short { display: inline; } }
@container (min-width: 190px) { .ph-sig .ph-long { display: inline; } .ph-sig .ph-short { display: none; } }
.item-field.kind-check { display: grid; place-items: center; background-color: rgba(255,255,255,.6); }
.item-field.kind-check svg { width: 80%; height: 80%; stroke-width: 3; opacity: 0; color: #111; }
.item-field.kind-check.on svg { opacity: 1; }
.item-field.filled:not(.selected):not(.editing) { background: transparent; box-shadow: none; }
[data-mode="prepare"] .item-field.filled { background: var(--paper-accent-soft); box-shadow: inset 0 0 0 1.5px var(--paper-accent); }

/* Pflichtfelder: Stern am Feld, offene Pflichtfelder beim Ausfüllen deutlich markiert */
.fld.req, .item-field.req { overflow: visible; }
.item-field:not(.req) .req-star { display: none; }
.req-star { position: absolute; top: -7px; right: -7px; z-index: 3; width: 15px; height: 15px; border-radius: 50%;
  background: #B4532A; color: #fff; font: 700 11px/15px var(--font); text-align: center; pointer-events: none; box-shadow: 0 0 0 2px #fff; }
/* Erledigt: statt eines losen Punkts ein kleines Häkchen innen am Feld; nach der Unterschrift gar nichts mehr */
.item-field.filled .req-star, .req-star.ok { background: var(--paper-accent); font-size: 0; }
.item-field.filled .req-star::after, .req-star.ok::after { content: "✓"; font-size: 9px; line-height: 15px; }
.item-field.filled .req-star { top: 50%; right: 3px; transform: translateY(-50%); width: 14px; height: 14px; box-shadow: none; opacity: .8; }
.item-field.filled .req-star::after { line-height: 14px; }
.item-field.signed .req-star { display: none; }
[data-mode="fill"] .missing { box-shadow: inset 0 0 0 1.5px #C26A2E, 0 0 0 3px rgba(194, 106, 46, .18) !important; background-color: rgba(194, 106, 46, .08) !important; }
[data-mode="fill"] .missing.fld-sig, [data-mode="fill"] .item-field.missing .ph-sig { color: #A2541F; }
.flash { animation: field-flash 1.2s ease-out 2; }
@keyframes field-flash { 30% { box-shadow: inset 0 0 0 2px var(--paper-accent), 0 0 0 7px rgba(47, 125, 80, .25); } }
.bar-row button.on { background: rgba(255,255,255,.18); }
/* Zeitstempel unter der Unterschrift – genauso, wie er im PDF steht */
.sig-time { position: absolute; white-space: nowrap; pointer-events: none; color: #5C6360; font-family: Helvetica, Arial, sans-serif; line-height: 1.2; }
/* Unterzeichner-Rolle am Unterschriftsfeld (Nummer = Reihenfolge) */
.role-tag { position: absolute; right: 12px; bottom: 100%; margin-bottom: 3px; z-index: 2; padding: 1px 7px; border-radius: 999px;
  background: var(--paper-accent); color: #fff; font: 700 10px/1.5 var(--font); white-space: nowrap; pointer-events: none; }
.item-field.signed .role-tag { display: none; }
/* Unterschriftsfeld in der Farbe der Person (Kunde grün, Berater blau, …) */
.item-field.kind-sig.has-role { background-color: color-mix(in srgb, var(--role) 11%, transparent); box-shadow: inset 0 0 0 1.5px var(--role); }
.item-field.kind-sig.has-role .ph-sig { color: var(--role); }
.item-field.kind-sig.has-role .role-tag, .item-field.kind-sig.has-role .ph-label { background: var(--role); }
[data-mode="prepare"] .item-field.kind-sig.has-role { box-shadow: inset 0 0 0 1.5px var(--role);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--role) 9%, transparent) 6px 12px); }
.item-field.kind-sig.has-role.signed { background: transparent; box-shadow: none; }
[data-mode="fill"] .item-field.kind-sig.has-role.missing { box-shadow: inset 0 0 0 2px var(--role), 0 0 0 3px color-mix(in srgb, var(--role) 22%, transparent) !important;
  background-color: color-mix(in srgb, var(--role) 12%, transparent) !important; }
[data-mode="fill"] .item-field.kind-sig.has-role.missing .ph-sig { color: var(--role); }
.role-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; flex: none; }
.role-edit { display: grid; gap: 8px; }
.role-edit label { display: flex; align-items: center; gap: 10px; }
.role-edit b { width: 18px; color: var(--muted); }
.role-edit .text-input { height: 40px; }

.h-resize, .h-move { position: absolute; display: none; z-index: 2; touch-action: none; }
.selected .h-resize, .selected .h-move { display: block; }
[data-mode="fill"] .item-field .h-resize, [data-mode="fill"] .item-field .h-move { display: none; }
.h-resize { right: -16px; bottom: -16px; width: 32px; height: 32px; cursor: nwse-resize; }
.h-resize::after {
  content: ""; position: absolute; inset: 9px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--paper-accent), 0 1px 4px rgba(0,0,0,.3);
}
.h-move {
  left: -14px; top: -14px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--paper-accent); color: #fff; cursor: move;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.h-move svg { width: 16px; height: 16px; margin: 5px; stroke-width: 2.2; }

.item-bar {
  position: absolute; bottom: calc(100% + 14px); left: 0;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 6; cursor: default; touch-action: manipulation;
}
.item-bar.below { bottom: auto; top: calc(100% + 20px); flex-direction: column-reverse; }
.bar-row {
  display: flex; gap: 2px; padding: 4px;
  background: #1B1E1C; color: #fff; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  white-space: nowrap; width: max-content;
}
.bar-row button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 0; border-radius: 999px; background: transparent; color: #fff;
  font: 600 13px var(--font);
}
.bar-row button:hover { background: rgba(255,255,255,.12); }
.bar-row button svg { width: 18px; height: 18px; }
.bar-row .dot { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.bar-row .danger { color: #F2A49C; }
.bar-row .sw { min-width: 34px; padding: 0; }
.bar-row .sw[aria-checked="true"] .dot { box-shadow: 0 0 0 2px #1B1E1C, 0 0 0 4px #fff; }

.place-ghost {
  position: absolute; pointer-events: none;
  border: 1.5px dashed var(--paper-accent); background: var(--paper-accent-soft); border-radius: 4px;
}
.place-ghost.waiting { animation: sig-pulse 1.6s ease-in-out infinite; }

/* ---------- Hinweisleiste ---------- */
.hint {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  width: max-content; max-width: calc(100% - 24px);
  padding: 6px 6px 6px 18px;
  background: var(--pill); color: var(--pill-ink); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  font-size: 13.5px; z-index: 8;
  animation: rise .2s var(--ease);
}
.hint button { flex: none; height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(127,127,127,.22); color: inherit; font-weight: 600; font-size: 13px; }
@media (max-width: 720px) { .hint { top: auto; bottom: 10px; border-radius: 18px; } }

/* ---------- Schritt für Schritt / Kundenmodus ---------- */
.guide-btn { gap: 6px; }
.guide-btn svg { width: 17px; height: 17px; }
.guide {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 6px; width: max-content; max-width: calc(100% - 20px);
  padding: 6px 6px 6px 16px; background: var(--pill); color: var(--pill-ink); border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.28); animation: rise .2s var(--ease);
}
.guide-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; margin-right: 6px; }
.guide-info strong { font-size: 13.5px; }
.guide-info span { font-size: 12px; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.guide .btn.small { height: 38px; padding: 0 18px; font-size: 14px; }
.guide-nav { height: 38px; min-width: 38px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(127,127,127,.22); color: inherit; font: 600 12.5px var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; }
.guide-nav svg { width: 18px; height: 18px; }
.guide-info strong { white-space: nowrap; }
.guide.done .btn.primary { background: #3E9A63; border-color: #3E9A63; color: #fff; }
@media (max-width: 720px) {
  .guide { bottom: 8px; border-radius: 20px; padding: 6px 6px 6px 12px; gap: 4px; }
  .guide-nav { padding: 0; width: 38px; }
  .guide-nav span { display: none; }
  .guide .btn.small { padding: 0 14px; }
  .guide-info strong { font-size: 12.5px; }
  .guide-btn span { display: none; }
  .guide-btn { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .guide-info span { max-width: 28vw; }
}
[data-guide="1"] .editor .toolbar { display: none; }
/* Kundenmodus: nur Felder und Unterschrift, Berater-Funktionen ausgeblendet */
[data-kiosk="1"] .editor .toolbar, [data-kiosk="1"] #btnClose, [data-kiosk="1"] #btnSave, [data-kiosk="1"] #btnGuide,
[data-kiosk="1"] #guideKiosk, [data-kiosk="1"] #guideClose, [data-kiosk="1"] .side-sp { display: none !important; }
[data-kiosk="1"] .topbar { box-shadow: 0 0 0 3px var(--ring), var(--shadow); }
[data-kiosk="1"] .item:not(.item-field) { pointer-events: none; }
[data-kiosk="1"] .doc-title::before { content: "Kundenmodus"; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }

/* ---------- Dialoge ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(15, 20, 17, .5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fade .15s ease-out;
}
.sheet {
  width: min(640px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: rise .22s var(--ease);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 22px; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.sheet-body { padding: 4px 22px 8px; overflow: auto; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px max(18px, env(safe-area-inset-bottom)); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

.recent-sigs { display: flex; gap: 8px; align-items: center; padding: 0 22px 10px; overflow-x: auto; }
.recent-sig { flex: none; width: 120px; height: 50px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 4px 8px; }
.recent-sig img { width: 100%; height: 100%; object-fit: contain; display: block; }
.recent-sig:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.recent-label { flex: none; color: var(--faint); font-size: 12px; padding-right: 2px; }

.pad-wrap {
  position: relative; height: 270px; margin: 0 22px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
#padCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.pad-line { position: absolute; left: 28px; right: 28px; bottom: 27%; border-bottom: 1.5px solid #D5DAD6; pointer-events: none; }
.pad-line span { position: absolute; left: -2px; bottom: 2px; color: #A3AAA5; font-size: 22px; line-height: 1; }
.pad-hint { position: absolute; left: 0; right: 0; top: 36%; margin: 0; text-align: center; color: #A3AAA5; font-size: 16px; pointer-events: none; }

.pad-tools { display: flex; align-items: center; gap: 12px; padding: 12px 22px 0; flex-wrap: wrap; }
.pad-tools .spacer { flex: 1; }
.swatches { display: flex; gap: 7px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .12s var(--ease); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); transform: scale(1.06); }
.seg { display: flex; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.seg button { display: grid; place-items: center; width: 36px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg button i { display: block; width: 18px; border-radius: 9px; background: currentColor; }
.sign-all {
  display: flex; align-items: flex-start; gap: 10px; margin: 12px 22px 0; line-height: 1.35;
  padding: 10px 14px; border-radius: var(--r); background: var(--brand-soft); color: var(--ink);
  font-size: 14px; font-weight: 550; cursor: pointer; user-select: none;
}
.sign-all input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin: 0; }

.save-modes { display: grid; gap: 10px; margin-bottom: 14px; }
.mode-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.mode-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.mode-card input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.mode-card strong { display: block; font-size: 15px; font-weight: 650; }
.mode-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
/* Prüfung vor dem Speichern */
.save-check { display: grid; gap: 8px; margin-bottom: 14px; }
.save-check:empty { display: none; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r); font-size: 13.5px; line-height: 1.4; background: var(--surface-2); }
.check-item::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--brand) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 12.5l5 5 10-11' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.check-item.warn { background: #FBEEE3; color: #5B3214; }
.check-item.warn::before { background: #C26A2E center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 6v8M12 18v.5' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.check-item.info::before { background: var(--faint) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 11v7M12 6v.5' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { .check-item.warn { background: #3A2718; color: #F3D2B7; } }
.check-item > div { flex: 1; min-width: 0; }
.check-item strong { display: block; font-weight: 650; }
.check-item .check-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.check-item .check-acts .btn { height: 32px; font-size: 12.5px; padding: 0 12px; }
.protocol { display: grid; gap: 8px; margin: 0 0 14px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check-row input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.check-row strong { display: block; font-size: 14px; font-weight: 650; }
.check-row small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.legal-small { margin-right: auto; font-size: 13px; align-self: center; }
.done-hash { margin: -10px auto 20px !important; font: 12px/1.5 ui-monospace, Consolas, monospace; color: var(--faint) !important; word-break: break-all; max-width: 30em !important; }
/* An Kunden senden */
.send-sheet { width: min(700px, 100%); }
.send-grid { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
.qr-box { display: grid; justify-items: center; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.qr-box canvas { display: block; width: 232px; height: 232px; image-rendering: pixelated; }
.qr-box small { color: #5E6461; font-size: 12px; }
.send-status { margin: 4px 0 14px; padding: 10px 14px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 14px; }
.send-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.send-code { margin: 0; font-size: 14px; }
.send-code strong { font: 700 18px/1 ui-monospace, Consolas, monospace; letter-spacing: .12em; color: var(--ink); }
.send-code small { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.send-note { margin: 16px 0 4px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.big-code { font: 700 22px/1 ui-monospace, Consolas, monospace; letter-spacing: .14em; color: var(--ink); }
.code-input { text-align: center; font: 700 24px/1 ui-monospace, Consolas, monospace; letter-spacing: .3em; height: 56px; }
@media (max-width: 620px) { .send-grid { grid-template-columns: 1fr; justify-items: stretch; } .qr-box { justify-self: center; } }
/* Offene Sendungen auf dem Startbildschirm */
.sends { margin: 24px 0 0; display: grid; gap: 8px; }
.send-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); }
.send-item > div { flex: 1; min-width: 0; }
.send-item strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-item small { color: var(--muted); font-size: 12px; }
.send-item.ready { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
/* Empfänger: Feder-Funktionen zum Bearbeiten ausblenden */
[data-recipient="1"] .start, [data-recipient="1"] #btnGuide { display: none !important; }
/* Hinweis-Dialog */
.ask-body { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.ask-body p { margin: 0 0 10px; }
.ask-body ul, .ask-body ol { margin: 0 0 12px; padding-left: 20px; }
.ask-body li { margin: 3px 0; }
.ask-list { list-style: none; padding: 0 !important; display: grid; gap: 6px; }
.ask-list button { width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; font-size: 14px; }
.ask-list button:hover { border-color: var(--brand); }
.ask-list small { color: var(--faint); white-space: nowrap; }
.legal-grid { display: grid; gap: 10px; }
.legal-grid section { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); }
.legal-grid h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14.5px; }
.legal-grid h3 i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.legal-grid ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.legal-note { margin-top: 12px !important; font-size: 12.5px; color: var(--faint); }
.save-info { margin: 0 0 14px; color: var(--muted); font-size: 13px; min-height: 1.4em; }
.save-info.warn { color: var(--bad); }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.text-input {
  width: 100%; height: 46px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
}
.text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.ask-field { display: block; margin: 4px 0 6px; }
.ask-field .text-input { font: inherit; font-size: 16px; color: var(--ink); }

@media (max-width: 720px) {
  .modal { padding: 0; align-items: flex-end; }
  .sheet { border-radius: 24px 24px 0 0; width: 100%; }
  .sig-sheet { height: 100%; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .sig-sheet .sheet-head { padding: 8px 8px 6px 16px; }
  .sig-sheet .pad-wrap { flex: 1; height: auto; min-height: 160px; margin: 0 10px; }
  .sig-sheet .pad-tools { padding: 10px 12px 0; gap: 8px; }
  .sig-sheet .recent-sigs { padding: 0 12px 8px; }
  .sig-sheet .sign-all { margin: 10px 10px 0; }
  .sig-sheet .sheet-foot { padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
  .sig-sheet .sheet-foot .btn { flex: 1; height: 50px; font-size: 15px; }
  .save-sheet .sheet-foot { flex-direction: column-reverse; }
  .save-sheet .sheet-foot .btn { width: 100%; height: 50px; }
}
/* Handy quer: Unterschriftsfeld nimmt fast alles ein */
@media (max-height: 520px) and (orientation: landscape) {
  .modal { padding: 0; }
  .sig-sheet { height: 100%; width: 100%; max-width: none; border-radius: 0; display: grid;
    grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto auto;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .sig-sheet .sheet-head { grid-column: 1 / -1; padding: 4px 8px 2px 16px; }
  .sig-sheet .sheet-head h2 { font-size: 15px; }
  .sig-sheet .recent-sigs { display: none !important; }
  .sig-sheet .pad-wrap { grid-column: 1; grid-row: 2 / 5; height: auto; min-height: 0; margin: 0 0 8px 10px; }
  .sig-sheet .pad-tools { grid-column: 2; grid-row: 2; flex-direction: column; align-items: stretch; padding: 0 10px; gap: 8px; }
  .sig-sheet .pad-tools .spacer { display: none; }
  .sig-sheet .swatches { flex-wrap: wrap; width: 130px; }
  .sig-sheet .sign-all { grid-column: 2; grid-row: 3; margin: 8px 10px 0; width: 150px; font-size: 12px; padding: 8px 10px; }
  .sig-sheet .sheet-foot { grid-column: 2; grid-row: 4; flex-direction: column-reverse; padding: 8px 10px max(8px, env(safe-area-inset-bottom)); gap: 6px; }
  .sig-sheet .sheet-foot .btn { height: 40px; }
}

/* ---------- Sonstiges ---------- */
.busy {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(15, 20, 17, .45); color: #fff; font-weight: 600;
}
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: max(24px, calc(env(safe-area-inset-bottom) + 120px)); z-index: 70;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 11px 20px;
  background: var(--pill); color: var(--pill-ink); border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  font-size: 14px; font-weight: 500; transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); color: #fff; border-radius: 18px; }

.drop-overlay {
  position: fixed; inset: 12px; z-index: 80;
  display: grid; place-items: center;
  border: 2.5px dashed var(--brand); border-radius: 24px;
  background: color-mix(in srgb, var(--brand-soft) 85%, transparent);
  color: var(--brand); font-size: 20px; font-weight: 700; pointer-events: none;
}
