/* App-Layer (Wizard, Konto, Einstellungen, Auth) AUF dem Design-System. Wird wie
   design-system.css ueber den oeffentlichen Marketing-Mount ausgeliefert (/assets/app.css).
   Klassen- und ID-Namen sind der Vertrag mit dem bestehenden Seiten-JavaScript und
   werden hier nur gestylt, nie umbenannt. Zustaende, die das JS setzt: .active, .done,
   .selected, .visible, .batch-row-error, das hidden-Attribut und display-Inline-Styles. */

/* Alias-Tokens fuer Inline-Styles, die das bestehende Seiten-JS noch erzeugt
   (settings.html: --muted, --accent-dim). Nicht in neuem CSS verwenden. */
:root { --muted: var(--text-dim); --accent-dim: var(--accent-soft); }

/* ---------- Shell: Topbar + Sidebar (Desktop) / Tab-Leiste (Mobil) ---------- */
header.topbar {
  height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 15.5px; text-decoration: none; color: var(--text); }
.topbar .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex-shrink: 0; box-shadow: 0 4px 12px -4px var(--accent-glow); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.beta-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-dim); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 11px; white-space: nowrap; }
#tokenChip { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); }
a.exit-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600;
  color: var(--text-dim); text-decoration: none; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
a.exit-link:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-raised); }

.shell { display: flex; min-height: calc(100vh - 64px); }
aside.sidebar {
  width: 232px; flex-shrink: 0; border-right: 1px solid var(--border-soft);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.sidebar .group-label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); padding: 8px 12px 6px; }
.sidebar a, .sidebar .nav-disabled {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: var(--text-dim); text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.sidebar a:hover { background: var(--bg-raised); color: var(--text); }
.sidebar a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.sidebar .nav-disabled { color: var(--text-faint); cursor: default; }
.sidebar .nav-disabled .soon { margin-left: auto; font-size: 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 1px 7px; }

/* Tab-Leiste unten (nur mobil, siehe Media Query) */
nav.tabbar { display: none; }

main.content { flex: 1; min-width: 0; padding: 40px 32px 96px; }
main.content h1 { font-size: 28px; margin: 0 0 6px; }
main.content p.sub { color: var(--text-dim); margin: 0 0 28px; font-size: 15px; }

/* Zweispaltig auf Desktop: Arbeitskarte + Info-Leiste, damit der Platz genutzt wird */
.app-grid { display: grid; grid-template-columns: minmax(0, 720px) minmax(240px, 320px); gap: 24px; align-items: start; }
.app-rail { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 14px; }
.rail-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.rail-card h4 { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin-bottom: 12px; }
.rail-card ol { margin: 0; padding-left: 18px; color: var(--text-dim); font-size: 13.5px; line-height: 1.6; }
.rail-card ol li::marker { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.rail-card p { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 26px; box-shadow: var(--shadow); }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- Formular-Bausteine (alte Klassennamen, neuer Look) ---------- */
label.field-label {
  display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .08em; margin: 20px 0 8px;
}
label.field-label:first-child { margin-top: 0; }
.content input[type="text"], .content input[type="email"], .content input[type="password"], .content textarea,
.auth-card input[type="text"], .auth-card input[type="email"], .auth-card input[type="password"] {
  width: 100%; padding: 13px 14px; font-size: 15px; font-family: var(--font-body);
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.content input[type="text"]::placeholder, .content textarea::placeholder { color: var(--text-faint); }
.content input:hover, .content textarea:hover, .auth-card input:hover { border-color: var(--border-strong); }
.content input[type="text"]:focus, .content input[type="email"]:focus, .content input[type="password"]:focus, .content textarea:focus,
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.content textarea { resize: vertical; margin-bottom: 10px; line-height: 1.5; }
.content input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-dim); font-size: 13.5px; }
.content input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 6px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--panel-2); color: var(--text); cursor: pointer; }

