/* Prep-Frontend — schlanke, CDN-freie Optik, angelehnt an dataleak_sales_web. */
:root {
  --accent: #1d4ed8;
  --ok: #15803d;
  --go: #b45309;
  --no: #b91c1c;
  --line: #e2e8f0;
  --muted: #64748b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, "Segoe UI", sans-serif;
  color: #0f172a;
  background: #f8fafc;
}
.topbar {
  display: flex; gap: .6rem; align-items: baseline;
  padding: .7rem 1.2rem; background: #0f172a; color: #fff;
}
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; }
.topbar .crumb { color: #cbd5e1; }
.topbar .logout { margin-left: auto; }
main { max-width: 1400px; margin: 1.2rem auto 4rem; padding: 0 1.2rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; margin-top: 1.6rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.hint, .muted { color: var(--muted); }
.hint { font-size: .9rem; }
.empty { color: var(--muted); font-style: italic; }
.err { color: var(--no); font-size: .82rem; }

.flash { max-width: 1000px; margin: .8rem auto 0; padding: 0 1.2rem; }
.flash p, .note p {
  background: #fef3c7; border: 1px solid #f59e0b; border-radius: 6px;
  padding: .5rem .8rem; margin: .3rem 0;
}
.flash-err p {
  background: #fee2e2; border: 1px solid #ef4444; border-radius: 6px;
  padding: .5rem .8rem; margin: .3rem 0;
}

table.grid { width: 100%; border-collapse: collapse; background: #fff; }
.grid th, .grid td {
  text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.grid thead th { background: #f1f5f9; position: sticky; top: 0; }
.grid tr:hover td { background: #f8fafc; }

table.kv { border-collapse: collapse; margin: .6rem 0; }
.kv th { text-align: left; padding: .2rem .8rem .2rem 0; color: var(--muted); font-weight: 600; vertical-align: top; }
.kv td { padding: .2rem 0; }

form.stack { display: block; }
input[type=text], input[type=password] {
  padding: .3rem; border: 1px solid var(--line); border-radius: 4px;
}
.btn {
  display: inline-block; padding: .25rem .6rem; border: 1px solid var(--line);
  border-radius: 5px; background: #fff; cursor: pointer; font-size: .85rem;
  color: inherit; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.btn-ok { border-color: var(--ok); background: #dcfce7; font-weight: 600; }
.btn.btn-go { border-color: var(--go); background: #ffedd5; font-weight: 600; }

/* Status-Badges (Klassen st-<status> aus cd.PREP_STATUS_*). */
.badge {
  display: inline-block; padding: .05rem .45rem; border-radius: 999px;
  background: #e2e8f0; font-size: .78rem; white-space: nowrap;
}
.st-neu { background: #e2e8f0; }
.st-in_arbeit, .st-wird_versendet { background: #dbeafe; }
.st-zur_pruefung { background: #fef3c7; }
.st-freigegeben { background: #ede9fe; }
.st-gesendet { background: #dcfce7; }
.st-fehlgeschlagen, .st-abgebrochen { background: #fee2e2; }

/* Editor */
.editor .scenario {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: .9rem 1rem; margin: 1rem 0;
}
.editor .scenario-body { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.editor iframe.preview {
  flex: 1 1 520px; min-width: 320px; height: 460px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.editor .controls { flex: 1 1 300px; min-width: 260px; }
.editor .controls p { margin: .4rem 0; }
.editor .controls input[type=range] { vertical-align: middle; }
.editor-actions { margin: 1.2rem 0; display: flex; gap: .6rem; flex-wrap: wrap; }

/* Element-Uebersicht (Job-Seite) */
.elements { list-style: none; padding: 0; margin: 1rem 0; }
.element-row {
  display: flex; align-items: center; gap: .7rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: .6rem .9rem; margin: .5rem 0;
}
.element-row.is-geprueft { border-color: var(--ok); background: #f6fef9; }
.element-row .element-name { font-weight: 600; flex: 1 1 auto; }
.send-form { display: flex; align-items: center; gap: .7rem; margin: 1.2rem 0; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; border-color: var(--line); }

/* Einzel-Element-Editor: links Vorschau, rechts Steuerung */
.element-editor { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }
/* Vorschau bekommt den Loewenanteil; die Mail ist 550px breit und soll voll passen. */
.element-editor .preview-col { flex: 3 1 600px; min-width: 560px; }
.element-editor iframe.preview {
  width: 100%; height: 88vh; min-height: 640px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.element-editor .controls-col { flex: 1 1 300px; min-width: 280px; max-width: 400px; }
.element-editor .controls-col p { margin: .5rem 0; }
.element-editor .controls-col input[type=range] { vertical-align: middle; }
.element-editor .controls-col input[type=color] {
  vertical-align: middle; width: 44px; height: 26px; padding: 0;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer;
}
.ext-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }

/* Speichern-Aktionen: "Nur speichern" gross & oben, "als geprueft" abgesetzt unten */
.element-editor .editor-actions { display: block; margin-top: 1rem; }
.btn.btn-save {
  border-color: var(--accent); background: #dbeafe; font-weight: 600;
}
.btn.btn-block {
  display: block; width: 100%; text-align: center;
  padding: .6rem; font-size: 1rem;
}
.element-editor .mark-row {
  margin-top: 2.2rem; padding-top: 1rem; border-top: 1px dashed var(--line);
}
/* Fieldset nur als Sperr-Container -- optisch neutral. */
.controls-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.controls-fieldset:disabled { opacity: .55; }
/* Sperr-Hinweis, waehrend die neue Baeckerei eingearbeitet wird. */
.note-lock p { background: #dbeafe; border: 1px solid #60a5fa; border-radius: 6px;
  padding: .5rem .8rem; margin: .3rem 0; }
.btn-pipette { vertical-align: middle; }
/* Kleine, einklappbare Feld-Hilfe (z. B. "Wie komme ich an den Logo-Link?"). */
.fieldhelp { margin: -.15rem 0 .7rem; }
.fieldhelp > summary { cursor: pointer; color: var(--accent); font-size: .82rem; }
.fieldhelp p { margin: .35rem 0 0; font-size: .85rem; color: var(--muted); }
/* Einklappbare Bank-Informationen (Sparkasse). */
.bank-details { margin: .6rem 0; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .7rem; }
.bank-details > summary { cursor: pointer; font-weight: 600; }
.bank-details[open] > summary { margin-bottom: .5rem; }
