:root {
  --bg: #f6f7f9; --panel: #ffffff; --side: #0f172a; --side-ink: #cbd5e1; --side-on: #ffffff;
  --ink: #0f172a; --muted: #64748b; --line: #e5e7eb; --soft: #f1f5f9;
  --accent: #4f46e5; --accent-ink: #ffffff; --accent-soft: #eef2ff;
  --ok: #059669; --ok-soft: #ecfdf5; --warn: #b45309; --warn-soft: #fffbeb; --bad: #dc2626; --bad-soft: #fef2f2; --info-soft: #eff6ff;
  --r: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --panel: #121a2e; --side: #070b16; --side-ink: #94a3b8;
    --ink: #e2e8f0; --muted: #94a3b8; --line: #23304a; --soft: #18223a;
    --accent: #818cf8; --accent-ink: #0b1020; --accent-soft: #1e2347;
    --ok: #34d399; --ok-soft: #0f2a22; --warn: #fbbf24; --warn-soft: #2a220f; --bad: #f87171; --bad-soft: #2d1414; --info-soft: #14203a;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2, .h1like { font-size: 1.05rem; margin: 0 0 .75rem; }
.h1like { font-size: 1.35rem; margin: 0; }
h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1rem 0 .4rem; }
p { margin: .4rem 0; }
.sub { color: var(--muted); margin: .2rem 0 0; }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; }
.mt { margin-top: 1.4rem; }

/* App-Rahmen */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--side-on); font-weight: 700; padding: 4px 8px 22px; text-decoration: none !important; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--side-ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #22d3ee); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.brand.big { color: var(--ink); padding: 0 0 18px; }
.brand.big small { color: var(--muted); }
.mainnav { display: flex; flex-direction: column; gap: 2px; }
.mainnav a { color: var(--side-ink); padding: 9px 10px; border-radius: 9px; display: flex; gap: 10px; align-items: center; text-decoration: none; }
.mainnav a:hover { background: rgba(255, 255, 255, .06); color: var(--side-on); }
.mainnav a.on { background: rgba(255, 255, 255, .1); color: var(--side-on); font-weight: 600; }
.ico { width: 18px; text-align: center; opacity: .8; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding: 14px 8px 0; font-size: .85rem; }
.who { display: flex; flex-direction: column; margin-bottom: 8px; overflow-wrap: anywhere; }
.who strong { color: var(--side-on); }
.side .btn-link { color: var(--side-ink); }
.content { padding: 28px 36px 64px; max-width: 1180px; width: 100%; min-width: 0; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side, .mainnav { min-width: 0; max-width: 100%; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 6px 12px; }
  .brand { padding: 0; }
  .mainnav { flex-direction: row; order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .mainnav a { white-space: nowrap; padding: 7px 10px; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; gap: 10px; }
  .who { display: none; }
  .side-foot form { margin: 0; }
  .content { padding: 18px 16px 48px; }
}

/* Kopfbereiche */
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; margin-bottom: 10px; }
.client-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.ch-text { flex: 1; min-width: 180px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--accent); }

/* Karten & Raster */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card.highlight { border-color: var(--accent); background: linear-gradient(0deg, var(--panel), var(--panel)) padding-box; }
.card.info { background: var(--info-soft); border-color: transparent; }
.card.info.warn { background: var(--warn-soft); }
.card.login { width: 100%; max-width: 420px; padding: 32px; }
.narrow { max-width: 760px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .card { margin: 0; }
.grid2.tight { gap: 4px 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: .82rem; }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.2; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cards .card { margin: 0; }
.client-card { display: flex; flex-direction: column; gap: 10px; }
.client-card h3 { font-size: 1.02rem; color: var(--ink); text-transform: none; letter-spacing: 0; margin: 0; }
.cc-head { display: flex; gap: 12px; align-items: center; }
.cc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: 8px; }
.client-card.add { align-items: center; justify-content: center; border-style: dashed; color: var(--muted); min-height: 200px; text-decoration: none; }
.client-card.add:hover { border-color: var(--accent); color: var(--accent); }
.plus { font-size: 2rem; line-height: 1; }
.meta { color: var(--muted); font-size: .82rem; margin: 0; }

/* Farbfläche / Logo */
.swatch { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; background: var(--accent-soft); color: var(--accent); overflow: hidden; flex: none; }
.swatch img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.swatch.lg { width: 52px; height: 52px; font-size: 1.3rem; border-radius: 14px; }
.swatch.xl { width: 84px; height: 84px; font-size: .8rem; border-radius: 16px; font-weight: 500; }
.logo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.color-input { display: flex; gap: 8px; align-items: center; }
.chip { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--soft); flex: none; }

