/* Leinwand – Designsystem Phase 1
   Tokens → Basis → Layout → Komponenten → Seiten. Keine externen Fonts (CSP + offlinefähig). */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 180ms;

  --accent: #6a5cff; --accent-strong: #5646f2; --accent-soft: rgba(106, 92, 255, .12);
  --teal: #20b8ad;
  --danger: #e5484d; --danger-soft: rgba(229, 72, 77, .1);
  --success: #2f9e6e; --success-soft: rgba(47, 158, 110, .12);
  --warning: #c98a12; --warning-soft: rgba(201, 138, 18, .13);
}

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f2; --bg-elev: #ffffff; --bg-sunken: #efede8;
  --text: #1b1a1f; --text-2: #55535e; --text-3: #8b8994;
  --line: rgba(27, 26, 31, .09); --line-strong: rgba(27, 26, 31, .16);
  --shadow-sm: 0 1px 2px rgba(20, 18, 30, .05), 0 1px 1px rgba(20, 18, 30, .03);
  --shadow-md: 0 8px 24px -8px rgba(30, 24, 60, .14), 0 2px 6px rgba(20, 18, 30, .05);
  --shadow-lg: 0 30px 60px -20px rgba(30, 24, 60, .28), 0 8px 20px -8px rgba(20, 18, 30, .1);
  --focus: 0 0 0 3px rgba(106, 92, 255, .35);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e13; --bg-elev: #17171e; --bg-sunken: #0a0a0e;
  --text: #f1f0f5; --text-2: #b0aebb; --text-3: #7a7886;
  --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .75);
  --accent: #8b7fff; --accent-strong: #a197ff; --accent-soft: rgba(139, 127, 255, .16);
  --focus: 0 0 0 3px rgba(139, 127, 255, .45);
}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    color-scheme: dark;
    --bg: #0e0e13; --bg-elev: #17171e; --bg-sunken: #0a0a0e;
    --text: #f1f0f5; --text-2: #b0aebb; --text-3: #7a7886;
    --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .75);
    --accent: #8b7fff; --accent-strong: #a197ff; --accent-soft: rgba(139, 127, 255, .16);
    --focus: 0 0 0 3px rgba(139, 127, 255, .45);
  }
}

/* ───────── Basis */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font-sans); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--font-mono); font-size: .92em; }
svg { flex-shrink: 0; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -3rem; background: var(--accent); color: #fff; padding: .5rem .9rem; border-radius: var(--r-sm); z-index: 100; transition: top var(--dur); }
.skip-link:focus { top: 1rem; }
.muted { color: var(--text-2); }
.note { color: var(--text-3); font-size: 13px; margin-top: 1.2rem; }
.h3 { font-size: 16px; margin: 1.5rem 0 .6rem; }

.display { font-family: var(--font-serif); font-weight: 600; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.025em; }
.display-sm { font-family: var(--font-serif); font-weight: 600; font-size: 30px; margin-bottom: 1.5rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: .5rem; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--text-2); margin-bottom: 1rem; }

/* ───────── Buttons */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: var(--h); padding: 0 1.05rem; border-radius: 999px; border: 1px solid transparent;
  font: 500 14px/1 var(--font-sans); cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur), transform var(--dur) var(--ease), box-shadow var(--dur);
  text-decoration: none !important;
}
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 16px -6px rgba(106, 92, 255, .6); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--bg-elev); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--text-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { --h: 32px; padding: 0 .8rem; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--text-2); font: inherit; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--text); text-decoration: underline; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; font-size: 20px; line-height: 1;
  transition: background var(--dur), color var(--dur);
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn svg circle[r="1.6"] { fill: currentColor; stroke: none; }