.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill, .marker-chip {
  padding: 10px 16px; font-size: 13.5px; font-weight: 600; font-family: var(--font-body);
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text-dim); cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.marker-chip { padding: 6px 12px; font-size: 12px; }
.pill:hover, .marker-chip:hover { border-color: var(--border-strong); color: var(--text); }
.pill:active { transform: scale(.97); }
.pill.selected, .marker-chip.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill small { display: block; font-weight: 400; opacity: .75; font-size: 11px; margin-top: 1px; }

/* Tarif-Gating (2026-09-17): ausgegraut mit Schloss und "Ab <Tarif>"-Hinweis beim Hover */
/* Gedimmt ueber Farbe statt opacity - sonst erbt der Tooltip (::after) die Transparenz */
.pill.locked {
  position: relative; cursor: not-allowed; color: var(--text-faint); border-style: dashed;
  background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--border) 45%, transparent) 6px 7px);
}
.pill.locked:hover { border-color: var(--border-strong); color: var(--text-dim); }
.pill.locked:active { transform: none; }
.pill.locked::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pill.locked::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  white-space: nowrap; pointer-events: none; opacity: 0;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border-strong);
  font-family: var(--font-body); font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.pill.locked:hover::after, .pill.locked:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.locked-field textarea { opacity: .45; cursor: not-allowed; }
.lock-note { margin: 8px 0 0; font-size: 12.5px; color: var(--accent); }

/* Buttons des Wizards */
button.wizard-next, button#submit, .auth-card button.primary {
  width: 100%; margin-top: 0; padding: 14px 20px; font-size: 15px; font-weight: 700; font-family: var(--font-display);
  border-radius: var(--radius-sm); border: none; background: var(--accent); color: var(--accent-ink); cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur) var(--ease-out);
}
button.wizard-next:hover:not(:disabled), button#submit:hover:not(:disabled), .auth-card button.primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 8px 24px -8px var(--accent-glow); }
button.wizard-next:disabled, button#submit:disabled, .auth-card button.primary:disabled { opacity: .4; cursor: default; }
button#submit { margin-top: 0; }
button.btn-back {
  padding: 14px 20px; font-size: 15px; font-weight: 600; font-family: var(--font-display);
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer;
  flex: 0 0 auto; width: auto; margin-top: 0;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
button.btn-back:hover:not(:disabled) { border-color: var(--border-strong); background: var(--bg-raised); }
button.btn-back:disabled { opacity: .4; cursor: default; }

/* ---------- Wizard ---------- */
.wizard-progress { display: flex; gap: 6px; margin-bottom: 8px; }
.wizard-progress span { height: 4px; flex: 1; border-radius: 2px; background: var(--panel-2); transition: background var(--dur); }
.wizard-progress span.done { background: var(--accent); }
/* Schrittzaehler rein per CSS aus den .done-Segmenten abgeleitet, kein JS noetig */
.wizard-progress::after {
  content: "Schritt 1 von 5"; flex-basis: 100%; order: 10;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing: .04em; margin-top: 4px;
}
.wizard-progress:has(span:nth-child(2).done)::after { content: "Schritt 2 von 5"; }
.wizard-progress:has(span:nth-child(3).done)::after { content: "Schritt 3 von 5"; }
.wizard-progress:has(span:nth-child(4).done)::after { content: "Schritt 4 von 5"; }
.wizard-progress:has(span:nth-child(5).done)::after { content: "Schritt 5 von 5"; }
.wizard-progress { flex-wrap: wrap; margin-bottom: 22px; }

.wizard-step { display: none; }
.wizard-step.active { display: block; animation: step-in var(--dur) var(--ease-out); }
@keyframes step-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.wizard-question { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.01em; }
.wizard-hint { color: var(--text-dim); font-size: 13.5px; margin: 0 0 20px; line-height: 1.5; }
.wizard-nav { display: flex; gap: 10px; margin-top: 22px; }
.wizard-nav button { flex: 1; }

/* VOD-Doppelregler */
.vod-slider-track { position: relative; height: 34px; }
.vod-slider-track input[type="range"] { position: absolute; top: 12px; left: 0; width: 100%; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none; }
.vod-slider-track input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.vod-slider-track input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent-ink); cursor: pointer; margin-top: -7px; box-shadow: var(--shadow-sm); }
.vod-slider-track input[type="range"]::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent-ink); cursor: pointer; }
.vod-slider-track::before { content: ""; position: absolute; top: 15px; left: 0; right: 0; height: 4px; background: var(--panel-2); border-radius: var(--radius-pill); }
.vod-slider-range { position: absolute; top: 15px; height: 4px; background: var(--accent); border-radius: var(--radius-pill); }

