/* B1 Bildrahmen – Oberfläche. Arbeitswerkzeug: ruhig, hell, Markenrot nur für Aktionen. */
:root {
  --red: #E1251B;
  --red-dark: #B81B13;
  --ink: #1C1B1B;
  --muted: #6A6666;
  --line: #E2DEDD;
  --bg: #F6F4F3;
  --card: #FFFFFF;
  --ok-bg: #E7F4EA;
  --ok-ink: #1D5B2C;
  --err-bg: #FCE9E7;
  --err-ink: #8E1810;
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
}
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-top: 24px; margin-bottom: 10px; }
p { margin: 0; }
a { color: var(--red-dark); }
img, canvas { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--red) 45%, transparent); outline-offset: 2px; }

/* Kopfzeile */
.topbar { background: var(--card); border-bottom: 3px solid var(--red); }
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 17px; }
.brand img { height: 40px; width: auto; display: block; }
.brand span { border-left: 2px solid var(--line); padding-left: 14px; }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a { padding: 7px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); font-weight: 600; }
.nav a:hover { background: var(--bg); }
.nav a.is-active { background: var(--red); color: #fff; }
.nav-logout { margin: 0 0 0 8px; }
.linkish { background: none; border: 0; padding: 7px 4px; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
.linkish:hover { color: var(--ink); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 64px; display: flex; flex-direction: column; gap: 24px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.right { text-align: right; }

/* Meldungen */
.flash { padding: 10px 14px; border-radius: 6px; font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }

/* Flächen */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 16px; }
.narrow { max-width: 420px; width: 100%; margin: 40px auto 0; }
.narrow-card { max-width: 460px; }
.step { display: flex; flex-direction: column; gap: 12px; }
.step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 6px; }
.form label, .editor-form label { font-weight: 600; font-size: 13px; margin-top: 8px; }
.form .btn { margin-top: 16px; align-self: flex-start; }
input:not([type]), input[type="text"], input[type="password"], select {
  width: 100%; min-width: 0; padding: 9px 11px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #C9C4C3; border-radius: 6px;
}
input[type="color"] { width: 64px; height: 38px; padding: 2px; border: 1px solid #C9C4C3; border-radius: 6px; background: #fff; cursor: pointer; }
input[type="file"] { font: inherit; max-width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px; font: inherit; font-weight: 600; color: var(--ink);
  background: #fff; border: 1px solid #C9C4C3; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-danger { color: var(--err-ink); }
.btn-danger:hover { border-color: var(--err-ink); }
.btn-small { padding: 6px 11px; font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 150px; }
.pill { font-size: 11px; font-weight: 700; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; color: var(--muted); }

/* Vorlagen-Auswahl */
.tpl-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tpl-option {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 10px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
}
.tpl-option canvas { width: 100%; height: auto; display: block; border-radius: 4px; }
.tpl-option:hover { border-color: #B9B3B2; }
.tpl-option.is-active { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.tpl-option span { padding: 0 4px; }

/* Ablagefläche */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 44px 20px; text-align: center; cursor: pointer;
  background: var(--card); border: 2px dashed #BDB7B6; border-radius: var(--radius); color: var(--muted);
}
.dropzone strong { font-size: 18px; color: var(--ink); }
.dropzone:hover, .dropzone.is-over { border-color: var(--red); background: color-mix(in srgb, var(--red) 5%, #fff); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 3px solid color-mix(in srgb, var(--red) 45%, transparent); outline-offset: 2px; }

/* Ergebnisse */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.result { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.result canvas { width: 100%; height: auto; display: block; }
.result-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.result-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.result-controls { display: flex; flex-direction: column; gap: 6px; }
.slider { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.slider input { width: 100%; accent-color: var(--red); }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.result-actions .btn-primary { margin-left: auto; }

/* Einstellungen */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; }
.subnav a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px; }
.subnav a:hover { border-color: var(--ink); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 14px; font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--red); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 28px; align-items: start; }
.editor-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.editor-preview { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.editor-preview canvas { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 4px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; min-width: 0; }
.field label { margin-top: 0; }
.field-color { flex: 0 0 auto; }
.usp-fields { display: flex; flex-direction: column; gap: 8px; }
.usp-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.editor-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.editor-actions form { margin: 0; }
#dirty-hint { color: var(--err-ink); font-weight: 600; text-align: right; }
.logo-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.logo-current { height: 72px; width: auto; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.table-wrap { overflow-x: auto; }
.users { width: 100%; border-collapse: collapse; min-width: 640px; }
.users th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.users td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.add-user input, .add-user select { flex: 1 1 180px; }

@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
  .editor-preview { position: static; order: -1; }
  .usp-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
