:root {
  --fg: #18181b;
  --muted: #5c5c66;
  --bg: #f6f6f4;
  --card: #fff;
  --line: #e2e2de;
  --accent: #0a6b4f;
  --accent-hover: #08573f;
  --accent-soft: #e7f3ee;
  --danger: #a8231b;
  --danger-soft: #fdf0ef;
  --focus: #1257d6;
  --radius: 1rem;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 4px 16px rgb(0 0 0 / 5%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body {
  margin: 0; line-height: 1.5; min-height: 100vh; min-height: 100dvh;
  /* viewport-fit=cover: Notch/Home-Indikator freihalten (installierte App) */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h2[tabindex="-1"]:focus { outline: none; }
h2[tabindex="-1"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: .25rem; }

/* ---- Kopf ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 1rem; max-width: 36rem; margin: 0 auto;
}
.brand { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.brand span { font-weight: 400; color: var(--muted); }

.wrap { max-width: 36rem; margin: 0 auto; padding: 0 1rem 2rem; }

/* ---- Schrittanzeige ---- */
.steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: .25rem 0 1.25rem; counter-reset: none; }
.step { flex: 1; display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .875rem; }
.step::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 1px; }
.step:last-child::after { display: none; }
.step-num {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; flex: none;
  border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-weight: 600; font-size: .85rem;
}
.step.current { color: var(--fg); font-weight: 600; }
.step.current .step-num { border-color: var(--accent); background: var(--accent); color: #fff; }
.step.done .step-num { border-color: var(--accent); color: var(--accent); }
.step.done::after { background: var(--accent); }
@media (max-width: 22rem) { .step-label { display: none; } }

/* ---- Screens ---- */
.screen { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.screen h2 { font-size: 1.35rem; line-height: 1.25; margin: 0 0 1rem; letter-spacing: -.01em; }
.screen h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small-text { font-size: .875rem; }
.error { color: var(--danger); margin: .75rem 0 0; }

/* ---- Drop-Zone ---- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: .25rem; min-height: 15rem; padding: 1.5rem 1rem; cursor: pointer;
  border: 2px dashed #c4c4be; border-radius: var(--radius); background: #fbfbfa;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.pick:focus-within .dropzone { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--accent); }
.dz-icon {
  width: 3rem; height: 3rem; border-radius: 50%; background: var(--accent-soft); margin-bottom: .5rem; position: relative;
}
.dz-icon::before, .dz-icon::after {
  content: ""; position: absolute; left: 50%; top: 50%; background: var(--accent); border-radius: 1px;
  transform: translate(-50%, -50%);
}
.dz-icon::before { width: 1.25rem; height: 2px; }
.dz-icon::after { width: 2px; height: 1.25rem; }
.dz-title { font-weight: 600; font-size: 1.05rem; }
.dz-sub { color: var(--muted); }
.dz-limits { color: var(--muted); font-size: .8rem; margin-top: .75rem; }

/* ---- Vorschau ---- */
.preview-media {
  border-radius: var(--radius); overflow: hidden; background: #ececea; display: grid; place-items: center;
  max-height: 60vh;
}
.preview-media img, .preview-media video { display: block; max-width: 100%; max-height: 60vh; object-fit: contain; }
.file-meta { margin: .75rem 0; overflow-wrap: anywhere; }
.file-name { font-weight: 600; }

/* ---- Buttons ---- */
.btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: .6rem 1.2rem; border-radius: .75rem; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: var(--card); color: var(--accent); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { border-color: var(--accent); }
.btn.small { min-height: 2.25rem; padding: .3rem .8rem; font-size: .875rem; }
.btn:disabled { background: #e4e4e0; color: #6e6e74; border-color: transparent; cursor: not-allowed; }
.bar { display: flex; gap: .75rem; margin-top: 1.25rem; }
.bar .btn.primary { flex: 1; }

/* ---- Kanäle als Karten ---- */
.channels-set { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
.channels-set legend { font-weight: 600; padding: 0; margin-bottom: .5rem; }
.channels { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.channel {
  position: relative; display: flex; align-items: center; gap: .75rem; min-height: 3.25rem;
  padding: .75rem 1rem; border: 1.5px solid var(--line); border-radius: .75rem; cursor: pointer;
  background: var(--card); transition: border-color .15s, background-color .15s;
}
.channel:hover { border-color: #b5b5ae; }
.channel input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.channel-name { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.channel-tick {
  flex: none; width: 1.35rem; height: 1.35rem; border-radius: .4rem; border: 2px solid #9a9a94; position: relative;
}
.channel:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.channel input:checked ~ .channel-tick { background: var(--accent); border-color: var(--accent); }
.channel input:checked ~ .channel-tick::after {
  content: ""; position: absolute; left: .32rem; top: .08rem; width: .35rem; height: .7rem;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.channel input:focus-visible ~ .channel-tick { outline: 3px solid var(--focus); outline-offset: 2px; }
.channel:has(input:focus-visible) .channel-tick { outline: none; }
.channel:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.channel.disabled { cursor: not-allowed; background: #f0f0ec; border-color: var(--line); color: var(--muted); }
.channel.disabled:hover { border-color: var(--line); }
.channel.disabled .channel-tick { border-color: #c8c8c2; }
.channel-hint { display: block; font-size: .8rem; font-weight: 400; }

/* ---- Felder ---- */
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
textarea {
  width: 100%; font: inherit; padding: .65rem .75rem; border: 1.5px solid var(--line); border-radius: .75rem;
  background: var(--card); color: var(--fg); resize: vertical; min-height: 5.5rem;
}
textarea:focus-visible { border-color: var(--accent); }
.counter { text-align: right; font-size: .8rem; margin: .25rem 0 1rem; }

.privacy { background: #fbf7ea; border-radius: .75rem; padding: .75rem 1rem; font-size: .9rem; }
.privacy p { margin: 0 0 .5rem; }
.consent { display: flex; gap: .65rem; align-items: flex-start; font-weight: 600; cursor: pointer; }
.consent input { width: 1.25rem; height: 1.25rem; margin: .1rem 0 0; flex: none; accent-color: var(--accent); }

/* ---- Schritt 3 ---- */
.state { margin: .5rem 0 0; }
.progress-label { display: flex; justify-content: space-between; margin: 0 0 .5rem; }
.pct { font-variant-numeric: tabular-nums; font-weight: 600; }
progress {
  width: 100%; height: .6rem; appearance: none; border: 0; border-radius: 1rem; overflow: hidden;
  background: var(--line); accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); transition: width .2s; }
progress::-moz-progress-bar { background: var(--accent); }
.processing { display: flex; gap: 1rem; align-items: flex-start; }
.processing p { margin: 0; }
.spinner {
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ok-line { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 600; color: var(--accent); }
.ok-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--accent); }
.caption {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: .85rem 1rem;
  background: var(--bg); border-radius: .75rem;
}
.error-box { margin: 0; padding: .85rem 1rem; border-radius: .75rem; background: var(--danger-soft); color: var(--danger); }
.actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.25rem; }
.actions .btn { width: 100%; }

/* ---- Letzte Uploads ---- */
.recent { margin-top: 1.5rem; }
.recent summary {
  cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; padding: .5rem 0; width: fit-content;
}
.jobs { list-style: none; padding: 0; margin: .25rem 0 0; }
.jobs li {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "badge btn" "meta btn";
  gap: .3rem .75rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--line);
}
.jobs .badge { grid-area: badge; justify-self: start; }
.jobs .btn { grid-area: btn; }
.jobs li:first-child { border-top: 0; }
.jobs .meta { grid-area: meta; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 1rem; font-size: .75rem; font-weight: 600; background: #ececea; }
.badge.processing, .badge.uploading { background: #e5edfb; color: #1c3f86; }
.badge.draft_created { background: var(--accent-soft); color: var(--accent-hover); }
.badge.failed { background: var(--danger-soft); color: var(--danger); }

/* ---- Login ---- */
.login { max-width: 24rem; margin: 0 auto; padding: 12vh 1rem 2rem; }
.login .brand { text-align: center; font-size: 1.1rem; margin-bottom: 1rem; }
.login .screen h1 { font-size: 1.35rem; margin: 0 0 1rem; }
.login label { display: block; font-weight: 600; margin-bottom: .35rem; }
.login input[type="password"] {
  width: 100%; font: inherit; min-height: 2.75rem; padding: .6rem .75rem; margin-bottom: 1rem;
  border: 1.5px solid var(--line); border-radius: .75rem; background: var(--card); color: var(--fg);
}
.login input[type="password"]:focus-visible { border-color: var(--accent); }
.login .btn { width: 100%; }

/* ---- Größere Bildschirme ---- */
@media (min-width: 40rem) {
  .wrap { padding-top: 1rem; }
  .screen { padding: 1.75rem; }
  .actions { flex-direction: row; flex-wrap: wrap; }
  .actions .btn { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .spinner { border-top-color: var(--accent); border-right-color: var(--accent); }
}