/* Batch-Zeilen, Analyse-Kandidaten */
.batch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-raised); border: 1px solid var(--border); margin-bottom: 8px; font-size: 13.5px; }
.batch-row-label { font-family: var(--font-mono); font-weight: 600; color: var(--text); flex-shrink: 0; }
.batch-row-status { color: var(--text-dim); text-align: right; }
.batch-row-status.batch-row-error { color: var(--danger); }
.batch-row-status a.dl-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.analyze-candidate { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--bg-raised); border: 1px solid var(--border); margin-bottom: 10px; }
.analyze-candidate video { width: 130px; max-height: 160px; border-radius: var(--radius-sm); background: #000; flex-shrink: 0; }
.analyze-candidate-info { flex: 1; min-width: 0; }
.analyze-candidate-label { font-weight: 600; font-size: 14px; color: var(--text); }
.analyze-candidate-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.4; }
.analyze-candidate-check { flex-shrink: 0; align-self: center; width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- Status-Log + Fortschritt ---------- */
/* Freundliche Statuszeile (2026-09-17): eine gut lesbare Zeile statt Log-Box */
#status {
  margin-top: 22px; font-family: var(--font-body); font-size: 15px; font-weight: 600; color: var(--text);
  display: none;
}
#status.visible { display: block; }
/* Balken erscheint, solange die Statuszeile sichtbar ist */
.job-progress { display: none; margin-top: 10px; }
#status.visible + .job-progress { display: block; }
.job-progress .label { display: flex; justify-content: space-between; font-family: var(--font-body); font-size: 12.5px; color: var(--text-faint); margin-bottom: 8px; }
.job-progress .progress { height: 8px; }

/* ---------- Ergebnis ---------- */
#result { margin-top: 16px; }
#resultVideo { display: block; width: 100%; max-width: 300px; max-height: 70vh; margin: 0 auto 14px; border-radius: var(--radius); background: #000; box-shadow: var(--shadow); }
#result a.download {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 18px;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-sm); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px;
  transition: background var(--dur-fast), transform var(--dur-fast);
}
#result a.download:hover { background: var(--accent-hover); transform: translateY(-1px); }
.error { color: var(--danger); font-size: 14px; background: var(--danger-soft); border-radius: var(--radius-sm); padding: 10px 12px; }