/* ───────── Formulare */
.form { display: grid; gap: 1rem; margin-top: 1.25rem; }
.field { display: grid; gap: .4rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 500; color: var(--text-2); padding: 0; margin-bottom: .1rem; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]), select {
  width: 100%; height: 44px; padding: 0 .9rem; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--text);
  font: 15px var(--font-sans); transition: border-color var(--dur), box-shadow var(--dur);
}
select { appearance: none; padding-right: 2.2rem; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input::placeholder { color: var(--text-3); }
.hint { color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.otp-input { font: 600 24px/1 var(--font-mono) !important; letter-spacing: .35em; text-align: center; height: 56px !important; }
.otp-input.sm { font-size: 18px !important; height: 44px !important; letter-spacing: .25em; }
.strength { display: block; height: 4px; border-radius: 4px; background: var(--bg-sunken); overflow: hidden; }
.strength i { display: block; height: 100%; width: 0; background: var(--danger); transition: width 250ms var(--ease), background 250ms; }
.strength[data-level="2"] i { background: var(--warning); }
.strength[data-level="3"] i { background: var(--teal); }
.strength[data-level="4"] i { background: var(--success); }

/* ───────── Meldungen */
.flashes { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.flash { padding: .7rem .95rem; border-radius: var(--r-md); font-size: 14px; border: 1px solid transparent; margin-bottom: .25rem; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(229, 72, 77, .25); }
.flash-success { background: var(--success-soft); color: var(--success); border-color: rgba(47, 158, 110, .25); }
.flash-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(201, 138, 18, .3); }
.flash-info { background: var(--accent-soft); color: var(--accent); }

/* ───────── Anmeldeseiten */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; overflow-x: hidden; }
.auth-backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.auth-backdrop span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: drift 26s var(--ease) infinite alternate; }
.auth-backdrop span:nth-child(1) { width: 520px; height: 520px; background: #8b7fff; left: -140px; top: -160px; }
.auth-backdrop span:nth-child(2) { width: 420px; height: 420px; background: #2fd3c6; right: -120px; bottom: -120px; opacity: .35; animation-duration: 32s; }
.auth-backdrop span:nth-child(3) { width: 300px; height: 300px; background: #ff9a6b; right: 18%; top: -120px; opacity: .25; animation-duration: 38s; }
[data-theme="dark"] .auth-backdrop span { opacity: .28; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .auth-backdrop span { opacity: .28; } }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.08); } }
.auth-main { width: 100%; max-width: 440px; }
.auth-brand { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-bottom: 1.5rem; font: 600 20px var(--font-serif); letter-spacing: -.02em; }
.auth-card {
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line); border-radius: var(--r-xl); padding: 2.25rem; box-shadow: var(--shadow-lg);
}
.auth-title { font: 600 26px/1.2 var(--font-serif); letter-spacing: -.02em; margin-bottom: .5rem; }
.auth-alt { text-align: center; margin: 1.25rem 0 0; font-size: 14px; color: var(--text-2); }
.auth-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 1.5rem; }
.disclosure { margin-top: 1.25rem; font-size: 14px; color: var(--text-2); }
.disclosure summary { cursor: pointer; color: var(--text); }
.disclosure p { margin: .6rem 0 0; }
.steps { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1.5rem; font-size: 12px; color: var(--text-3); }
.steps li { flex: 1; padding-top: .55rem; border-top: 3px solid var(--line-strong); }
.steps li.done { border-color: var(--teal); color: var(--text-2); }
.steps li.current { border-color: var(--accent); color: var(--text); font-weight: 600; }

