/* JEMAI Flow · interfaccia dell'editor (si appoggia a /assets/site.css) · Copyright Jemai Solutions */
.jf-hero { padding-top: 124px; padding-bottom: 20px; }
.jf-hero h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); max-width: 920px; }
.jf-shell { width: min(calc(100% - 32px), 1720px); margin: 6px auto 0; }
html.jf-lock, html.jf-lock body { overflow: hidden; }

/* ───────── contenitore ───────── */
#jfApp { --jf-sel: #1a8fd6; --jf-red: var(--red); --jf-panel: #0d0f13; --jf-field: #08090b; --jf-btn: #12151b;
  position: relative; display: grid; grid-template-columns: 304px minmax(0, 1fr); height: clamp(560px, calc(100dvh - 92px), 1120px);
  border: 1px solid var(--line2); border-radius: var(--r3); overflow: hidden; background: var(--bg2); color: var(--text);
  font-family: var(--sans); line-height: 1.35; font-size: 14px; box-shadow: 0 40px 90px -50px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.02); isolation: isolate; }
#jfApp.is-full { position: fixed; inset: 0; height: 100dvh; width: 100vw; border: 0; border-radius: 0; z-index: 2500; }
#jfApp *, #jfApp *::before, #jfApp *::after { box-sizing: border-box; }
#jfApp button, #jfApp input, #jfApp select, #jfApp textarea { font: inherit; color: inherit; }
#jfApp :focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ───────── pannello strumenti ───────── */
#jfApp .sidebar { min-height: 0; background: linear-gradient(180deg, #0f1116, #0a0b0e); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; z-index: 30; }
#jfApp .sidebarScroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 12px 26px; scrollbar-width: thin; scrollbar-color: #2a2f39 transparent; }
#jfApp .sidebarScroll::-webkit-scrollbar { width: 8px; } #jfApp .sidebarScroll::-webkit-scrollbar-thumb { background: #262b34; border-radius: 8px; }
.jf-brand { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.jf-brand-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--red2); background: rgba(255,61,71,.1); border: 1px solid rgba(255,61,71,.3); flex: none; }
.jf-brand-n { font-size: 1.12rem; font-weight: 600; color: var(--ivory); letter-spacing: -.01em; } .jf-brand-n b { color: var(--red2); font-weight: 600; }
.jf-brand-s { font-family: var(--mono); font-size: .68rem; color: var(--text2); margin-top: 2px; }
#jfApp .jf-scrim { display: none; }
#jfApp .sbSec { padding: 0; margin: 10px 0 0; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.015); }
#jfApp .sbHead { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; color: var(--ivory); font-weight: 600; font-size: 13px; padding: 9px 10px; cursor: pointer; text-align: left; border-radius: 12px; transition: background .15s; }
#jfApp .sbHead:hover { background: rgba(255,255,255,.035); }
#jfApp .sbIco { flex: none; width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #ff7b82; background: rgba(255,61,71,.09); border: 1px solid rgba(255,61,71,.2); }
#jfApp .sbIco svg { width: 14px; height: 14px; }
#jfApp .sbTitle { flex: 1; } #jfApp .sbChev { color: var(--text3); transition: transform .18s var(--ease); }
#jfApp .sbSec.closed .sbChev { transform: rotate(-90deg); } #jfApp .sbSec.closed .sbBody { display: none; }
#jfApp .sbBody { padding: 2px 10px 12px; }
#jfApp .subTitle { margin: 14px 2px 6px; font-family: var(--mono); font-size: .64rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); display: flex; align-items: center; gap: 8px; }
#jfApp .subTitle::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#jfApp .field { display: block; margin: 9px 0 0; }
#jfApp .field label { display: block; font-size: 11.5px; font-weight: 600; color: #c4cad3; margin-bottom: 5px; }
#jfApp .subLabel { font-weight: 400; color: var(--text3); }
#jfApp .twoCol { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
#jfApp input[type=text], #jfApp input[type=number], #jfApp select, #jfApp textarea { width: 100%; min-height: 0; margin: 0; padding: 8px 10px; font-size: 13px; color: var(--ivory); background-color: var(--jf-field); border: 1px solid var(--line2); border-radius: 8px; outline: none; transition: border-color .15s, box-shadow .15s; }
#jfApp textarea { min-height: 56px; resize: vertical; line-height: 1.4; }
#jfApp input::placeholder, #jfApp textarea::placeholder { color: var(--text3); }
#jfApp input[type=text]:hover, #jfApp input[type=number]:hover, #jfApp select:hover, #jfApp textarea:hover { border-color: rgba(255,255,255,.22); }
#jfApp input[type=text]:focus, #jfApp input[type=number]:focus, #jfApp select:focus, #jfApp textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(86,200,255,.16); }
#jfApp select { appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239299a5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 13px; }
#jfApp select option { background: #111318; color: var(--ivory); }
#jfApp input[type=color] { width: 46px; height: 32px; border: 1px solid var(--line2); border-radius: 8px; background: var(--jf-field); padding: 3px; cursor: pointer; }
#jfApp input[type=color]::-webkit-color-swatch-wrapper { padding: 0; } #jfApp input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; } #jfApp input[type=color]::-moz-color-swatch { border: 0; border-radius: 5px; }
#jfApp input[type=checkbox] { accent-color: var(--red); width: 16px; height: 16px; flex: none; }
#jfApp .toolGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 4px; }
#jfApp .toolBtn { position: relative; border: 1px solid var(--line2); background: var(--jf-btn); color: var(--ivory); border-radius: 10px; padding: 9px 9px; min-height: 50px; cursor: pointer; text-align: left; transition: background .15s, border-color .15s, transform .15s; }
#jfApp .toolBtn:hover { background: #171b22; border-color: rgba(255,255,255,.24); }
#jfApp .toolBtn:active { transform: translateY(1px); }
#jfApp .toolBtn strong { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
#jfApp .toolBtn small { display: block; color: var(--text2); font-size: 10.6px; line-height: 1.32; margin-top: 4px; font-weight: 400; }
#jfApp .toolBtn .ico { flex: none; width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.055); color: #d6dbe3; font-size: 11px; }
#jfApp .toolBtn .ico svg { width: 14px; height: 14px; }
#jfApp .toolBtn.wide { grid-column: 1 / -1; min-height: 46px; }
#jfApp .toolBtn.active { border-color: var(--red2); background: rgba(227,6,19,.14); box-shadow: 0 0 0 3px rgba(227,6,19,.16); }
#jfApp .toolBtn.active .ico { background: var(--red); color: #fff; }
#jfApp .toolBtn.primary { background: var(--red); border-color: transparent; box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, 0 10px 24px -14px rgba(227,6,19,.9); }
#jfApp .toolBtn.primary:hover { background: #f2121f; }
#jfApp .toolBtn.primary small { color: rgba(255,255,255,.82); }
#jfApp .toolBtn.primary .ico { background: rgba(255,255,255,.18); color: #fff; }
#jfApp .toolBtn.danger { background: rgba(255,61,71,.05); border-color: rgba(255,61,71,.26); }
#jfApp .toolBtn.danger:hover { background: rgba(255,61,71,.11); }
#jfApp .toolBtn.danger .ico { background: rgba(255,61,71,.14); color: #ff8a90; }
#jfApp .toolBtn:disabled { opacity: .42; cursor: not-allowed; }
#jfApp .note { margin: 10px 0 2px; padding: 8px 10px; background: rgba(86,200,255,.045); border-left: 2px solid rgba(86,200,255,.55); border-radius: 0 8px 8px 0; font-size: 11px; color: var(--text2); line-height: 1.5; }
#jfApp .note b { color: var(--ivory); font-weight: 600; }
#jfApp .colorRow { display: grid; grid-template-columns: 1fr 48px; gap: 8px; align-items: center; margin: 10px 0 6px; }
#jfApp .colorRow span { font-size: 11.5px; font-weight: 600; color: #c4cad3; }
#jfApp .sidebarPalette { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 6px 0 5px; }
#jfApp .presetSwatch { width: 100%; aspect-ratio: 1; min-width: 0; padding: 0; border-radius: 6px; border: 1px solid rgba(255,255,255,.16); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
#jfApp .sidebarPalette .presetSwatch { aspect-ratio: auto; height: 19px; border-radius: 5px; }
#jfApp .presetSwatch:hover { outline: 2px solid var(--cyan); outline-offset: 1px; }
#jfApp .sidebarFine { font-size: 10.5px; color: var(--text3); line-height: 1.4; margin-top: 4px; }
#jfApp .lineLabelPreview { border: 1px solid var(--line2); border-radius: 8px; padding: 8px 9px; font-weight: 600; font-size: 12px; min-height: 35px; color: var(--ivory); background: var(--jf-field); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#jfApp .footerCredit { margin-top: 20px; padding: 12px 4px 0; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 10.5px; color: var(--text3); line-height: 1.6; }
#jfApp .footerCredit b { color: var(--ivory); font-weight: 500; }
.jf-logo { display: flex; gap: 10px; align-items: center; }
.jf-logo-prev { width: 104px; height: 58px; flex: none; border-radius: 9px; border: 1px dashed var(--line2); background: rgba(255,255,255,.02); display: grid; place-items: center; overflow: hidden; padding: 6px; }
.jf-logo-prev span { font-size: 10.5px; color: var(--text3); text-align: center; }
.jf-logo-prev.has { background: #fff; border-style: solid; border-color: rgba(255,255,255,.2); }
.jf-logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.jf-logo-btns { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
#jfApp .jf-mini { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent; background: var(--red); color: #fff; font-family: var(--mono); font-size: 11px; cursor: pointer; transition: background .15s, border-color .15s; }
#jfApp .jf-mini:hover { background: #f2121f; }
#jfApp .jf-mini.ghost { background: transparent; border-color: var(--line2); color: var(--text); }
#jfApp .jf-mini.ghost:hover { border-color: var(--text3); }
#jfApp .jf-mini:disabled { opacity: .38; cursor: not-allowed; }

/* ───────── barra superiore e pagine ───────── */
#jfApp .workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #07080a; }
#jfApp .topbar { height: 60px; flex: 0 0 60px; background: var(--jf-panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 12px; z-index: 20; }
#jfApp .topLogo { height: 36px; max-width: 96px; width: auto; object-fit: contain; background: #fff; border-radius: 7px; padding: 3px 6px; flex: none; }
#jfApp .titleWrap { min-width: 0; flex: 1; }
#jfApp .flowNameTop { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--red2); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#jfApp .diagramTitle { font-size: 16px; font-weight: 600; color: var(--ivory); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
#jfApp .status { font-size: 11.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#jfApp .topAction { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; border: 1px solid var(--line2); background: transparent; border-radius: 8px; padding: 0 10px; cursor: pointer; color: var(--text); font-size: 12.5px; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; flex: none; }
#jfApp .topAction:hover { background: var(--bg3); border-color: rgba(255,255,255,.24); color: var(--ivory); }
#jfApp .topAction.icon { width: 34px; padding: 0; font-size: 15px; }
#jfApp .topAction:disabled { opacity: .35; cursor: not-allowed; background: transparent; }
#jfApp .topAction[aria-pressed="true"] { border-color: var(--red2); color: var(--red2); }
#jfApp .jf-export { background: var(--red); border-color: transparent; color: #fff; font-family: var(--mono); font-size: 12px; padding: 0 14px; box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, 0 8px 22px -10px rgba(227,6,19,.7); }
#jfApp .jf-export:hover { background: #f2121f; border-color: transparent; color: #fff; }
#jfApp .zoomGroup { display: flex; align-items: center; gap: 6px; color: var(--text2); font-size: 11px; white-space: nowrap; }
#jfApp .zoomGroup input { width: 104px; accent-color: var(--red); }
#jfApp .zoomPct { width: 40px; text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--text); }
#jfApp .mobileMenu { display: none; }
#jfApp .pagebar { height: 46px; flex: 0 0 46px; background: #0a0b0e; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; padding: 6px 12px; overflow-x: auto; scrollbar-width: none; z-index: 15; }
#jfApp .pagebar::-webkit-scrollbar { display: none; }
#jfApp .pagebar .topAction { height: 30px; font-size: 12px; padding: 0 9px; }
#jfApp .pageTabs { display: flex; gap: 6px; flex: 0 0 auto; }
#jfApp .pageTab { border: 1px solid var(--line2); background: transparent; color: var(--text2); border-radius: 8px; height: 30px; padding: 0 11px; cursor: pointer; font-size: 12px; font-weight: 500; white-space: nowrap; transition: color .15s, background .15s; }
#jfApp .pageTab:hover { color: var(--ivory); background: rgba(255,255,255,.03); }
#jfApp .pageTab.active { color: var(--ivory); background: var(--bg3); border-color: rgba(255,255,255,.18); box-shadow: inset 0 -2px 0 var(--red); }
#jfApp .pageBarSpacer { flex: 1; min-width: 6px; }

/* ───────── foglio ───────── */
#jfApp .canvasWrap { flex: 1; min-height: 0; overflow: auto; position: relative; background: radial-gradient(rgba(255,255,255,.075) 1px, transparent 1.3px) 0 0 / 22px 22px, #07080a; overscroll-behavior: contain; }
#jfApp #stageShell { position: relative; margin: 22px 22px 70px; transform-origin: 0 0; }
#jfApp #stage { width: 1600px; height: 900px; position: relative; transform-origin: 0 0; background: #fff; color: #17202a; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 36px 70px -24px rgba(0,0,0,.85); font-family: var(--sans); }
#jfApp .flowCopyright { position: absolute; left: 0; top: 100%; margin-top: 16px; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; color: var(--text3); letter-spacing: .02em; user-select: none; pointer-events: none; display: flex; align-items: center; gap: 9px; }
#jfApp .flowCopyright::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--red); }
#jfApp .phaseHeader { position: absolute; top: 0; height: 54px; background: #f4f5f7; border-right: 2px solid #c3c8d1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px 10px 8px; font-size: 11.5px; font-weight: 700; color: #1a1d24; line-height: 1.25; z-index: 1; cursor: default; letter-spacing: .01em; }
#jfApp .phaseHeader::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--red); }
#jfApp .stageCorner { position: absolute; left: 0; top: 0; width: 160px; height: 54px; background: #0b0d11; z-index: 1; pointer-events: none; }
#jfApp .stageCorner::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--red); }
#jfApp .phaseDivider { position: absolute; width: 0; border-left: 2px dashed #c3c8d1; margin-left: -2px; z-index: 0; pointer-events: none; }
#jfApp .phaseResizer { position: absolute; right: -4px; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 3; touch-action: none; }
#jfApp .phaseResizer::after { content: ""; position: absolute; left: 3px; top: 12px; bottom: 15px; width: 3px; border-radius: 3px; background: var(--red); opacity: 0; transition: opacity .12s; }
#jfApp .phaseHeader:hover .phaseResizer::after, #jfApp .phaseResizer:hover::after, #jfApp .resizingPhase .phaseResizer::after { opacity: .9; }
#jfApp .resizingPhase { cursor: ew-resize; }
#jfApp .laneArea { position: absolute; left: 160px; border-bottom: 1px solid #e1e4e9; z-index: 0; }
#jfApp .laneLabel { position: absolute; left: 0; width: 160px; border-bottom: 1px solid rgba(255,255,255,.3); background-image: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,.18)); display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px 12px; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; line-height: 1.28; z-index: 1; }
#jfApp #linkSvg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 2; pointer-events: none; }
#jfApp .linkHit { pointer-events: stroke; cursor: pointer; stroke: transparent; fill: none; }
#jfApp .linkVisible { pointer-events: none; fill: none; }
#jfApp #linkSvg .linkCasing, #jfApp .editPreview .linkCasing { fill: none; stroke: #fff; stroke-opacity: .9; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
#jfApp #linkSvg .linkSelected { pointer-events: none; fill: none; stroke: rgba(26,143,214,.3); stroke-linecap: round; stroke-linejoin: round; }
#jfApp .linkG:hover .linkVisible { filter: drop-shadow(0 0 2.5px rgba(26,143,214,.6)); }
#jfApp .linkLabelG { pointer-events: all; cursor: grab; user-select: none; touch-action: none; }
#jfApp .linkLabelG:active { cursor: grabbing; }
#jfApp .linkLabelBg { fill: #fff; stroke-opacity: .5; stroke-width: 1; }
#jfApp .linkLabelG:hover .linkLabelBg { stroke-opacity: 1; }
#jfApp .linkLabelText { font-family: Geist, "Segoe UI", Arial, sans-serif; font-weight: 700; fill: #0b0d11; text-anchor: middle; pointer-events: none; }
#jfApp .editPreview .linkVisible { fill: none; }

/* elementi del diagramma */
#jfApp .node { position: absolute; z-index: 3; min-width: 50px; min-height: 40px; border: 2px solid #64748b; background: #fff; color: #17202a; box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 8px 16px -8px rgba(16,24,40,.28); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 11px; cursor: move; user-select: none; touch-action: none; transition: box-shadow .15s; }
#jfApp .node:hover { box-shadow: 0 1px 2px rgba(16,24,40,.1), 0 12px 22px -8px rgba(16,24,40,.36); }
#jfApp .node.process { border-radius: 12px; } #jfApp .node.process.hasTag { padding-bottom: 25px; }
#jfApp .node.terminal { border-radius: 999px; padding: 8px 12px; min-height: 42px; }
#jfApp .node.circle { border-radius: 50%; padding: 9px; }
#jfApp .node.decision { border: none !important; background: transparent !important; box-shadow: none !important; padding: 10px 30px; overflow: visible; isolation: isolate; filter: drop-shadow(0 1px 1.5px rgba(16,24,40,.14)) drop-shadow(0 7px 8px rgba(16,24,40,.13)); }
#jfApp .node.decision::before { content: ""; position: absolute; inset: 0; background: var(--node-border, #b45309); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); z-index: -1; pointer-events: none; }
#jfApp .node.decision::after { content: ""; position: absolute; inset: var(--node-border-width, 2px); background: var(--node-fill, #fff); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); z-index: 0; pointer-events: none; }
#jfApp .node.decision .nodeText { position: relative; z-index: 1; max-width: 100%; overflow-wrap: anywhere; }
#jfApp .node.decision .nodeTag { display: none; }
#jfApp .nodeText { font-size: 13px; font-weight: 700; line-height: 1.22; white-space: pre-line; overflow-wrap: anywhere; position: relative; z-index: 1; letter-spacing: -.003em; }
#jfApp .nodeTag { position: absolute; left: 50%; transform: translateX(-50%); bottom: 5px; border-radius: 999px; color: #fff; background: #344054; font-size: 9.5px; font-weight: 600; padding: 3px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; max-width: calc(100% - 18px); }
#jfApp .node.terminal .nodeTag, #jfApp .node.circle .nodeTag { display: none; }
#jfApp .node.image { padding: 0; background: #fff; overflow: hidden; border-style: solid; }
#jfApp .node.image .imageInner { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#jfApp .node.image .imageInner img { position: absolute; max-width: none; max-height: none; user-select: none; -webkit-user-drag: none; }
#jfApp .node.image .nodeText, #jfApp .node.image .nodeTag { display: none !important; }
#jfApp .node.selected, #jfApp .node.multiSelected { outline: 2px solid rgba(86,200,255,.95); outline-offset: 4px; }
#jfApp .node.activeSelected { outline-color: var(--jf-sel); }
#jfApp .node.marqueeCandidate { outline: 2px solid rgba(26,143,214,.4); outline-offset: 3px; }
#jfApp .node.decision.selected, #jfApp .node.decision.multiSelected { outline: none; filter: drop-shadow(0 0 1.5px #56c8ff) drop-shadow(0 0 5px rgba(86,200,255,.85)); }
#jfApp .node.decision.activeSelected { outline: none; filter: drop-shadow(0 0 1.5px #1a8fd6) drop-shadow(0 0 5px rgba(26,143,214,.75)); }
#jfApp #resizeOverlay { position: absolute; z-index: 8; border: 1px solid rgba(26,143,214,.9); border-radius: 5px; pointer-events: none; display: none; }
#jfApp .resizeHandle { position: absolute; width: 11px; height: 11px; background: #fff; border: 2px solid var(--jf-sel); border-radius: 50%; pointer-events: auto; touch-action: none; box-shadow: 0 1px 3px rgba(16,24,40,.35); }
#jfApp .resizeHandle.nw { left: -6px; top: -6px; cursor: nwse-resize; } #jfApp .resizeHandle.n { left: 50%; top: -6px; transform: translateX(-50%); cursor: ns-resize; }
#jfApp .resizeHandle.ne { right: -6px; top: -6px; cursor: nesw-resize; } #jfApp .resizeHandle.e { right: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
#jfApp .resizeHandle.se { right: -6px; bottom: -6px; cursor: nwse-resize; } #jfApp .resizeHandle.s { left: 50%; bottom: -6px; transform: translateX(-50%); cursor: ns-resize; }
#jfApp .resizeHandle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; } #jfApp .resizeHandle.w { left: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
#jfApp #resizeOverlay.cropMode { border-color: #f97316; }
#jfApp #resizeOverlay.cropMode .resizeHandle { border-color: #f97316; background: #fff7ed; }
#jfApp #resizeOverlay.cropMode::after { content: attr(data-crop); position: absolute; left: 50%; top: -25px; transform: translateX(-50%); background: #f97316; color: #fff; border-radius: 5px; padding: 3px 7px; font-family: var(--mono); font-size: 9px; letter-spacing: .06em; white-space: nowrap; }
#jfApp .marqueeBox { position: absolute; z-index: 9; border: 1.5px dashed var(--jf-sel); background: rgba(26,143,214,.1); border-radius: 4px; pointer-events: none; display: none; }
#jfApp .selectionInfo { position: absolute; right: 12px; bottom: 12px; z-index: 7; background: rgba(11,13,17,.93); color: #fff; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; padding: 7px 10px; font-family: var(--mono); font-size: 10.5px; box-shadow: 0 4px 12px rgba(0,0,0,.2); pointer-events: none; display: none; max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#jfApp .emptyState { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1; color: #98a2b3; text-align: center; pointer-events: none; }
#jfApp .emptyState strong { display: block; color: #667085; font-size: 17px; margin-bottom: 4px; } #jfApp .emptyState span { font-size: 12px; }

/* ───────── finestre ───────── */
#jfApp .modalBackdrop { position: fixed; inset: 0; background: rgba(4,5,7,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 3000; padding: 18px; }
#jfApp .modalBackdrop.show { display: flex; }
#jfApp .modal { display: flex; flex-direction: column; overflow: hidden; width: min(740px, 96vw); max-height: 92vh; background: var(--bg2); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 40px 100px rgba(0,0,0,.6); }
#jfApp .modalHeader { position: relative; padding: 15px 18px 14px 24px; background: #12151b; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; }
#jfApp .modalHeader::before { content: ""; position: absolute; left: 0; top: 13px; bottom: 13px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
#jfApp .modalHeader h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ivory); letter-spacing: -.01em; }
#jfApp .modalClose { width: 34px; height: 34px; border: 1px solid var(--line2); border-radius: 9px; background: transparent; color: var(--text); font-size: 19px; line-height: 1; cursor: pointer; }
#jfApp .modalClose:hover { background: var(--bg3); }
#jfApp .modalBody { padding: 18px 20px 20px; overflow: auto; flex: 1 1 auto; min-height: 0; scrollbar-width: thin; }
#jfApp .modalBody .field { margin: 0; }
#jfApp .modalFooter { padding: 12px 20px; background: #0e1014; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; flex: none; }
#jfApp .mBtn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; padding: 9px 16px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
#jfApp .mBtn.primary { background: var(--red); color: #fff; box-shadow: 0 8px 22px -12px rgba(227,6,19,.8); } #jfApp .mBtn.primary:hover { background: #f2121f; }
#jfApp .mBtn.secondary { background: transparent; color: var(--text); border-color: var(--line2); } #jfApp .mBtn.secondary:hover { background: var(--bg3); border-color: var(--text3); }
#jfApp .mBtn.danger { background: transparent; color: #ff7b82; border-color: rgba(255,61,71,.35); } #jfApp .mBtn.danger:hover { background: rgba(255,61,71,.1); }
#jfApp .formGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
#jfApp .formGrid .span2 { grid-column: 1 / -1; }
#jfApp .formSec { grid-column: 1 / -1; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--red2); display: flex; align-items: center; gap: 8px; }
#jfApp .formSec::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--red); }
#jfApp .formGrid > .formSec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
#jfApp .mini { font-size: 12px; color: var(--text2); line-height: 1.5; }
#jfApp .editPreview { display: flex; align-items: center; justify-content: center; min-height: 116px; margin: 0 0 18px; padding: 18px; border: 1px solid var(--line2); border-radius: 14px; background: radial-gradient(#d3d8e0 1px, transparent 1.2px) 0 0 / 16px 16px, #f4f5f7; color: #17202a; }
#jfApp .editPreview svg { width: 100%; max-width: 520px; height: auto; display: block; }
#jfApp .nodePrev { position: relative !important; left: auto !important; top: auto !important; cursor: default !important; margin: 0; }
#jfApp .colorEditor { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0e1014; }
#jfApp .presetPalette { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 6px 0 11px; }
#jfApp .preciseColorRow { display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; }
#jfApp .hexInput { text-transform: uppercase; font-family: var(--mono) !important; font-size: 12px !important; letter-spacing: .04em; }
#jfApp .paletteCaption { font-size: 10.5px; color: var(--text3); margin-top: 6px; }
#jfApp .exportCard { padding: 4px 14px; background: #0e1014; border: 1px solid var(--line); border-radius: 12px; }
#jfApp .checkRow { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--text2); line-height: 1.45; }
#jfApp .checkRow:last-child { border-bottom: 0; }
#jfApp .checkRow input { margin-top: 2px; }
#jfApp .checkRow label b { color: var(--ivory); font-weight: 600; }
#jfApp .checkRow input:disabled + label { opacity: .7; }
#jfApp .jf-logo-row { align-items: center; }
#jfApp .jf-logo-row > label:first-of-type { flex: 1; min-width: 0; }
#jfApp .jf-ex-logo { height: 34px; max-width: 90px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px 6px; flex: none; }
#jfApp .jf-up { flex: none; padding: 7px 12px; font-size: 12px; cursor: pointer; }
.jf-lockrow { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid rgba(255,61,71,.3); background: rgba(227,6,19,.06); border-radius: 12px; }
.jf-lock { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--red); flex: none; }
.jf-lockrow b { display: block; color: var(--ivory); font-size: 13px; font-weight: 600; }
.jf-lockrow span:not(.jf-lock) { display: block; color: var(--text2); font-size: 12px; margin-top: 2px; }
#jfApp .helpTable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#jfApp .helpTable th, #jfApp .helpTable td { border-bottom: 1px solid var(--line); padding: 9px 8px; text-align: left; vertical-align: top; line-height: 1.5; }
#jfApp .helpTable th { background: #12151b; font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text2); }
#jfApp .helpTable td { color: var(--text2); } #jfApp .helpTable td:first-child { white-space: nowrap; } #jfApp .helpTable b { color: var(--ivory); font-weight: 600; }
#jfApp .kbd { display: inline-block; border: 1px solid var(--line2); background: var(--bg3); border-radius: 5px; padding: 1px 6px; font-family: var(--mono); font-size: 10.5px; color: var(--text); }
#jfApp .phRow { display: grid; grid-template-columns: 30px 1fr 122px auto; gap: 10px; align-items: center; margin: 8px 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: #0e1014; }
#jfApp .phIdx { width: 28px; height: 28px; border-radius: 8px; background: rgba(255,61,71,.1); color: #ff7b82; font-family: var(--mono); font-size: 12px; display: flex; align-items: center; justify-content: center; }
#jfApp .phW { position: relative; }
#jfApp .modalBody .phW input { text-align: right; padding-right: 32px; }
#jfApp .phW em { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 11px; color: var(--text3); pointer-events: none; }
#jfApp .modalBody > div[style*="border:1px solid #e2e8f0"] { border-color: var(--line) !important; background: #0e1014; }
#jfApp .labelMoveHint { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: -4px; }
#jfApp .labelMoveHint .mini { flex: 1 1 220px; }
#jfApp .imageEditorPreview { height: 230px; border: 1px solid var(--line2); border-radius: 12px; background: #f4f5f7; position: relative; overflow: hidden; }
#jfApp .imageEditorPreview img { position: absolute; max-width: none; max-height: none; user-select: none; }
#jfApp .rangeLine { display: grid; grid-template-columns: 1fr 56px; gap: 8px; align-items: center; }
#jfApp .rangeLine input { accent-color: var(--red); }
#jfApp .rangeLine output { font-family: var(--mono); font-size: 11px; color: var(--text2); text-align: right; }
#jfApp #tagPreviewState { border-color: var(--line2) !important; background: var(--jf-field) !important; }

/* ───────── avviso dopo l'esportazione ───────── */
.jf-toast { position: absolute; right: 16px; bottom: 16px; z-index: 45; width: min(440px, calc(100% - 32px)); padding: 14px 16px 14px; background: rgba(14,16,20,.97); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.8); transform: translateY(14px); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease); }
.jf-toast.show { opacity: 1; transform: none; pointer-events: auto; }
.jf-toast-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--text2); font-size: 18px; cursor: pointer; }
.jf-toast-x:hover { background: var(--bg3); color: var(--ivory); }
.jf-toast-m { display: flex; gap: 10px; align-items: flex-start; padding-right: 26px; color: var(--ivory); font-size: 13.5px; line-height: 1.45; }
.jf-ok { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(61,220,151,.15); color: var(--green); flex: none; }
.jf-toast-f { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.jf-toast-f > span { color: var(--text2); font-size: 12.5px; } .jf-toast-f b { color: var(--ivory); font-weight: 600; }
.jf-toast .soc { padding: 7px 12px 7px 9px; font-size: .82rem; }
.jf-toast .soc .soc-ic { width: 17px; height: 17px; }

/* ───────── schermi più piccoli ───────── */
@media (max-width: 1180px) { #jfApp .zoomGroup input { width: 70px; } #jfApp .jf-fit { display: none; } }
@media (max-width: 1000px) {
  #jfApp { grid-template-columns: minmax(0, 1fr); height: clamp(520px, calc(100dvh - 84px), 1000px); }
  #jfApp .sidebar { position: absolute; left: 0; top: 0; bottom: 0; width: min(318px, 88%); transform: translateX(-102%); transition: transform .22s var(--ease); box-shadow: 30px 0 60px -30px rgba(0,0,0,.9); }
  #jfApp .sidebar.mobileOpen { transform: none; }
  #jfApp .jf-scrim { display: block; position: absolute; inset: 0; z-index: 25; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  #jfApp.side-open .jf-scrim { opacity: 1; pointer-events: auto; }
  #jfApp .mobileMenu { display: inline-flex; }
}
@media (max-width: 640px) {
  .jf-shell { width: calc(100% - 16px); }
  .jf-hero { padding-top: 104px; }
  #jfApp { height: calc(100dvh - 76px); min-height: 500px; border-radius: 12px; }
  #jfApp .topbar { gap: 6px; padding: 0 8px; }
  #jfApp .zoomGroup input, #jfApp .topLogo, #jfApp #undoTop, #jfApp #redoTop { display: none; }
  #jfApp .jf-export span { display: none; } #jfApp .jf-export { width: 34px; padding: 0; }
  #jfApp .formGrid { grid-template-columns: 1fr; }
  #jfApp .phRow { grid-template-columns: 28px 1fr; } #jfApp .phRow .phW, #jfApp .phRow .mBtn { grid-column: 2; }
  #jfApp .modalBackdrop { padding: 8px; } #jfApp .modal { max-height: 96vh; }
  .jf-toast { right: 8px; bottom: 8px; width: calc(100% - 16px); }
}
@media (prefers-reduced-motion: reduce) { #jfApp *, .jf-toast { transition: none !important; } }