.reframe-box { margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--border); }
#reframeFrame { position: relative; width: 100%; max-width: 480px; margin-top: 10px; user-select: none; touch-action: none; cursor: crosshair; border-radius: var(--radius-sm); overflow: visible; display: none; }
#reframeFrame img { display: block; width: 100%; height: auto; pointer-events: none; border-radius: var(--radius-sm); }
.rf-box { position: absolute; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); touch-action: none; cursor: move; }
.rf-box.rf-box-2 { border-color: #4dd2ff; background: rgba(77, 210, 255, .18); }
.rf-handle { position: absolute; width: 26px; height: 26px; margin: -13px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent-ink); touch-action: none; box-sizing: border-box; }
.rf-box.rf-box-2 .rf-handle { background: #4dd2ff; }
.rf-handle.nw { left: 0; top: 0; cursor: nwse-resize; }
.rf-handle.ne { left: 100%; top: 0; cursor: nesw-resize; }
.rf-handle.sw { left: 0; top: 100%; cursor: nesw-resize; }
.rf-handle.se { left: 100%; top: 100%; cursor: nwse-resize; }
.rf-delete { position: absolute; top: -14px; right: -14px; width: 26px; height: 26px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; cursor: pointer; touch-action: none; }
#reframeHint { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }
#reframeApply { margin-top: 12px; width: 100%; }

.feedback-box { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
#feedbackSent { color: var(--ok); font-size: 13.5px; margin: 4px 0 0; }

.optin { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; color: var(--text-dim); margin: 20px 0 4px; line-height: 1.45; }
.optin input { accent-color: var(--accent); margin-top: 2px; }

.content footer { margin-top: 40px; }
.content footer p { font-size: 12px; color: var(--text-faint); line-height: 1.6; }
.content footer a { color: var(--text-dim); }

/* ---------- Auth-Seiten (Login, Registrierung, Reset) ---------- */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow-x: hidden; }
body.auth::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(50% 40% at 50% 0%, var(--accent-soft), transparent 70%); }
.auth-card { position: relative; width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: var(--shadow-lg); animation: auth-in var(--dur-slow) var(--ease-out); }
@keyframes auth-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 15px; text-decoration: none; color: var(--text); margin-bottom: 26px; }
.auth-brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; }
.auth-card h1 { font-size: 23px; margin: 0 0 6px; }
.auth-card p.sub { color: var(--text-dim); margin: 0 0 24px; font-size: 14px; }
.auth-card label.field-label { margin: 18px 0 8px; }
.auth-card label.field-label:first-of-type { margin-top: 0; }
.auth-card .hint { color: var(--text-faint); font-size: 12px; margin-top: 6px; }
.auth-card button.primary { margin-top: 22px; }
.auth-card .error { display: none; margin-top: 14px; font-size: 13.5px; }
.auth-card .error.visible { display: block; }
.auth-card .ok-box { display: none; margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); color: var(--text); font-size: 13.5px; line-height: 1.5; }
.auth-card .ok-box.visible { display: block; }
.auth-card .links { margin-top: 20px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.auth-card .links.center { justify-content: center; }
.auth-card .links a { color: var(--text-dim); text-decoration: none; }
.auth-card .links a:hover { color: var(--text); }
.auth-card .remember { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; }
.auth-card .remember input { accent-color: var(--accent); }
.totp-step, .step { display: none; }
.totp-step.active, .step.active { display: block; }
.step-login { display: block; }
.step-login.hidden { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .app-grid { grid-template-columns: 1fr; }
  .app-rail { position: static; }
}
@media (max-width: 720px) {
  header.topbar { padding: 0 16px; }
  .topbar-right a.exit-link { display: none; }
  .shell { flex-direction: column; }
  aside.sidebar { display: none; }
  main.content { padding: 24px 16px 96px; }
  .card { padding: 22px 18px; }
  nav.tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-soft); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  nav.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: var(--radius-sm); font-size: 11.5px; font-weight: 600; color: var(--text-dim); text-decoration: none; }
  nav.tabbar a.active { color: var(--accent); background: var(--accent-soft); }
  nav.tabbar svg { width: 20px; height: 20px; }
  .wizard-nav { flex-wrap: wrap; }
  .wizard-nav button.btn-back { flex: 1 1 100%; order: 2; }
}

