:root {
  --green: #4a7c3a; --green-d: #365c2a; --bg: #f5f7f2; --card: #fff; --line: #dfe5d8; --text: #22301c; --muted: #66735f; --red: #b33a3a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* sonst überschreiben z. B. Button-Stile das hidden-Attribut */
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 12px 20px; background: var(--green); color: #fff; }
header nav { display: flex; flex-wrap: wrap; gap: 4px; }
header nav a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 6px; opacity: .85; }
header nav a.active, header nav a:hover { background: #ffffff26; opacity: 1; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat b { display: block; font-size: 28px; }
.muted { color: var(--muted); font-size: 13px; }
.ok { color: var(--green); } .warn { color: #b7791f; } .err { color: var(--red); }
button, .btn { background: var(--green); color: #fff; border: 0; padding: 8px 14px; border-radius: 6px; cursor: pointer; font: inherit; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--green-d); }
button.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--red); }
button:disabled { opacity: .45; cursor: not-allowed; }
.send-zone { border-color: #e7c4c4; background: #fdf7f7; }
.send-dialog { max-width: 460px; width: calc(100% - 32px); border: 0; border-radius: 12px; padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.send-dialog::backdrop { background: rgba(20,30,15,.45); }
.send-dialog h2 { margin-top: 0; color: var(--red); }
.send-sum { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.send-sum td { padding: 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.send-sum td:first-child { color: var(--muted); width: 110px; }
button.small { padding: 4px 8px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; width: 100%; background: #fff; color: var(--text); }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 3px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.row > button, .row > .btn { flex: 0 0 auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 13px; color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #e8efe2; }
.badge.sent { background: #d6ecd0; } .badge.sending { background: #fdf0c4; } .badge.failed, .badge.inactive { background: #f6d5d5; }
.scroll { overflow-x: auto; }
/* Editor */
.editor { display: grid; grid-template-columns: minmax(340px, 480px) 1fr; gap: 16px; align-items: start; }
.preview { position: sticky; top: 12px; }
.pv-opt { margin: 0 0 6px; font-size: 13px; }
.preview iframe { width: 100%; height: calc(100vh - 150px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.block { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #fbfcfa; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.block-head strong { text-transform: capitalize; }
.colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch { display: block; width: 100%; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; box-shadow: inset 0 0 0 2px #fff; }
.swatch:hover { border-color: var(--text); }
.color-inline { gap: 8px; align-items: center; }
.color-inline .swatch { width: 44px; flex: 0 0 44px; }
.picker { position: absolute; z-index: 20; width: 248px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.picker-sv { position: relative; height: 150px; border-radius: 6px; cursor: crosshair; touch-action: none; }
.picker-dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.picker-hue { width: 100%; margin: 10px 0 6px; padding: 0; height: 12px; border: 0; border-radius: 6px; -webkit-appearance: none; appearance: none; background: linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00); }
.picker-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1px solid #555; }
.picker-hue::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1px solid #555; }
.picker-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.picker-preview { flex: 0 0 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); }
.picker-hex { flex: 1; padding: 4px 6px; font: 13px ui-monospace, Consolas, monospace; }
.picker-hex.invalid { border-color: var(--red); }
.picker-label { font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.picker-pv.active { background: var(--green); color: #fff; }
.picker-hint { margin-top: 8px; padding: 6px 8px; font-size: 12px; background: #f1f6ec; border-radius: 6px; color: var(--text); }
#pv.picking { outline: 3px dashed var(--green); outline-offset: -3px; }
.picker-swatches {display: flex; flex-wrap: wrap; gap: 5px; }
.picker-swatches button { width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.picker-swatches button:hover { transform: scale(1.15); }
.block.is-hidden { border-style: dashed; background: repeating-linear-gradient(135deg, #fafaf8, #fafaf8 10px, #f2f2ee 10px, #f2f2ee 20px); }
.block.is-hidden > :not(.block-head):not(.hidden-note) { opacity: .5; }
.hidden-note { margin: 6px 0; padding: 6px 10px; background: #fff7e0; border: 1px solid #e8d08a; border-radius: 6px; font-size: 13px; color: #6b5300; }
.ai-block {margin-top: 10px; padding: 8px 10px; background: #f1f6ec; border: 1px solid #c9dbbb; border-radius: 6px; }
.ai-block label { margin-top: 0; }
.ai-block .row { margin-top: 6px; gap: 8px; align-items: center; }
.img-opts {display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; }
.seg { display: flex; gap: 0; }
.seg button { flex: 1; border-radius: 0; padding: 7px 6px; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
label.check {display: flex; align-items: center; gap: 6px; color: var(--text); margin: 10px 0 0; }
label.check input { width: auto; margin: 0; }
.color-field {display: flex; flex-direction: column; gap: 4px; }
.color-field input[data-hex] { padding: 4px 6px; font: 13px ui-monospace, Consolas, monospace; }
.color-field input.invalid { border-color: var(--red); }
.ai { background: #f1f6ec; border-color: #c9dbbb; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips button { background: #fff; color: var(--text); border: 1px solid var(--line); font-size: 13px; padding: 4px 10px; }
.product { display: grid; grid-template-columns: 1fr 90px; gap: 6px; border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 6px; }
.product.dup { background: #fdf0f0; border: 1px solid #e3a6a6; border-radius: 6px; padding: 6px; }
.dup-note { grid-column: 1 / -1; color: var(--red); font-size: 13px; font-weight: 600; }
.dup-warn { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0; padding: 8px 10px; background: #fdf0f0; border: 1px solid #e3a6a6; border-radius: 6px; color: var(--red); font-size: 13px; }
.product-head {grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.results { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; background: #fff; }
.results div { padding: 6px 8px; cursor: pointer; border-bottom: 1px solid var(--line); }
.results div:hover { background: #f1f6ec; }
.progress { height: 10px; background: #e8efe2; border-radius: 5px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); transition: width .3s; }
#toast { position: fixed; right: 16px; bottom: 16px; background: #22301c; color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 420px; z-index: 10; }
#toast.error { background: var(--red); }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; }
  .preview iframe { height: 70vh; }
  main { padding: 12px 16px; }
}