/* Key-Value */
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.kv div { background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.kv dt { color: var(--muted); font-size: .76rem; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.kv.col { grid-template-columns: 1fr; }
.kv.col div { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: none; padding: 6px 0; border-bottom: 1px solid var(--line); border-radius: 0; }

/* Formulare */
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.lbl { font-weight: 600; font-size: .88rem; }
.req { color: var(--accent); font-style: normal; margin-left: 3px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=file], select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
input[type=file] { padding: 7px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.check-row { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.add-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
fieldset.q { border: 0; border-bottom: 1px solid var(--line); padding: 0 0 16px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.q legend { font-weight: 600; margin-bottom: 8px; padding: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 10px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); }
.btn-sm { padding: 6px 12px; font-size: .88rem; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; }
.btn-link.danger { color: var(--bad); font-size: .84rem; }
form.inline { display: inline; margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.wizard-nav { margin: -4px 0 16px; }

/* Rating / Auswahl */
.rating { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rating-end { color: var(--muted); font-size: .8rem; }
.rate, .choice { position: relative; cursor: pointer; }
.rate input, .choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.rate span { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; background: var(--panel); }
.choice span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.rate input:checked + span, .choice input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rate input:focus-visible + span, .choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.research { border-color: var(--accent); background: var(--accent-soft); }
.research-form { display: flex; flex-direction: column; gap: 10px; }
.research-q p { font-weight: 600; margin: 6px 0 0; }
.research .skip { margin-top: 6px; }
.pill { font-size: .72rem; font-weight: 600; color: var(--accent); background: var(--panel); border-radius: 999px; padding: 3px 9px; }
.stars { color: var(--accent); letter-spacing: 2px; }

/* Meldungen, Badges, Tags */
.flash { border-radius: 10px; padding: 11px 14px; margin: 0 0 16px; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-info { background: var(--info-soft); }
.badge { display: inline-block; font-size: .76rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.st-queued { background: var(--soft); color: var(--muted); }
.st-processing, .st-rendering { background: var(--info-soft); color: var(--accent); }
.st-review { background: var(--accent); color: var(--accent-ink); }
.st-revision_requested { background: var(--warn-soft); color: var(--warn); }
.st-finished { background: var(--ok-soft); color: var(--ok); }
.st-failed { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; font-size: .74rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.accent { color: var(--accent); border-color: var(--accent); }
.counter { font-size: .82rem; color: var(--warn); font-weight: 600; }
.counter.ok { color: var(--ok); }
.ok-text { color: var(--ok); font-weight: 600; }

/* Listen */
.rows, .items, .checklist, .timeline { list-style: none; margin: 0; padding: 0; }
.rows li a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.rows li:first-child a { border-top: 0; }
.rows li a:hover strong { color: var(--accent); }
.rows small { display: block; color: var(--muted); font-size: .8rem; }
.items li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.items li:first-child { border-top: 0; }
.items li > div { min-width: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .75rem; color: #fff; flex: none; }
.checklist li.ok .check { background: var(--ok); border-color: var(--ok); }
.checklist li.ok a { color: var(--muted); }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 14px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline li.ok::before { background: var(--ok); }
.timeline li.warn::before { background: var(--warn); }
.timeline small { display: block; color: var(--muted); }
blockquote { margin: 6px 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--soft); border-radius: 8px; overflow-wrap: anywhere; }
pre.script { white-space: pre-wrap; background: var(--soft); padding: 12px; border-radius: 10px; font: inherit; overflow-wrap: anywhere; }
details > summary { cursor: pointer; color: var(--accent); margin: 6px 0; }
.empty { text-align: center; padding: 22px 10px; color: var(--muted); }
.empty .btn { margin-top: 8px; }
.answers div { padding: 8px 0; border-top: 1px solid var(--line); }
.answers dt { font-weight: 600; }
.answers dd { margin: 2px 0 0; }

/* Stepper */
.steps { display: flex; list-style: none; margin: 0; padding: 0; }
.steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); text-align: center; position: relative; }
.steps li::before { content: ""; position: absolute; top: 7px; right: 50%; width: 100%; height: 2px; background: var(--line); }
.steps li:first-child::before { display: none; }
.steps .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--line); position: relative; z-index: 1; }
.steps li.done .dot, .steps li.done::before, .steps li.current::before { background: var(--accent); }
.steps li.current .dot { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.steps li.current { color: var(--ink); font-weight: 700; }
.steps li.current.warn .dot { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
.steps li.current.bad .dot { background: var(--warn); }
@media (max-width: 560px) {
  .steps { flex-direction: column; gap: 10px; }
  .steps li { flex-direction: row; text-align: left; gap: 10px; }
  .steps li::before { top: -12px; left: 7px; right: auto; width: 2px; height: 12px; }
}
.wizard { display: flex; list-style: none; padding: 0; margin: 8px 0 18px; gap: 6px; overflow-x: auto; counter-reset: s; }
.wizard li { counter-increment: s; flex: 1; min-width: 120px; border-top: 3px solid var(--line); padding-top: 8px; font-size: .82rem; color: var(--muted); }
.wizard li::before { content: counter(s) ". "; }
.wizard li.done { border-color: var(--accent); }
.wizard li.current { border-color: var(--accent); color: var(--ink); font-weight: 700; }

/* Review */
.review-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; }
@media (max-width: 820px) { .review-grid { grid-template-columns: 1fr; } }
.player { width: 100%; max-width: 340px; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #000; display: grid; place-items: center; }
.player video, .player iframe { width: 100%; height: 100%; border: 0; }
.actions { margin: 14px 0 6px; }
details.revise > summary { list-style: none; display: inline-flex; margin: 0 0 10px; color: var(--accent); }
details.revise > summary::-webkit-details-marker { display: none; }
details.revise[open] > summary { background: var(--accent-soft); }
.reel-head { margin-bottom: 14px; align-items: flex-start; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; }
.msg { max-width: 85%; }
.msg-agency { align-self: flex-end; text-align: right; }
.bubble { display: inline-block; text-align: left; padding: 9px 13px; border-radius: 14px; background: var(--soft); overflow-wrap: anywhere; }
.msg-agency .bubble { background: var(--accent); color: var(--accent-ink); }
.msg .meta { font-size: .74rem; margin-top: 3px; }
.sub-entry { border-top: 1px solid var(--line); padding: 8px 0; }