/* Balken weg, sobald ein Ergebnis oder ein Fehler unter dem Log steht (der Log selbst bleibt sichtbar) */
.job-progress:has(+ #result .error), .job-progress:has(+ #result video), .job-progress:has(+ #result a.download) { display: none; }
#result .error { margin-top: 12px; }

/* Lange Tokens im Log (z. B. Koordinaten-Arrays) duerfen die Karte nicht aufweiten */
#status { overflow-wrap: anywhere; }
.card { min-width: 0; }
#result, .reframe-box, .feedback-box { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Konto (Meine Clips, Tokens, Medien) und Einstellungen ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { margin: 0 0 4px; }
.page-head p.sub { margin: 0; }
.app-grid.wide { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); }
.stack > .card + .card { margin-top: 20px; }
.card h2 { font-size: 17px; margin: 0 0 4px; letter-spacing: -0.01em; }
.card p.desc { color: var(--text-dim); font-size: 13.5px; margin: 0 0 16px; line-height: 1.5; }
.card p.desc:last-child { margin-bottom: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 5px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
.status-chip.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.token-balance { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.token-bar-track { margin-top: 14px; height: 8px; border-radius: var(--radius-pill); background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.token-bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: var(--radius-pill); }

/* Buttons der Konto-/Einstellungsseiten (Klassen aus dem bestehenden JS) */
.content button.primary { padding: 11px 18px; font-size: 14px; font-weight: 700; font-family: var(--font-display); border-radius: var(--radius-sm); border: none; background: var(--accent); color: var(--accent-ink); cursor: pointer; transition: background var(--dur-fast), transform var(--dur-fast); }
.content button.primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.content button.secondary { padding: 11px 18px; font-size: 14px; font-weight: 600; font-family: var(--font-body); border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.content button.secondary:hover:not(:disabled) { border-color: var(--border-strong); background: var(--panel-2); }
.content button.secondary.small { padding: 7px 12px; font-size: 12.5px; font-weight: 600; }
.content button:disabled { opacity: .45; cursor: default; }
.content button.danger-link { background: none; border: none; color: var(--danger); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm); }
.content button.danger-link:hover { background: var(--danger-soft); }
.content .error { display: none; margin-top: 10px; font-size: 13px; }
.content .error.visible { display: block; }
.content input[type="datetime-local"] { padding: 10px 12px; font-size: 13.5px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; font-family: inherit; color-scheme: dark; }
.content input[type="datetime-local"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Clip-Raster mit Thumbnails (Markup aus loadMyClips in account.html) */
#clipsList { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
#clipsList .clip-item-wrap { display: flex; flex-direction: column; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color var(--dur-fast), transform var(--dur) var(--ease-out); }
#clipsList .clip-item-wrap:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.clip-thumb { position: relative; aspect-ratio: 4 / 5; background: var(--panel-2); overflow: hidden; }
.clip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip-thumb.no-thumb img { display: none; }
.clip-thumb.no-thumb::before { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 35%, var(--accent-soft), transparent 70%); }
.clip-thumb.no-thumb::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 22px; transform: translate(-40%, -50%); background: var(--text-faint); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.clip-mode { position: absolute; top: 8px; left: 8px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; padding: 3px 7px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--bg) 78%, transparent); color: var(--text); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#clipsList .clip-item { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
#clipsList .clip-item-info { min-width: 0; }
#clipsList .clip-item-label { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-item-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; font-family: var(--font-mono); }
#clipsList .clip-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
#clipsList .clip-item-actions > * { flex: 1 1 auto; }
#clipsList .clip-item-actions button.secondary.small { padding: 8px 10px; }
.clip-item a.download { display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent); text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); transition: background var(--dur-fast); }
.clip-item a.download:hover { background: var(--accent-hover); }
.clip-preview { padding: 0 12px 12px; }
.clip-preview video { width: 100%; border-radius: var(--radius-sm); background: #000; display: block; }
#clipsList .clip-item-wrap:has(.clip-preview:not([hidden])) .clip-thumb { display: none; }
#clipsList .clip-item-wrap:has(.publish-panel:not([hidden])) { grid-column: 1 / -1; }
#clipsList .clip-item-wrap:has(.publish-panel:not([hidden])) .clip-thumb { aspect-ratio: auto; height: 0; }
#clipsEmpty { display: none; margin: 0; padding: 36px 20px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-dim); font-size: 14px; }
#clipsEmpty a { color: var(--accent); font-weight: 600; text-decoration: none; }
#clipsEmpty a:hover { text-decoration: underline; }
.clip-item-wrap.is-skeleton .clip-thumb { background: var(--panel-2); }
.clip-item-wrap.is-skeleton .clip-item { gap: 8px; }

/* Posten-Panel innerhalb der Karte */
.publish-panel { margin: 0 12px 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.publish-platforms { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.publish-platform-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.publish-platform-row input { accent-color: var(--accent); }
.publish-platform-row img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.publish-schedule-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.publish-schedule-row input { accent-color: var(--accent); }
.publish-cost { font-size: 12px; color: var(--text-dim); margin-top: 8px; font-family: var(--font-mono); }
.publish-empty { font-size: 13px; color: var(--text-dim); margin: 0; }
.publish-empty a { color: var(--accent); }

/* Texte pro Plattform + KI-Zauberstab (2026-09-17) */
.publish-texts { margin: 14px 0 4px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.publish-texts-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.wand-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 12.5px; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), box-shadow var(--dur) var(--ease-out), transform var(--dur-fast);
}
.wand-btn:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); box-shadow: 0 6px 20px -8px var(--accent-glow); }
.wand-btn:active { transform: scale(.97); }
.wand-btn:disabled { cursor: progress; opacity: .85; }
.wand-btn.is-working svg { animation: wand-sparkle 1s ease-in-out infinite; }
@keyframes wand-sparkle { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(-14deg) scale(1.12); } }
.publish-caption-fields { display: flex; flex-direction: column; gap: 10px; }
.publish-caption-field { display: flex; flex-direction: column; gap: 5px; }
.publish-caption-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.publish-caption-label em { font-style: normal; font-weight: 500; color: var(--text-faint); margin-left: 4px; }
.publish-caption-field textarea { width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13.5px; resize: vertical; }
.publish-caption-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Medienbibliothek als Liste */
#mediaList .clip-item-wrap { border-top: 1px solid var(--border); padding: 12px 0; }
#mediaList .clip-item-wrap:first-child { border-top: none; padding-top: 0; }
#mediaList .clip-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.media-item-label { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.media-item-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; font-family: var(--font-mono); }
#mediaEmpty { margin-top: 8px; }