.qr-wrap { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: center; margin: 1.25rem 0 .25rem; }
.qr { background: #fff; padding: 6px; border-radius: var(--r-md); box-shadow: var(--shadow-md); line-height: 0; }
.qr svg { width: 168px; height: 168px; }
.qr-manual { display: grid; gap: .5rem; justify-items: start; }
.qr-manual .label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.secret { font-size: 15px; letter-spacing: .06em; word-spacing: .2em; background: var(--bg-sunken); padding: .5rem .7rem; border-radius: var(--r-sm); word-break: keep-all; overflow-wrap: normal; max-width: 15ch; }

.codes-box { margin-top: 1.25rem; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 1.1rem; background: var(--bg-sunken); }
.codes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .45rem 1rem; counter-reset: c; }
.codes li { font-size: 16px; letter-spacing: .04em; counter-increment: c; display: flex; gap: .5rem; align-items: baseline; }
.codes li::before { content: counter(c, decimal-leading-zero); font: 11px var(--font-mono); color: var(--text-3); }
.codes-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.checklist { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; gap: .55rem; }
.checklist li { display: flex; gap: .7rem; align-items: flex-start; font-size: 14px; }
.checklist li small { display: block; color: var(--text-3); font-size: 12.5px; }
.checklist .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); margin-top: 6px; box-shadow: 0 0 0 4px var(--success-soft); }
.checklist .bad .dot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.invite-list { display: grid; gap: .6rem; margin: 1.25rem 0 .5rem; }
.invite { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; background: var(--bg-sunken); border-radius: var(--r-md); }
.invite-name { font-weight: 600; }
.invite code { font-size: 15px; letter-spacing: .05em; }
.next-steps { padding-left: 1.2rem; color: var(--text-2); font-size: 14px; margin: 0 0 1.5rem; }
.next-steps li { margin-bottom: .35rem; }

/* ───────── App-Rahmen */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 2rem;
  height: 64px; padding: 0 clamp(1rem, 3vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font: 600 18px var(--font-serif); letter-spacing: -.02em; text-decoration: none !important; }
.topnav { display: flex; gap: .25rem; }
.topnav a { color: var(--text-2); padding: .45rem .8rem; border-radius: 999px; font-size: 14px; font-weight: 500; text-decoration: none; transition: background var(--dur), color var(--dur); }
.topnav a:hover { color: var(--text); background: var(--bg-sunken); }
.topnav a[aria-current] { color: var(--text); background: var(--bg-elev); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--teal)); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; }
[data-theme-toggle] svg { display: none; }
[data-theme-toggle] .fill { fill: currentColor; }
[data-theme="light"] [data-theme-toggle] .i-sun, [data-theme="dark"] [data-theme-toggle] .i-moon, [data-theme="system"] [data-theme-toggle] .i-auto { display: block; }
.main { max-width: 1240px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2.5rem) 5rem; }

