:root {
  --bg:#17181b; --panel:#202226; --panel2:#2a2c31; --line:#36383e; --text:#e6e8ec; --muted:#9aa0aa;
  --accent:#58b9ff; --accent2:#3aa6f2; --accent-ink:#0d1a24; --accent-text:#58b9ff; --ok:#3ba55d; --bad:#ed4245;
  --chat:#1b1c20; --embed:#25272c; --r:10px;
}
@media (prefers-color-scheme: light) {
  :root { --bg:#f3f4f6; --panel:#fff; --panel2:#f0f1f4; --line:#d9dce2; --text:#1f2329; --muted:#5d6470; --chat:#fff; --embed:#f4f5f7; --accent:#2a9df4; --accent2:#1b87d8; --accent-text:#1b7ec2; }
}
* { box-sizing:border-box; }
html, body { margin:0; }
body { background:var(--bg); color:var(--text); font:15px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif; }
[hidden] { display:none !important; }
button, input, select, textarea { font:inherit; color:inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

.top { position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:10px; padding:10px 16px; background:var(--panel); border-bottom:1px solid var(--line); flex-wrap:wrap; }
.brand { font-weight:700; font-size:18px; display:flex; align-items:center; gap:8px; }
.logo { display:inline-grid; place-items:center; width:30px; height:30px; border-radius:9px; background:var(--accent); color:#fff; font-weight:800; }
.spacer { flex:1; }
.targets { display:flex; gap:8px; }
select, input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea {
  background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:8px 10px; width:100%;
}
.targets select { width:auto; max-width:200px; }
textarea { min-height:90px; resize:vertical; }
.btn { display:inline-block; text-decoration:none; color:var(--text); border:1px solid var(--line); background:var(--panel2); border-radius:8px; padding:8px 14px; cursor:pointer; }
.btn:hover { border-color:var(--muted); }
.btn.primary { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:600; }
.btn.primary:hover { background:var(--accent2); }
.btn.ghost { background:transparent; }
.btn.small { padding:4px 9px; font-size:13px; }
.btn.danger:hover { border-color:var(--bad); color:var(--bad); }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.chip { display:inline-flex; align-items:center; gap:8px; padding:4px 10px 4px 4px; border:1px solid var(--line); border-radius:99px; background:var(--panel2); cursor:pointer; }
.chip img { width:26px; height:26px; border-radius:50%; }
.chip .ph { width:26px; height:26px; border-radius:50%; background:var(--accent); display:grid; place-items:center; color:var(--accent-ink); font-size:13px; }

.menu { position:fixed; top:56px; right:150px; z-index:30; background:var(--panel); border:1px solid var(--line); border-radius:var(--r); padding:6px; display:flex; flex-direction:column; min-width:280px; box-shadow:0 10px 30px #0006; }
.menu button { text-align:left; background:none; border:0; padding:9px 12px; border-radius:6px; cursor:pointer; }
.menu button:hover { background:var(--panel2); }

.layout { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); gap:16px; padding:16px; max-width:1400px; margin:0 auto; align-items:start; }
@media (max-width:960px) { .layout { grid-template-columns:1fr; } .preview { position:static !important; } }

.editor { background:var(--panel); border:1px solid var(--line); border-radius:var(--r); padding:14px; }
.tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.tab { display:flex; align-items:center; border:1px solid var(--line); border-radius:8px; overflow:hidden; background:var(--panel2); }
.tab button { background:none; border:0; padding:6px 10px; cursor:pointer; }
.tab.on { border-color:var(--accent); }
.tab.on > button:first-child { color:var(--accent-text); font-weight:600; }
.tab .x { color:var(--muted); padding:6px 8px; }
.modes { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:14px; }
.mode { text-align:left; padding:10px 12px; border:1px solid var(--line); border-radius:var(--r); background:var(--panel2); cursor:pointer; display:flex; flex-direction:column; font-weight:600; }
.mode small { font-weight:400; color:var(--muted); }
.mode.on { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }

.field { margin:10px 0; }
.field > label { display:flex; justify-content:space-between; font-size:12px; color:var(--muted); margin-bottom:4px; }
.row { display:flex; gap:8px; } .row > * { flex:1; min-width:0; }
.toolbar { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:4px; }
.toolbar button { border:1px solid var(--line); background:var(--panel2); border-radius:6px; min-width:30px; padding:2px 7px; cursor:pointer; font-size:13px; }
.toolbar button:hover { border-color:var(--accent); }
.toolbar select { width:auto; padding:2px 6px; font-size:13px; }

details.card { border:1px solid var(--line); border-radius:var(--r); margin:12px 0; background:var(--bg); }
details.card > summary { cursor:pointer; padding:10px 12px; font-weight:600; display:flex; gap:8px; align-items:center; list-style:none; }
details.card > summary::before { content:"\25B8"; color:var(--muted); }
details.card[open] > summary::before { content:"\25BE"; }
details.card .body { padding:0 12px 12px; }
.swatches { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.sw { width:24px; height:24px; border-radius:50%; border:2px solid transparent; cursor:pointer; padding:0; }
.sw.on { border-color:var(--text); }
input[type=color] { width:34px; height:28px; padding:0; border:1px solid var(--line); border-radius:6px; background:none; }
.blocks .blk { border:1px solid var(--line); border-radius:var(--r); padding:10px; margin:10px 0; background:var(--bg); }
.blk .bh { display:flex; align-items:center; gap:6px; margin-bottom:6px; font-weight:600; font-size:13px; }
.blk .bh .sp { flex:1; }
.adds { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.fieldrow { display:grid; grid-template-columns:1fr 1.4fr auto auto; gap:6px; align-items:center; margin-top:6px; }
.fieldrow label { display:flex; gap:4px; align-items:center; font-size:13px; }
.warn { color:#e8a13a; font-size:13px; margin:8px 0; }
.hint { color:var(--muted); font-size:12px; }

.preview { position:sticky; top:70px; background:var(--panel); border:1px solid var(--line); border-radius:var(--r); overflow:hidden; }
.phead { display:flex; justify-content:space-between; padding:10px 14px; border-bottom:1px solid var(--line); font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
.chat { background:var(--chat); padding:16px; max-height:calc(100vh - 150px); overflow:auto; }
.pmsg { display:flex; gap:12px; margin-bottom:18px; }
.pav { width:40px; height:40px; border-radius:50%; background:var(--accent); display:grid; place-items:center; color:var(--accent-ink); font-weight:700; flex:none; }
.pbody { min-width:0; flex:1; }
.pname { font-weight:600; } .pname .tag { font-size:10px; background:var(--accent); color:var(--accent-ink); border-radius:4px; padding:1px 5px; margin-left:6px; vertical-align:middle; }
.md { white-space:pre-wrap; word-break:break-word; }
.md h1 { font-size:1.5em; margin:.3em 0; } .md h2 { font-size:1.25em; margin:.3em 0; } .md h3 { font-size:1.1em; margin:.3em 0; }
.md .sub { font-size:.8em; color:var(--muted); display:block; }
.md .li { display:block; padding-left:6px; }
.md code { background:var(--embed); border-radius:4px; padding:1px 5px; font-family:ui-monospace,monospace; font-size:.9em; }
.md pre { background:var(--embed); border:1px solid var(--line); border-radius:6px; padding:8px; margin:6px 0; white-space:pre-wrap; }
.md a { color:#5aa9ff; }
.md .men { background:#5865f233; color:#8f9bff; border-radius:4px; padding:0 3px; }
.emb { background:var(--embed); border-left:4px solid var(--line); border-radius:6px; padding:10px 14px 14px; margin-top:6px; max-width:520px; }
.emb .au { display:flex; align-items:center; gap:6px; font-size:13px; font-weight:600; margin-bottom:4px; }
.emb .au img { width:22px; height:22px; border-radius:50%; }
.emb .top2 { display:flex; gap:12px; justify-content:space-between; }
.emb .ti { font-weight:700; margin-bottom:4px; }
.emb .fs { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:8px; }
.emb .f { grid-column:span 3; } .emb .f.in { grid-column:span 1; }
.emb .f b { display:block; font-size:13px; }
.emb img.big { max-width:100%; border-radius:6px; margin-top:10px; display:block; }
.emb img.th { width:80px; height:80px; border-radius:6px; object-fit:cover; flex:none; }
.emb .ft { margin-top:10px; font-size:12px; color:var(--muted); display:flex; gap:6px; align-items:center; }
.emb .ft img { width:18px; height:18px; border-radius:50%; }
.btns { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.pbtn { background:#4f545c; color:#fff; border-radius:6px; padding:6px 14px; font-size:14px; text-decoration:none; display:inline-block; }
.cont { background:var(--embed); border:1px solid var(--line); border-left-width:4px; border-radius:10px; padding:12px 14px; max-width:560px; }
.cont > * + * { margin-top:10px; }
.cont hr { border:0; border-top:1px solid var(--line); margin:12px 0; } .cont hr.big { margin:20px 0; } .cont hr.noline { border-top-color:transparent; }
.sec { display:flex; gap:12px; align-items:center; justify-content:space-between; }
.sec img { width:80px; height:80px; border-radius:8px; object-fit:cover; flex:none; }
.gal { display:grid; gap:4px; grid-template-columns:repeat(2,1fr); }
.gal img { width:100%; border-radius:8px; display:block; object-fit:cover; max-height:240px; }
.gal img:first-child:nth-last-child(odd) { grid-column:span 2; }
.empty { color:var(--muted); text-align:center; padding:30px 0; }

.modal { position:fixed; inset:0; z-index:50; background:#000a; display:grid; place-items:center; padding:16px; }
.box { background:var(--panel); border:1px solid var(--line); border-radius:12px; width:min(720px,100%); max-height:90vh; overflow:auto; padding:16px; }
.mhead { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.mhead h2 { margin:0; font-size:18px; }
.tpls { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:10px; }
.tpl { text-align:left; border:1px solid var(--line); border-radius:var(--r); background:var(--panel2); padding:12px; cursor:pointer; }
.tpl:hover { border-color:var(--accent); }
.tpl b { display:block; } .tpl span { color:var(--muted); font-size:13px; }
.toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:10px 16px; opacity:0; pointer-events:none; transition:opacity .2s; z-index:60; max-width:90vw; }
.toast.show { opacity:1; } .toast.err { border-color:var(--bad); } .toast.ok { border-color:var(--ok); }

.brandlink { display:flex; align-items:center; gap:8px; color:var(--text); text-decoration:none; }
.brandlink img { border-radius:8px; }
.pbtn.s-secondary { background:#4f545c; }

.wm { display:flex; align-items:center; margin:-10px 0; }
.wm img { display:block; height:56px; width:auto; }
.lang { display:flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.lang a { padding:6px 10px; font-size:13px; font-weight:600; color:var(--muted); text-decoration:none; }
.lang a.on { background:var(--accent); color:var(--accent-ink); }

/* eigene Auswahllisten und Dialoge */
.dd { position:relative; min-width:0; }
.dd-btn { width:100%; display:flex; justify-content:space-between; align-items:center; gap:8px; text-align:left; background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:8px 10px; cursor:pointer; }
.dd-btn:hover { border-color:var(--muted); }
.dd-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dd-ph { color:var(--muted); }
.dd-caret { color:var(--muted); font-size:12px; }
.dd-list { position:absolute; z-index:40; left:0; top:calc(100% + 4px); min-width:100%; width:max-content; max-width:340px; margin:0; padding:4px; list-style:none; background:var(--panel); border:1px solid var(--line); border-radius:10px; box-shadow:0 14px 34px #0007; max-height:264px; overflow:auto; }
.dd-opt { padding:8px 10px; border-radius:6px; cursor:pointer; white-space:nowrap; }
.dd-opt.act, .dd-opt:hover { background:var(--panel2); }
.dd-opt.sel { color:var(--accent-text); font-weight:600; }
.dd-head { width:210px; }
.dd-small .dd-btn { padding:2px 8px; font-size:13px; border-radius:6px; background:var(--panel2); }
.btnrow > .dd { flex:1 1 150px; }
.targets { display:flex; gap:8px; }
.hexin { width:96px !important; font-family:ui-monospace,monospace; padding:5px 8px; }
.sw-prev { width:24px; height:24px; border-radius:50%; border:1px dashed var(--line); display:inline-block; }
.confirm-text { margin:4px 0 16px; line-height:1.5; }
.actions.end { justify-content:flex-end; }
.btn.danger-solid { background:var(--bad); border-color:var(--bad); color:#fff; font-weight:600; }
.actions { display:flex; gap:8px; flex-wrap:wrap; }

/* Absender */
.card.sender { border:1px solid var(--line); border-radius:var(--r); padding:12px; margin:0 0 14px; background:var(--bg); }
.sender-head { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.seg-btn { background:transparent; border:0; padding:6px 14px; cursor:pointer; color:var(--muted); font-weight:600; }
.seg-btn.on { background:var(--accent); color:var(--accent-ink); }
.check { display:flex; gap:8px; align-items:center; font-size:13px; color:var(--muted); margin:6px 0; }
.check input { width:auto; }
.rowbtn { flex:0 0 auto !important; }
.hookbox { border:1px solid var(--accent); border-radius:var(--r); padding:12px; margin:10px 0; display:flex; flex-direction:column; gap:8px; }
.hookrow { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--line); }

/* Hinweise und Fehler: oben im Editor und rechts in der Vorschau */
.alerts { display:flex; flex-direction:column; gap:6px; margin:0 0 12px; }
#alertsTop { position:sticky; top:62px; z-index:15; background:var(--panel); padding:8px 0 10px; margin:-4px 0 6px; box-shadow:0 10px 12px -10px #0008; }
#alertsPreview { margin:0; padding:10px 14px 0; }
.alert { margin:0; display:flex; gap:10px; align-items:flex-start; text-align:left; width:100%; padding:9px 12px; border-radius:10px; border:1px solid; font-size:14px; line-height:1.4; background:var(--panel); color:var(--text); }
.alert.warn { border-color:#e8a13a; background:linear-gradient(#e8a13a26,#e8a13a26), var(--panel); }
.alert.info { border-color:var(--accent); background:linear-gradient(#58b9ff1f,#58b9ff1f), var(--panel); }
.alert.jump { cursor:pointer; font:inherit; font-size:14px; }
.alert.jump:hover { filter:brightness(1.12); }
.alert-ic { flex:none; width:20px; height:20px; border-radius:50%; display:grid; place-items:center; font-weight:800; font-size:12px; margin-top:1px; }
.alert.warn .alert-ic { background:#e8a13a; color:#1d1500; }
.alert.info .alert-ic { background:var(--accent); color:var(--accent-ink); }

/* eigene Häkchen-Kästen */
input[type=checkbox] { appearance:none; -webkit-appearance:none; width:20px !important; height:20px !important; flex:none; padding:0; margin:0; border:1.5px solid var(--line); border-radius:6px; background:var(--bg); display:inline-grid; place-content:center; cursor:pointer; transition:background .12s, border-color .12s; }
input[type=checkbox]:hover { border-color:var(--muted); }
input[type=checkbox]::after { content:""; width:10px; height:5px; border-left:2.5px solid var(--accent-ink); border-bottom:2.5px solid var(--accent-ink); transform:rotate(-45deg) translate(1px,-1px) scale(0); transition:transform .12s; }
input[type=checkbox]:checked { background:var(--accent); border-color:var(--accent); }
input[type=checkbox]:checked::after { transform:rotate(-45deg) translate(1px,-1px) scale(1); }

/* eigene Farbauswahl */
.cp { position:relative; }
.sw-custom { background:conic-gradient(#ff3b3b,#ffd23b,#3bff6a,#3bf0ff,#3b5bff,#ff3bd9,#ff3b3b); }
.cp-pop { position:absolute; z-index:30; top:100%; left:0; margin-top:6px; width:250px; padding:12px; display:flex; flex-direction:column; gap:12px; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 16px 40px #0008; }
.cp-sv { position:relative; height:150px; border-radius:8px; cursor:crosshair; touch-action:none; }
.cp-hue { position:relative; height:14px; border-radius:7px; cursor:pointer; touch-action:none; background:linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00); }
.cp-thumb { position:absolute; width:18px; height:18px; margin:-9px 0 0 -9px; border-radius:50%; border:2.5px solid #fff; box-shadow:0 0 0 1px #0007, 0 2px 6px #0006; pointer-events:none; }
.cp-hue .cp-thumb { top:50%; }
.cp-foot { display:flex; gap:10px; align-items:center; }
.sw-prev.big { width:30px; height:30px; border:0; flex:none; }
.cp-sv:focus-visible, .cp-hue:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* eigene Scrollleisten */
* { scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
*::-webkit-scrollbar { width:10px; height:10px; }
*::-webkit-scrollbar-thumb { background:var(--line); border-radius:10px; border:2px solid transparent; background-clip:content-box; }
*::-webkit-scrollbar-thumb:hover { background:var(--muted); background-clip:content-box; border:2px solid transparent; }
*::-webkit-scrollbar-track { background:transparent; }
.imgrow .rowbtn { display:flex; gap:6px; }
.imgrow input[type=text], .imgrow input:not([type]) { min-width:0; }
.modal h3 { margin:18px 0 4px; font-size:1em; }
