:root { --bg:#eef0f4; --card:#fff; --fg:#1d2330; --muted:#6b7385; --line:#d9dce3; --accent:#3b5bdb; --warn:#c92a2a; --ok:#2b8a3e; --stage:#c9ced8; --tb:44px; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#14171e; --card:#1d222c; --fg:#e8eaf0; --muted:#9aa3b5; --line:#313847; --accent:#7c93ff; --warn:#ff8787; --ok:#69db7c; --stage:#0f1218; }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin:0; font:15px/1.4 system-ui, 'Segoe UI', sans-serif; background:var(--bg); color:var(--fg); }
body.editing-view { overflow:hidden; }
[hidden] { display:none !important; }
.hide { display:none !important; }
.grow { flex:1; }
main { max-width:900px; margin:24px auto; padding:0 16px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:20px; display:flex; flex-direction:column; gap:14px; }
.card.narrow { max-width:380px; margin:12vh auto 0; }
h1 { margin:0; font-size:1.3rem; }
h2 { margin:0 0 10px; font-size:1.15rem; }
label { display:flex; flex-direction:column; gap:4px; font-size:.9rem; color:var(--muted); }
input, textarea, button, select { font:inherit; color:inherit; }
input[type=text], input[type=number], input:not([type]), input[type=password], select, textarea { background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:8px 10px; min-width:0; }
button { min-height:40px; padding:0 14px; border-radius:8px; border:1px solid var(--line); background:var(--card); cursor:pointer; }
button:disabled { opacity:.4; cursor:default; }
button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
button.danger { color:var(--warn); }
.row { display:flex; gap:10px; align-items:center; }
.row input { flex:1; min-width:0; }
.msg { margin:0; min-height:1.2em; color:var(--warn); }
.hint { margin:0; color:var(--muted); font-size:.85rem; }
ul { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
li { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--line); border-radius:8px; }
li .name { flex:1; cursor:pointer; font-weight:600; }
li small { color:var(--muted); }

/* ---- Editor-Rahmen ---- */
#viewEdit { display:flex; flex-direction:column; height:100vh; height:100dvh; }
.toolbar { display:flex; align-items:center; gap:6px; padding:5px 8px; background:var(--card); border-bottom:1px solid var(--line); height:var(--tb); flex:none; overflow-x:auto; overflow-y:hidden; white-space:nowrap; scrollbar-width:none; }
.toolbar::-webkit-scrollbar { display:none; }
.toolbar .tb { min-height:34px; min-width:34px; padding:0 10px; }
.toolbar .tb.yellow { background:#fff1c2; color:#222; } .toolbar .tb.blue { background:#e1ecff; color:#222; }
.toolbar .tb.primary { color:#fff; }
.toolbar .sep { width:1px; height:22px; background:var(--line); margin:0 4px; }
.nameinput { width:170px; font-weight:600; padding:5px 8px !important; }
.zoomval { min-width:48px; text-align:center; font-size:.85rem; color:var(--muted); }
.status { font-size:.82rem; padding:0 6px; } .status.ok { color:var(--ok); } .status.warn { color:var(--warn); } .status.dirty { color:var(--muted); }
.masterbanner { display:flex; align-items:center; gap:8px; font-weight:600; color:var(--accent); }
.narrow-only { display:none; }
.workarea { flex:1; display:flex; min-height:0; position:relative; }
.side { width:250px; flex:none; overflow-y:auto; background:var(--card); }
.side.left { border-right:1px solid var(--line); width:172px; padding:8px; display:flex; flex-direction:column; gap:8px; }
.side.right { border-left:1px solid var(--line); padding:8px 12px 40px; }
.stage { flex:1; overflow:auto; background:var(--stage); touch-action:none; position:relative; padding:24px; }
.pagewrap { position:relative; margin:0 auto; box-shadow:0 2px 14px rgba(0,0,0,.35); flex:none; }
body.master-mode .stage { box-shadow:inset 0 0 0 3px var(--accent); }

/* ---- Seite ---- */
.page { position:absolute; left:0; top:0; transform-origin:0 0; overflow:hidden; color:#111; }
.layer-master, .layer-page { position:absolute; inset:0; }
.layer-master { pointer-events:none; }
.el { position:absolute; transform-origin:50% 50%; user-select:none; -webkit-user-select:none; touch-action:none; }
.el.text { display:flex; flex-direction:column; overflow:hidden; }
.el.text .t { width:100%; flex:none; white-space:pre-wrap; word-break:break-word; outline:none; }
.el.text.editing { overflow:visible; user-select:text; -webkit-user-select:text; cursor:text; }
.el.text.overflow::after { content:'Text zu lang'; position:absolute; right:0; bottom:0; font:10px system-ui; background:#e03131; color:#fff; padding:1px 5px; border-radius:3px 0 0 0; pointer-events:none; }
.el.image img { width:100%; height:100%; display:block; pointer-events:none; }
.el.image { overflow:hidden; }
.el.shape .ln { width:100%; margin-top:0; }
.el.locked { cursor:default; }
.overlay { position:absolute; inset:0; pointer-events:none; }
.selbox { position:absolute; outline:1.5px solid var(--accent); transform-origin:50% 50%; }
.selbox.locked { outline-style:dashed; }
.handle { position:absolute; width:12px; height:12px; margin:-6px 0 0 -6px; background:#fff; border:1.5px solid var(--accent); border-radius:3px; pointer-events:auto; touch-action:none; }
@media (pointer:coarse) { .handle { width:22px; height:22px; margin:-11px 0 0 -11px; border-radius:6px; } }
.handle.h-n, .handle.h-s { cursor:ns-resize; } .handle.h-e, .handle.h-w { cursor:ew-resize; }
.handle.h-nw, .handle.h-se { cursor:nwse-resize; } .handle.h-ne, .handle.h-sw { cursor:nesw-resize; }
.handle.rot { left:50%; top:-28px; border-radius:50%; cursor:grab; }
.handle.rot::after { content:''; position:absolute; left:50%; top:100%; width:1.5px; height:16px; background:var(--accent); transform:translateX(-50%); }
.guide { position:absolute; background:#f0f; opacity:.8; }
.guide.x { top:0; bottom:0; width:1px; } .guide.y { left:0; right:0; height:1px; }
.marquee { position:absolute; border:1px dashed var(--accent); background:rgba(59,91,219,.12); }

/* ---- Seitenliste ---- */
.tabs { display:flex; gap:4px; flex-wrap:wrap; }
.tabs button { min-height:30px; padding:0 8px; font-size:.82rem; }
.tabs button.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.btnrow { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.btnrow.end { justify-content:flex-end; margin-top:14px; }
.ib { min-height:34px; min-width:34px; padding:0 10px; font-size:.85rem; }
.ib.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.thumbs { display:flex; flex-direction:column; gap:10px; }
.thumb { cursor:pointer; padding:4px; border:2px solid transparent; border-radius:6px; }
.thumb.cur { border-color:var(--accent); }
.thumb.over { border-color:var(--warn); }
.thumbbox { position:relative; overflow:hidden; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.3); }
.thumbbox .page { pointer-events:none; }
.thumb .num { font-size:.8rem; text-align:center; color:var(--muted); margin-top:3px; }
.mlist { display:flex; flex-direction:column; gap:6px; }
.mitem { padding:8px; border:1px solid var(--line); border-radius:8px; cursor:pointer; font-size:.88rem; }
.mitem.cur { border-color:var(--accent); background:rgba(59,91,219,.1); }

/* ---- Eigenschaften ---- */
.grp { border-bottom:1px solid var(--line); padding:10px 0; display:flex; flex-direction:column; gap:8px; }
.grp h3 { margin:0; font-size:.78rem; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
.grp .grp { border:none; padding:6px 0 0; }
.f { display:flex; flex-direction:column; gap:3px; font-size:.78rem; color:var(--muted); }
.f input, .f select { width:100%; font-size:.9rem; color:var(--fg); }
.f input[type=color] { padding:0; height:34px; }
.f input[type=range] { padding:0; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.colorrow { display:flex; gap:6px; } .colorrow select { flex:1; } .colorrow input[type=color] { width:44px; flex:none; }
.check { flex-direction:row; align-items:center; gap:8px; color:var(--fg); }

/* ---- Dialoge, Meldungen ---- */
.modal-back { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; z-index:50; padding:12px; }
.modal { background:var(--card); border-radius:12px; padding:20px; max-width:520px; width:100%; max-height:92vh; overflow:auto; }
.modal.wide { max-width:820px; }
.filelist li { padding:6px 10px; font-size:.85rem; justify-content:space-between; }
.conflict { border:1px solid var(--line); border-radius:8px; padding:10px; margin-top:10px; }
.conflict h3 { margin:0 0 8px; font-size:1rem; }
.choices { display:flex; gap:12px; flex-wrap:wrap; }
.choice { flex-direction:row; flex-wrap:wrap; gap:8px; align-items:flex-start; color:var(--fg); flex:1 1 240px; border:1px solid var(--line); border-radius:8px; padding:8px; }
.choice > .gone { flex-basis:100%; } .choice > .thumbbox { flex:none; }
.gone { color:var(--muted); font-style:italic; padding:20px 0; }
#toasts { position:fixed; right:12px; bottom:12px; display:flex; flex-direction:column; gap:8px; z-index:60; max-width:min(420px, 90vw); }
.toast { background:#222; color:#fff; padding:10px 14px; border-radius:8px; box-shadow:0 2px 10px rgba(0,0,0,.4); font-size:.9rem; }
.toast.warn { background:#b02a2a; }

/* ---- Tablet / schmal ---- */
@media (max-width:1000px) {
  .narrow-only { display:inline-block; }
  .side { position:absolute; top:0; bottom:0; z-index:20; box-shadow:0 0 20px rgba(0,0,0,.4); display:none; }
  .side.left { left:0; } .side.right { right:0; width:min(300px, 86vw); }
  body.show-left .side.left { display:flex; } body.show-right .side.right { display:block; }
  .nameinput { width:110px; }
}

/* Zahlenfelder mit großen Plus/Minus-Knöpfen statt kleiner Pfeile */
input[type=number] { -moz-appearance:textfield; appearance:textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.stepper { display:flex; align-items:stretch; min-width:0; }
.stepper input { text-align:center; border-radius:0 !important; flex:1; min-width:0; width:100%; }
.stepper .sb { min-height:36px; min-width:34px; padding:0; font-size:1.1rem; flex:none; }
.stepper .sb:first-child { border-radius:8px 0 0 8px; } .stepper .sb:last-child { border-radius:0 8px 8px 0; }
.sliderrow { display:grid; grid-template-columns:1fr 130px; gap:8px; align-items:center; }
.sliderrow input[type=range] { width:100%; }
.colrow { display:flex; gap:6px; align-items:center; margin-bottom:6px; }
.colrow input[type=text] { flex:1; } .colrow input[type=color] { width:48px; height:36px; padding:0; flex:none; }
.keys { border-collapse:collapse; width:100%; font-size:.88rem; }
.keys th { text-align:left; padding:5px 10px 5px 0; white-space:nowrap; vertical-align:top; color:var(--accent); font-weight:600; }
.keys td { padding:5px 0; }
.var { background:rgba(59,91,219,.16); outline:1px dashed rgba(59,91,219,.6); border-radius:2px; }
.thumbbox .var { background:none; outline:none; }
.layers { display:flex; flex-direction:column; gap:4px; }
.layer { display:flex; align-items:center; gap:6px; padding:5px 6px; border:1px solid var(--line); border-radius:6px; cursor:pointer; font-size:.82rem; }
.layer.sel { border-color:var(--accent); background:rgba(59,91,219,.12); }
.layer.over { border-color:var(--warn); }
.layer .ic { width:18px; text-align:center; color:var(--muted); flex:none; } .layer .lb { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.layer .lk { min-height:26px; min-width:26px; padding:0; border:none; background:none; }
.popmenu { position:fixed; z-index:70; background:var(--card); border:1px solid var(--line); border-radius:10px; box-shadow:0 6px 24px rgba(0,0,0,.35); padding:6px; display:flex; flex-direction:column; gap:4px; min-width:200px; }
.popmenu button { text-align:left; }