/* Einstellungen */
body.settings .card input[type="text"], body.settings .card input[type="password"] { margin-top: 10px; }
.totp-setup { display: none; margin-top: 16px; }
.totp-setup.active { display: block; }
.totp-setup img { display: block; margin: 10px 0; border-radius: var(--radius-sm); background: #fff; padding: 10px; }
.totp-secret { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); word-break: break-all; }
.card code { font-family: var(--font-mono); font-size: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.card details summary { cursor: pointer; color: var(--text-dim); font-size: 13px; }
.card pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-size: 12px; overflow-x: auto; margin-top: 8px; font-family: var(--font-mono); color: var(--text-dim); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; cursor: pointer; }
.consent input { margin-top: 3px; flex-shrink: 0; accent-color: var(--accent); }

@media (max-width: 960px) { .app-grid.wide { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  #clipsList { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-item-label { max-width: 160px; }
}

/* Offene Vorschau: Karte auf zwei Spalten, sonst ist das 9:16-Video auf dem Desktop winzig */
#clipsList .clip-item-wrap:has(.clip-preview:not([hidden])) { grid-column: span 2; }
@media (max-width: 720px) { #clipsList .clip-item-wrap:has(.clip-preview:not([hidden])) { grid-column: 1 / -1; } }

/* Logo-Auswahl im Wizard (2026-09-17) */
.branding-pill { display: inline-flex; align-items: center; gap: 8px; }
.branding-pill img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; background: var(--bg); }
.lock-note a { color: var(--accent); }

/* Posten-Panel v2 (2026-09-17): Texte + Zauberstab immer sichtbar, Kopieren pro Feld */
.publish-texts { margin-top: 0; }
.publish-section-label { margin: 14px 0 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.publish-caption-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.copy-caption-btn { background: none; border: 0; padding: 2px 4px; font-size: 12px; font-weight: 600; color: var(--text-dim); cursor: pointer; }
.copy-caption-btn:hover { color: var(--accent); }

.publish-platform-row.is-stale { color: var(--text-faint); }
.publish-platform-row.is-stale em { font-style: normal; font-size: 12px; }
.publish-platform-row.is-stale a { color: var(--accent); }
