/* JP Studio in der Handy-App – Oberfläche wie Canva am Handy (Johannes' Wunsch vom 22.10.2026).
   Gilt nur, wenn studio-app.js die Klasse „app-ed“ setzt (nur in der Kundenportal-App).
   Die Webversion am Handy behält die Ansicht „Variante B“ (studio-handy.js). Editor-Dateien bleiben unverändert;
   hier wird nur umgestellt, wo die Bausteine des Editors liegen. */
/* Abstand zum unteren Rand: Die Studio-Seiten haben kein viewport-fit=cover, darum ist env(safe-area-inset-bottom) dort 0.
   Mindestens 26 px Luft, damit Wischen in den Leisten nicht die iPhone-Geste „App wechseln“ auslöst (Canva lässt ähnlich viel Platz). */
html.in-app:not(#_){--app-safe-b:max(env(safe-area-inset-bottom,0px),26px)}
html.in-app:not(#_) .hm-bottomnav{bottom:calc(10px + var(--app-safe-b))!important}
@media (max-width:900px){html.in-app:not(#_) body:has(.hm-bottomnav) .jpa{--jpa-bottom:calc(92px + var(--app-safe-b))}}
@media (max-width:900px){html.in-app:not(#_) .hm-main{padding-bottom:calc(100px + var(--app-safe-b))!important}}

body.app-ed:not(#_){
  --app-top:calc(52px + env(safe-area-inset-top,0px));
  --app-bar:calc(66px + var(--app-safe-b));
  --app-strip:76px;
  --app-sheet:56vh;
  --app-ink:#172747;
  --app-grad:linear-gradient(100deg,#172747 0%,#2b4c9b 55%,#5a4fcf 100%);
  overscroll-behavior:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none
}
body.app-ed:not(#_) input,body.app-ed:not(#_) textarea,body.app-ed:not(#_) [contenteditable]{-webkit-user-select:text;user-select:text}
body.app-ed:not(#_) .hv{display:none!important}

/* ---------- Gerüst ---------- */
body.app-ed:not(#_) .ed{display:block!important;position:fixed;inset:0;height:auto!important}
body.app-ed:not(#_) .ed-main{display:block!important;position:absolute;inset:var(--app-top) 0 0 0;background:#eef1f6!important}

/* ---------- Kopfleiste oben ---------- */
body.app-ed:not(#_) .ed-top{position:absolute;left:0;right:0;top:0;height:var(--app-top)!important;padding:env(safe-area-inset-top,0px) 8px 0!important;
  background:var(--app-grad)!important;color:#fff!important;border:0!important;box-shadow:none!important;gap:4px!important;z-index:60}
body.app-ed:not(#_) .ed-top-left,body.app-ed:not(#_) .ed-top-right{gap:2px!important;flex-wrap:nowrap;min-width:0}
body.app-ed:not(#_) .ed-top .ed-brand,body.app-ed:not(#_) .ed-top .ed-menu-wrap,body.app-ed:not(#_) #btnResize,body.app-ed:not(#_) .ed-top .ed-sep,
body.app-ed:not(#_) #docTitle,body.app-ed:not(#_) #docMeta,body.app-ed:not(#_) #btnRole,body.app-ed:not(#_) #btnExport,body.app-ed:not(#_) .ed-top .ed-live{display:none!important}
body.app-ed:not(#_) .ed-top .ed-save{display:none!important}
body.app-ed:not(#_) .ed-top .ed-save[data-st="offline"],body.app-ed:not(#_) .ed-top .ed-save[data-st="error"]{display:flex!important;font-size:0!important;color:#fff!important;background:rgba(255,255,255,.16)!important;border-radius:999px}
body.app-ed:not(#_) .ed-top .ed-iconbtn,body.app-ed:not(#_) .ed-top .ed-homebtn,body.app-ed:not(#_) .app-topbtn{width:42px;height:42px;display:grid;place-items:center;border-radius:12px;
  background:transparent!important;border:0!important;color:#fff!important;padding:0;flex:none}
body.app-ed:not(#_) .ed-top .ed-iconbtn:disabled{opacity:.4}
body.app-ed:not(#_) .ed-top svg.i,body.app-ed:not(#_) .app-topbtn svg{width:24px;height:24px;stroke:#fff;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
body.app-ed:not(#_) .app-topbtn:active,body.app-ed:not(#_) .ed-top .ed-iconbtn:active{background:rgba(255,255,255,.16)!important}
body.app-ed:not(#_) .ed-statusarea{display:flex;gap:4px;align-items:center}
body.app-ed:not(#_) .ed-statusarea button{font-size:0!important;min-width:38px;height:36px;padding:0 9px!important;border-radius:999px!important;
  background:rgba(255,255,255,.16)!important;color:#fff!important;border:0!important;box-shadow:none!important}
body.app-ed:not(#_) .ed-statusarea button svg{stroke:#fff}

/* ---------- Arbeitsfläche ---------- */
body.app-ed:not(#_) .ed-work{display:block!important;position:absolute;inset:0;background:transparent!important}
body.app-ed:not(#_) .ed-scroll{position:absolute;left:0;right:0;top:0;bottom:calc(var(--app-bar) + var(--app-strip));touch-action:none}
body.app-ed.app-nostrip:not(#_) .ed-scroll{bottom:var(--app-bar)}
body.app-ed:not(#_) .ed-stage{padding:16px!important}
body.app-ed:not(#_) .ed-foot,body.app-ed:not(#_) .ed-notes{display:none!important}

/* ---------- Seitenleiste (Seiten + „+“) über der Werkzeugleiste ---------- */
body.app-ed:not(#_) .ed-bottom{position:absolute!important;left:0;right:0;bottom:var(--app-bar);height:var(--app-strip);margin:0!important;padding:0!important;
  background:rgba(255,255,255,.92)!important;border-top:1px solid #e3e7ef!important;pointer-events:auto!important;z-index:20}
body.app-ed.app-nostrip:not(#_) .ed-bottom{display:none!important}
body.app-ed:not(#_) .ed-pagestrip{height:100%;padding:8px 12px!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;border:0!important;
  overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scrollbar-width:none}
body.app-ed:not(#_) .ed-pagestrip::-webkit-scrollbar{display:none}
body.app-ed:not(#_) .ed-pagelist{height:100%;flex-wrap:nowrap!important;align-items:center;gap:10px!important}

/* ---------- Werkzeugleiste unten (Vorlagen, Elemente, Text …) ---------- */
body.app-ed:not(#_) .ed-rail{position:absolute!important;left:0;right:0;bottom:0;top:auto!important;height:var(--app-bar);width:auto!important;z-index:40;
  display:flex!important;flex-direction:row!important;gap:0!important;padding:4px 4px var(--app-safe-b)!important;
  overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scrollbar-width:none;
  background:#fff!important;border:0!important;border-top:1px solid #e3e7ef!important;border-radius:0!important;box-shadow:0 -4px 18px rgba(23,39,71,.06)!important}
body.app-ed:not(#_) .ed-rail::-webkit-scrollbar{display:none}
body.app-ed:not(#_) .ed-railbtn{flex:0 0 auto;min-width:74px;height:58px!important;margin:0!important;padding:4px 6px!important;border-radius:14px!important;
  display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:4px;background:transparent!important;
  font-size:12px!important;font-weight:600;line-height:1.1;color:#4a5874!important;white-space:nowrap;hyphens:none!important}
body.app-ed:not(#_) .ed-railbtn svg.i{width:26px!important;height:26px!important}
body.app-ed:not(#_) .ed-railbtn.active{color:var(--app-ink)!important;background:transparent!important}
body.app-ed:not(#_) .ed-railbtn.active svg.i{background:#fff;border-radius:12px;box-shadow:0 2px 10px rgba(23,39,71,.18);padding:4px;width:34px!important;height:34px!important;margin:-4px 0}
body.app-ed:not(#_) .ed-railbtn .ed-new,body.app-ed:not(#_) .ed-railbtn .badge,body.app-ed:not(#_) .ed-railbtn em{display:none!important}

/* ---------- Werkzeug-Fenster als Blatt von unten ---------- */
body.app-ed:not(#_) .ed-panel{position:absolute!important;left:0!important;right:0!important;top:auto!important;bottom:var(--app-bar)!important;width:auto!important;
  height:var(--app-sheet)!important;max-height:calc(100% - var(--app-bar) - 8px);margin:0!important;z-index:35;border:0!important;
  border-radius:22px 22px 0 0!important;background:#fff!important;box-shadow:0 -10px 34px rgba(23,39,71,.18)!important;
  transform:translateY(0);transition:transform .28s cubic-bezier(.2,.8,.2,1),height .2s;display:flex!important;flex-direction:column;padding-top:22px}
body.app-ed:not(#_) .ed-panel.app-dragging{transition:none}
body.app-ed:not(#_) .ed-panel.closed{transform:translateY(calc(100% + var(--app-bar) + 20px));box-shadow:none!important}
body.app-ed:not(#_) .ed-panel.closed .ed-panel-inner{visibility:visible!important}
body.app-ed:not(#_) .ed-panel::before{content:"";position:absolute;top:8px;left:50%;width:42px;height:5px;margin-left:-21px;border-radius:3px;background:#d3d8e2}
body.app-ed:not(#_) .app-grab{position:absolute;left:0;right:0;top:0;height:30px;z-index:2;touch-action:none}
body.app-ed:not(#_) .ed-panel-back,body.app-ed:not(#_) .ed-panel-toggle{display:none!important}
body.app-ed:not(#_) .ed-panel-inner{flex:1;min-height:0;overflow-y:auto!important;-webkit-overflow-scrolling:touch;padding:0 16px calc(16px + var(--app-safe-b))!important;width:auto!important}
body.app-ed:not(#_) .ed-panel-inner h3:first-child{display:none}
body.app-ed:not(#_) .ed-panel-inner input[type="search"],body.app-ed:not(#_) .ed-panel-inner .ed-search{font-size:16px!important;border-radius:14px!important;min-height:46px}

/* ---------- Werkzeuge für das ausgewählte Element (ersetzen unten die Werkzeugleiste) ---------- */
body.app-ed:not(#_) .ed-ctx{position:absolute!important;left:0!important;right:0!important;top:auto!important;bottom:0!important;transform:none!important;
  height:var(--app-bar);max-width:none!important;width:auto!important;margin:0!important;z-index:45;border-radius:0!important;
  padding:4px 8px var(--app-safe-b)!important;display:none!important;flex-wrap:nowrap!important;overflow-x:auto!important;overflow-y:hidden;
  -webkit-overflow-scrolling:touch;scrollbar-width:none;background:#fff!important;border:0!important;border-top:1px solid #e3e7ef!important;box-shadow:0 -4px 18px rgba(23,39,71,.06)!important}
body.app-ed:not(#_) .ed-ctx::-webkit-scrollbar{display:none}
body.app-ed.app-hassel:not(#_) .ed-ctx{display:flex!important}
body.app-ed.app-hassel:not(#_) .ed-rail{visibility:hidden}
body.app-ed:not(#_) .ed-ctx > *{flex:0 0 auto}
body.app-ed:not(#_) .ed-ctx .ed-tb{min-height:48px;min-width:48px;border-radius:14px!important;font-size:12px!important;flex-direction:column;gap:2px}
body.app-ed:not(#_) .ed-ctx .ed-tb svg.i{width:22px;height:22px}
body.app-ed:not(#_) .ed-ctx .ed-ctxmore{display:none!important}
body.app-ed:not(#_) .app-done{position:sticky;left:0;z-index:2;flex:0 0 auto;align-self:center;margin-right:6px;height:48px;padding:0 14px 0 10px;border-radius:14px;border:0;
  background:var(--app-ink);color:#fff;font:600 13px/1 inherit;display:flex;align-items:center;gap:6px;box-shadow:6px 0 10px #fff}
body.app-ed:not(#_) .app-done svg{width:20px;height:20px;stroke:#fff;fill:none;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
body.app-ed:not(#_) .ed-ctx .app-act span{font-size:11px;font-weight:600}

/* Kleine Fenster (Farbe, Schrift …) als Blatt von unten */
body.app-ed:not(#_) .ed-pop:not([hidden]){position:fixed!important;left:8px!important;right:8px!important;top:auto!important;bottom:calc(var(--app-bar) + 8px)!important;
  width:auto!important;max-width:none!important;max-height:58vh!important;overflow-y:auto!important;border-radius:20px!important;z-index:70!important}
body.app-ed:not(#_) .ed-float{display:none!important}

/* Hinweise, Dialoge */
body.app-ed:not(#_) .ed-toast{bottom:calc(var(--app-bar) + var(--app-strip) + 12px)!important}
body.app-ed:not(#_) .ed-modal .ed-dialog{max-height:calc(100dvh - var(--app-top) - 24px);overflow-y:auto}

/* Seiten-Übersicht und Vorschau */
body.app-ed:not(#_) .ed-present{padding-top:env(safe-area-inset-top,0px)}
body.app-ed:not(#_) .ed-present .phint{display:none}

/* JP-Assistent (schwarzer Knopf) über die Leisten heben */
body.app-ed:not(#_) .jpa{--jpa-bottom:calc(var(--app-bar) + var(--app-strip) + 12px);--jpa-top:calc(var(--app-top) + 10px);--jpa-side:12px}
body.app-ed.app-hassel:not(#_) .jpa,body.app-ed.app-sheet:not(#_) .jpa{display:none!important}

/* Startseite des Studios in der App: hier wird auch gestaltet (statt „am besten am Computer“) */
@media (max-width:760px) and (pointer:coarse){
  /* In der App wird am Handy auch neu gestaltet: „Neues Design“ und „Was möchten Sie erstellen?“ wieder zeigen */
  html.in-app:not(#_) #newBtn,html.in-app:not(#_) .hm-boxcard:has(.hm-formats){display:block!important}
  html.in-app:not(#_) .ps-quick{display:flex!important}
  html.in-app:not(#_) .hm-head::after{content:"Tippen Sie ein Design an, um es zu bearbeiten – oder legen Sie ein neues an."!important}
}

/* Seiten-Vorschaubilder in der Leiste */
body.app-ed:not(#_) .ed-pthumb{border:2px solid transparent!important;border-radius:10px!important;padding:0!important;background:#fff!important;box-shadow:0 1px 4px rgba(23,39,71,.12)}
body.app-ed:not(#_) .ed-pthumb.on{border-color:var(--app-ink)!important}
body.app-ed:not(#_) .ed-pthumb .pimg{border-radius:8px;overflow:hidden;background:#fff;display:block}
body.app-ed:not(#_) .ed-pthumb .pmore{top:2px!important;right:2px!important;width:22px;height:22px;opacity:.85}
body.app-ed:not(#_) .ed-pthumb .pnum{display:none}
body.app-ed:not(#_) .ed-padd button{border-radius:10px!important;width:48px}

/* Dialoge (Herunterladen, Größe, Vorlage …) als Blatt von unten */
body.app-ed:not(#_) .ed-modal:not([hidden]){align-items:flex-end!important;padding:0!important}
body.app-ed:not(#_) .ed-modal .ed-dialog{width:100%!important;max-width:none!important;margin:0!important;border-radius:22px 22px 0 0!important;
  max-height:calc(100dvh - var(--app-top) - 8px)!important;overflow-y:auto!important;padding-bottom:calc(18px + var(--app-safe-b))!important;
  animation:app-up .26s cubic-bezier(.2,.8,.2,1)}
@keyframes app-up{from{transform:translateY(40%);opacity:.4}to{transform:none;opacity:1}}
body.app-ed:not(#_):has(#modal:not([hidden])) .jpa,body.app-ed:not(#_):has(.ed-pop:not([hidden])) .jpa{display:none!important}

/* Fotoalbum vom iPhone */
body.app-ed:not(#_) .app-album-head{font-size:15px;font-weight:700;color:var(--app-ink);margin:4px 2px 10px}
body.app-ed:not(#_) .app-album{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
body.app-ed:not(#_) .app-ph{position:relative;aspect-ratio:1;border:0;padding:0;border-radius:14px;overflow:hidden;background:#eef1f6;display:block}
body.app-ed:not(#_) .app-ph img{width:100%;height:100%;object-fit:cover;display:block}
body.app-ed:not(#_) .app-ph:active{transform:scale(.97)}
/* Foto liegt nur in iCloud: kein Vorschaubild, wird erst beim Antippen geladen (23.10.2026) */
body.app-ed:not(#_) .app-ph-cloud{display:grid;place-items:center;color:#5b6478;font-size:.72rem;font-weight:600}
body.app-ed:not(#_) .app-ph-busy::after{content:"";position:absolute;inset:0;background:rgba(255,255,255,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23172747' stroke-width='2.5' stroke-dasharray='40 20'/%3E%3C/svg%3E") center/32px no-repeat}
body.app-ed:not(#_) .app-ph-wait{animation:app-pulse 1.1s ease-in-out infinite alternate}
@keyframes app-pulse{from{opacity:.5}to{opacity:1}}
body.app-ed:not(#_) .app-cam{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;background:#f3f5f9;color:var(--app-ink);font:600 14px/1 inherit}
body.app-ed:not(#_) .app-cam svg{width:34px;height:34px;stroke:var(--app-ink);fill:none;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
body.app-ed:not(#_) .app-album-note{background:#f3f5f9;border-radius:14px;padding:12px 14px;font-size:14px;line-height:1.45;color:#3c4a66;margin-bottom:12px}
body.app-ed:not(#_) .app-more{width:100%;margin-top:12px;min-height:46px;border-radius:14px}

/* Reihenfolge der Werkzeugleiste wie bei Canva: KI zuerst */
body.app-ed:not(#_) .ed-railbtn[data-panel="ai"]{order:-1}
body.app-ed:not(#_) .ed-railbtn[data-panel="templates"]{order:1}
body.app-ed:not(#_) .ed-railbtn[data-panel="elements"]{order:2}
body.app-ed:not(#_) .ed-railbtn[data-panel="text"]{order:3}
body.app-ed:not(#_) .ed-railbtn[data-panel="album"]{order:4}
body.app-ed:not(#_) .ed-railbtn[data-panel="brand"]{order:5}
body.app-ed:not(#_) .ed-railbtn[data-panel="uploads"]{order:6}
body.app-ed:not(#_) .ed-railbtn[data-panel="photos"]{order:7}
body.app-ed:not(#_) .ed-railbtn[data-panel="charts"]{order:8}
body.app-ed:not(#_) .ed-railbtn[data-panel="qr"]{order:9}
body.app-ed:not(#_) .ed-railbtn{order:10}
body.app-ed:not(#_) .ed-railbtn[data-panel="ai"] svg.i{color:#5a4fcf}
/* „Foto einsetzen“: weitere Quellen über den Reitern (23.10.2026) */
body.app-ed:not(#_) .app-mpsrc{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:6px 0 10px}
body.app-ed:not(#_) .app-mpsrc button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 6px;border:1px solid #e3e7ef;border-radius:12px;background:#fff;color:#1b2d5b;font:inherit;font-size:.78rem;font-weight:600}
body.app-ed:not(#_) .app-mpsrc svg{width:22px;height:22px}
/* Schreiben: unten Platz für die Tastatur, damit der Text darüber rücken kann */
body.app-ed:not(#_) .ed-stage{padding-bottom:calc(16px + var(--app-kb, 0px))!important}