/* ───────── Dashboard */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.hero-actions { display: flex; gap: .6rem; }
.templates { margin-bottom: 2.75rem; }
.template-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.template-card {
  display: grid; gap: .35rem; text-align: left; padding: .7rem .7rem 1rem; cursor: pointer; font: inherit; color: inherit;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur);
}
.template-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.template-art { display: block; position: relative; aspect-ratio: 16 / 8; border-radius: var(--r-md); overflow: hidden; margin-bottom: .45rem; background: var(--bg-sunken); }
.template-art i { position: absolute; display: block; border-radius: 4px; }
.template-art i:nth-child(1) { left: 12%; top: 26%; width: 44%; height: 10%; background: var(--text); opacity: .75; }
.template-art i:nth-child(2) { left: 12%; top: 45%; width: 28%; height: 7%; background: var(--text-3); }
.template-art i:nth-child(3) { right: 10%; top: 18%; width: 26%; aspect-ratio: 1; border-radius: 50%; background: var(--accent); opacity: .5; }
.template-pitch { background: linear-gradient(135deg, #1e1b4b, #4c1d95); }
.template-pitch i:nth-child(1), .template-pitch i:nth-child(2) { background: #fff; }
.template-pitch i:nth-child(3) { background: #f0abfc; opacity: .8; }
.template-status { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.template-status i:nth-child(1) { background: #064e3b; }
.template-status i:nth-child(3) { border-radius: 4px; width: 8%; height: 40%; aspect-ratio: auto; top: 40%; right: 30%; background: #10b981; box-shadow: 22px -12px 0 #059669, 44px -24px 0 #047857; opacity: 1; }
.template-workshop { background: linear-gradient(135deg, #fff7ed, #ffedd5); }
.template-workshop i:nth-child(1) { background: #7c2d12; }
.template-workshop i:nth-child(3) { background: #fb923c; opacity: .7; }
/* Bericht: Säulen */
.template-report { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
.template-report i:nth-child(1) { background: #312e81; width: 34%; }
.template-report i:nth-child(2) { left: 12%; top: auto; bottom: 16%; width: 44%; height: 44%; border-radius: 0;
  background: linear-gradient(#6366f1, #6366f1) 0 100% / 18% 45% no-repeat, linear-gradient(#818cf8, #818cf8) 33% 100% / 18% 70% no-repeat,
              linear-gradient(#6366f1, #6366f1) 66% 100% / 18% 58% no-repeat, linear-gradient(#818cf8, #818cf8) 100% 100% / 18% 92% no-repeat; }
.template-report i:nth-child(3) { border-radius: 50%; width: 22%; right: 10%; top: 30%; background: conic-gradient(#6366f1 0 55%, #a5b4fc 0 85%, #312e81 0); opacity: 1; }
/* Roadmap: Zeitachse */
.template-roadmap { background: linear-gradient(135deg, #f0fdfa, #ccfbf1); }
.template-roadmap i:nth-child(1) { background: #134e4a; width: 30%; }
.template-roadmap i:nth-child(2) { background: #0f766e; left: 12%; top: 66%; width: 76%; height: 4%; opacity: .5; }
.template-roadmap i:nth-child(3) { left: 14%; right: auto; top: 61%; width: 7%; aspect-ratio: 1; border-radius: 50%; background: #0d9488; opacity: 1; box-shadow: 40px 0 0 #0d9488, 80px 0 0 #0d9488, 120px 0 0 #14b8a6; }
/* Zoom-Story: Bereiche auf großer Fläche */
.template-story { background: radial-gradient(circle at 30% 30%, #312e81, #0f1022 70%); }
.template-story i:nth-child(1) { left: 16%; top: 18%; width: 44%; height: 40%; border-radius: 6px; background: #1a1b3a; box-shadow: 0 0 0 2px #8b7fff; opacity: 1; }
.template-story i:nth-child(2) { left: 18%; top: 70%; width: 16%; height: 16%; border-radius: 4px; background: #1a1b3a; box-shadow: 30px 0 0 #1a1b3a, 60px 0 0 #1a1b3a; }
.template-story i:nth-child(3) { right: 10%; top: 18%; width: 22%; border-radius: 50%; background: none; border: 2px dashed #3ddbd9; opacity: .9; }
.template-name { font-weight: 600; padding: 0 .3rem; }
.template-desc { font-size: 13px; color: var(--text-2); padding: 0 .3rem; line-height: 1.4; }

.grid { display: grid; gap: 1.25rem; list-style: none; padding: 0; margin: 0 0 2.75rem; }
.grid-recent { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-md); background: var(--bg-sunken); }
.thumb-svg { display: block; width: 100%; height: 100%; }
.thumb-live { display: grid; place-items: center; width: 100%; height: 100%; }
.thumb-frame { width: 100%; }
.thumb .lw-frame { pointer-events: none; }
.menu-sep { border: 0; border-top: 1px solid var(--line); margin: .3rem .2rem; }
.recent-card { display: grid; gap: .65rem; color: inherit; text-decoration: none !important; }
.recent-card .thumb { box-shadow: var(--shadow-md); transition: transform 260ms var(--ease), box-shadow 260ms; }
.recent-card:hover .thumb { transform: translateY(-3px) scale(1.01); box-shadow: var(--shadow-lg); }
.recent-meta { display: grid; }
.recent-meta small { color: var(--text-3); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.toolbar .section-title { margin: 0; }
.toolbar-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-sunken); border-radius: 999px; border: 1px solid var(--line); }
.segmented a, .segmented-radio label span { display: block; padding: .38rem .8rem; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2); text-decoration: none; cursor: pointer; transition: background var(--dur), color var(--dur); }
.segmented a:hover, .segmented-radio label:hover span { color: var(--text); }
.segmented a[aria-current], .segmented-radio input:checked + span { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented-radio input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-radio input:focus-visible + span { box-shadow: var(--focus); }
.search { position: relative; display: block; }
.search svg { position: absolute; left: .8rem; top: 50%; translate: 0 -50%; width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; }
.search input { height: 38px !important; padding-left: 2.3rem !important; width: 220px !important; border-radius: 999px !important; font-size: 14px !important; }
.select select { height: 38px; border-radius: 999px; font-size: 14px; width: auto; background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px; }

.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .6rem; box-shadow: var(--shadow-sm);
  transition: transform 220ms var(--ease), box-shadow 220ms, border-color 220ms; position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card-link { display: block; }
.card-body { padding: .75rem .4rem .3rem; }
.card-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: .4rem; }
.card-title { color: var(--text); font-weight: 600; line-height: 1.3; padding-top: .35rem; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; color: var(--text-3); font-size: 12.5px; margin-top: .2rem; }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 999px; background: var(--bg-sunken); color: var(--text-2); font-size: 11.5px; font-weight: 500; border: 1px solid var(--line); }
.tag-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 190px; padding: .35rem;
  background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  animation: pop 140ms var(--ease);
}
.menu-pop form { margin: 0; }
.menu-item { display: block; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: var(--r-sm); background: none; border: 0; font: 14px var(--font-sans); color: var(--text); cursor: pointer; text-decoration: none !important; }
.menu-item:hover { background: var(--bg-sunken); }
.menu-item.danger { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.empty { text-align: center; padding: 4rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--r-xl); background: color-mix(in srgb, var(--bg-elev) 50%, transparent); }
.empty h3 { font: 600 22px var(--font-serif); margin-bottom: .4rem; }
.empty .btn { margin-top: .5rem; }
.empty-art { position: relative; width: 120px; height: 80px; margin: 0 auto 1.5rem; }
.empty-art i { position: absolute; inset: 0; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg-elev); box-shadow: var(--shadow-md); }
.empty-art i:nth-child(1) { transform: rotate(-8deg) translate(-14px, 4px); opacity: .5; }
.empty-art i:nth-child(2) { transform: rotate(6deg) translate(14px, 2px); opacity: .75; }
.empty-art i:nth-child(3) { background: linear-gradient(135deg, var(--accent), var(--teal)); border: 0; }

/* ───────── Dialoge */
.dialog {
  width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 1.75rem; border: 1px solid var(--line);
  border-radius: var(--r-xl); background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog[open] { animation: dialog-in 220ms var(--ease); }
.dialog::backdrop { background: rgba(10, 10, 20, .45); backdrop-filter: blur(4px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.dialog .form { margin: 0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { font: 600 22px var(--font-serif); }
.dialog-foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
.radio-cards { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-card input, .swatch input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card span { display: block; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 14px; cursor: pointer; transition: all var(--dur); }
.radio-card input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.radio-card input:focus-visible + span, .swatch input:focus-visible + svg { box-shadow: var(--focus); }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; }
.swatch { display: grid; gap: .3rem; justify-items: center; font-size: 12px; color: var(--text-2); cursor: pointer; }
.swatch svg { width: 100%; border-radius: 8px; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color var(--dur); }
.swatch input:checked + svg { outline-color: var(--accent); }
.dropzone { position: relative; display: grid; place-items: center; padding: 2rem 1rem; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--text-2); text-align: center; cursor: pointer; transition: border-color var(--dur), background var(--dur); }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ───────── Detailseite */
.crumbs { display: flex; gap: .5rem; font-size: 13px; color: var(--text-3); margin-bottom: 1.5rem; }
.crumbs a { color: var(--text-2); }
.detail { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; margin-bottom: 2.5rem; }
.thumb-lg { border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.inline-title { display: flex; gap: .5rem; align-items: center; margin-bottom: 1.25rem; }
.title-input { font: 600 26px var(--font-serif) !important; height: 52px !important; border-color: transparent !important; background: transparent !important; padding: 0 .4rem !important; margin-left: -.4rem; }
.title-input:hover { border-color: var(--line-strong) !important; }
.title-input:focus { border-color: var(--accent) !important; background: var(--bg-elev) !important; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem 1.5rem; margin: 0 0 1.5rem; }
.facts dt { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.facts dd { margin: .15rem 0 0; font-weight: 500; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.detail-actions form { margin: 0; }
.panel { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm); }
.panel-danger { border-color: rgba(229, 72, 77, .3); }
.outline { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; }
.outline li { display: flex; gap: .9rem; align-items: center; padding: .5rem .3rem; border-bottom: 1px solid var(--line); }
.outline li:last-child { border-bottom: 0; }
.outline .num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--bg-sunken); font: 600 12px var(--font-mono); color: var(--text-2); }
.share-form { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.danger-form { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.danger-form .field { flex: 1; min-width: 220px; max-width: 340px; }

/* ───────── Einstellungen */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1.25rem; align-items: start; }
.settings-grid .panel { margin: 0; }
.settings-grid .form { margin-top: .25rem; }
.form-inline { display: flex; gap: .5rem; align-items: center; }
.stat { font-size: 15px; color: var(--text-2); }
.stat strong { font: 600 28px var(--font-serif); color: var(--text); margin-right: .25rem; }
.events { list-style: none; padding: 0; margin: 0; }
.events li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--text-3); white-space: nowrap; }
.events li.warn span { color: var(--danger); }

/* ───────── Responsiv */
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { gap: .75rem; }
  .brand span { display: none; }
  .topnav a { padding: .4rem .55rem; }
  .topbar-actions .avatar { display: none; }
  .auth-card { padding: 1.5rem; }
  .qr-wrap { grid-template-columns: 1fr; justify-items: center; }
  .search input { width: 100% !important; }
  .toolbar-form { width: 100%; }
  .swatches { grid-template-columns: repeat(3, 1fr); }
  .codes { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media print {
  body { background: #fff; color: #000; }
  .topbar, .auth-backdrop, .auth-brand, .auth-foot, .codes-actions, form, .steps, .flashes, .btn { display: none !important; }
  .auth-card, .codes-box { box-shadow: none; border: 1px solid #999; background: #fff; backdrop-filter: none; }
}

/* ───────── Claude / MCP (Einstellungen) */
.panel-wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.panel-head .section-title { margin: 0; }
.pill { font-size: 12px; padding: .2rem .6rem; border-radius: 999px; background: var(--line); color: var(--text-2); }
.pill-on { background: var(--success-soft); color: var(--success); }
.sub-title { font-size: 14px; font-weight: 600; margin: 1.4rem 0 .6rem; }
.mcp-endpoint { margin: 1rem 0 .5rem; }
.mcp-endpoint .label { display: block; font-size: 12.5px; color: var(--text-3); margin-bottom: .35rem; }
.mcp-endpoint .hint, .mcp-endpoint .flash { margin-top: .6rem; }
.copy-row { display: flex; gap: .5rem; align-items: center; }
.copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: .55rem .75rem; border-radius: var(--r-md, 10px); background: var(--bg); border: 1px solid var(--line); font-size: 13px; }
.mcp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.item-list li:last-child { border-bottom: 0; }
.item-list .meta { display: block; color: var(--text-3); font-size: 12.5px; margin-top: .15rem; }
.form-inline .grow { flex: 1; font-size: 13px; }
.form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.form-row .field { flex: 1 1 180px; margin: 0; }
.form-row p { flex-basis: 100%; }
@media (max-width: 860px) { .mcp-grid { grid-template-columns: 1fr; } }

/* ───────── OAuth-Zustimmung */
.consent-app { display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md, 10px); margin: 1rem 0; }
.consent-app .host { display: block; color: var(--text-3); font-size: 12.5px; overflow-wrap: anywhere; }
.consent-list { margin: .5rem 0 1rem; padding-left: 1.1rem; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.consent-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.consent-actions .btn { flex: 1; }
