/* Rafa IA — editor de imagem (canvas) */
.edm{position:fixed; inset:0; z-index:320; display:none; align-items:center; justify-content:center;
  background:rgba(3,7,16,.78); backdrop-filter:blur(8px)}
.edm.on{display:flex}
.edm-shell{width:min(1340px,calc(100vw - 24px)); height:min(880px,calc(100vh - 24px)); display:flex; flex-direction:column;
  background:#0b1225; border:1px solid rgba(150,180,240,.20); border-radius:16px; overflow:hidden;
  box-shadow:0 40px 90px rgba(0,0,0,.6); color:#e8eefc}
.edm-top{display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid rgba(150,180,240,.14);
  background:linear-gradient(180deg,#0e1730,#0b1225)}
.edm-top b{font-size:13.5px; font-weight:600; letter-spacing:.2px}
.edm-file{font-size:11.5px; color:#8b98b8; max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.edm-sp{flex:1}
.edm-btn{height:30px; padding:0 12px; border-radius:8px; font-size:12px; font-weight:500; color:#cfe0ff;
  background:rgba(255,255,255,.06); border:1px solid rgba(150,180,240,.22)}
.edm-btn:hover{background:rgba(255,255,255,.10); color:#fff}
.edm-btn.primary{background:#055ffe; border-color:#055ffe; color:#fff}
.edm-btn.primary:hover{background:#1a6dff}
.edm-btn:disabled{opacity:.45; cursor:default}
.edm-ico{width:30px; height:30px; display:grid; place-items:center; border-radius:8px; color:#c3d1ee;
  background:rgba(255,255,255,.05); border:1px solid rgba(150,180,240,.18); font-size:14px}
.edm-ico:hover{background:rgba(255,255,255,.10); color:#fff}
.edm-body{flex:1; display:flex; min-height:0}
.edm-tools{width:78px; flex:0 0 78px; border-right:1px solid rgba(150,180,240,.12); padding:10px 8px;
  display:flex; flex-direction:column; gap:6px; background:#0a1020}
.edm-tools button{display:flex; flex-direction:column; align-items:center; gap:3px; padding:8px 2px 6px;
  border-radius:9px; color:#93a3c4; font-size:10.5px; border:1px solid transparent}
.edm-tools button svg{width:19px; height:19px; stroke:currentColor; fill:none; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round}
.edm-tools button:hover{background:rgba(255,255,255,.06); color:#dce8ff}
.edm-tools button.on{background:rgba(5,95,254,.20); border-color:rgba(5,95,254,.55); color:#dce9ff}
.edm-stage{flex:1; min-width:0; display:grid; place-items:center; background:
  linear-gradient(45deg,rgba(255,255,255,.02) 25%,transparent 25%,transparent 75%,rgba(255,255,255,.02) 75%) 0 0/22px 22px,
  linear-gradient(45deg,rgba(255,255,255,.02) 25%,transparent 25%,transparent 75%,rgba(255,255,255,.02) 75%) 11px 11px/22px 22px,
  #070c18; overflow:hidden; position:relative; touch-action:none}
.edm-stage canvas{display:block; box-shadow:0 0 0 1px rgba(255,255,255,.10), 0 18px 40px rgba(0,0,0,.45); cursor:crosshair}
.edm-props{width:286px; flex:0 0 286px; border-left:1px solid rgba(150,180,240,.12); background:#0a1020;
  padding:12px; overflow:auto}
.edm-props h4{margin:0 0 10px; font-size:11px; letter-spacing:.10em; text-transform:uppercase; color:#7e8db0}
.edm-row{display:flex; align-items:center; gap:8px; margin-bottom:10px}
.edm-row label{flex:0 0 78px; font-size:11.5px; color:#93a3c4}
.edm-row input[type=range]{flex:1; accent-color:#055ffe; height:3px}
.edm-row .val{width:38px; text-align:right; font-size:11px; color:#b9c8e8; font-variant-numeric:tabular-nums}
.edm-in, .edm-props select, .edm-props textarea{width:100%; background:rgba(255,255,255,.05); color:#eaf1ff;
  border:1px solid rgba(150,180,240,.20); border-radius:8px; padding:7px 9px; font-size:12px; font-family:inherit}
.edm-props textarea{min-height:66px; resize:vertical; line-height:1.35}
.edm-in:focus, .edm-props select:focus, .edm-props textarea:focus{outline:none; border-color:rgba(5,95,254,.65); background:rgba(5,95,254,.08)}
.edm-props select{height:32px}
.edm-sw{display:flex; align-items:center; gap:8px; font-size:11.5px; color:#a9b8d8; margin-bottom:10px}
.edm-sw input{accent-color:#055ffe}
.edm-color{width:38px; height:28px; padding:2px; border-radius:7px; background:rgba(255,255,255,.06); border:1px solid rgba(150,180,240,.22)}
.edm-align{display:flex; gap:4px}
.edm-align button{flex:1; height:28px; border-radius:7px; background:rgba(255,255,255,.05); border:1px solid rgba(150,180,240,.18); color:#a9b8d8}
.edm-align button.on{background:rgba(5,95,254,.22); border-color:rgba(5,95,254,.55); color:#e6efff}
.edm-actions{display:flex; gap:6px; margin-top:12px}
.edm-actions button{flex:1; height:30px; border-radius:8px; font-size:11.5px; background:rgba(255,255,255,.06);
  border:1px solid rgba(150,180,240,.20); color:#cfe0ff}
.edm-actions button:hover{background:rgba(255,255,255,.11)}
.edm-actions button.danger{color:#ffb3bd; border-color:rgba(255,107,125,.35)}
.edm-tip{font-size:11px; line-height:1.45; color:#8291b4; margin:2px 0 12px}
.edm-empty{font-size:11.5px; line-height:1.5; color:#8b98b8}
.edm-toast{position:absolute; left:50%; bottom:64px; transform:translateX(-50%); background:#0e1a36;
  border:1px solid rgba(150,180,240,.28); color:#dbe7ff; font-size:12px; padding:8px 14px; border-radius:10px;
  opacity:0; pointer-events:none; transition:.2s}
.edm-toast.on{opacity:1}
@media (max-width:900px){
  .edm-cmd{padding:8px 10px}
  .edm-cmd input{font-size:12px}
  .edm-shell{width:100vw; height:100vh; border-radius:0; border:0}
  .edm-file{display:none}
  .edm-tools{width:60px; flex-basis:60px; padding:8px 5px}
  .edm-tools button{font-size:9px; padding:6px 0 4px}
  .edm-props{position:absolute; left:0; right:0; bottom:0; width:auto; flex-basis:auto; max-height:46%;
    border-left:0; border-top:1px solid rgba(150,180,240,.18); border-radius:14px 14px 0 0; background:#0a1020f2}
  .edm-body{position:relative}
}
/* botão editar em imagens do chat e da biblioteca */
.edm-open{display:inline-flex; align-items:center; gap:4px; font-size:11px; color:#9fc0ff; cursor:pointer}
.edm-open:hover{color:#cfe0ff; text-decoration:underline}
.att-img{position:relative; display:inline-block; line-height:0}
.att-img .edm-open{position:absolute; right:6px; bottom:6px; background:rgba(6,12,26,.82); border:1px solid rgba(150,180,240,.35);
  border-radius:7px; padding:3px 7px; line-height:1.2; backdrop-filter:blur(4px)}
.lib-light .ll-acts{position:absolute; left:50%; bottom:22px; transform:translateX(-50%); display:flex; gap:8px}
.lib-light .ll-acts a, .lib-light .ll-acts button{height:32px; padding:0 14px; border-radius:9px; font-size:12px;
  background:rgba(10,18,38,.9); border:1px solid rgba(150,180,240,.30); color:#dbe7ff; display:inline-flex; align-items:center}

.edm-chips{display:flex; flex-wrap:wrap; gap:4px; flex:1}
.edm-chips button{background:rgba(255,255,255,.05); border:1px solid rgba(150,180,240,.20); color:#cfdcf6;
  font-size:11.5px; padding:5px 9px; border-radius:7px; cursor:pointer; line-height:1}
.edm-chips button:hover{background:rgba(255,255,255,.10); color:#fff}
.edm-chips button.on{background:rgba(5,95,254,.28); border-color:rgba(5,95,254,.75); color:#fff}

/* barra de comando do editor */
.edm-cmd{display:flex; align-items:center; gap:8px; padding:10px 14px; border-top:1px solid rgba(150,180,240,.14);
  background:linear-gradient(180deg,#0b1225,#0a1020)}
.edm-cmd-ic{font-size:13px; color:#7e8db0}
.edm-cmd input{flex:1; height:34px; background:rgba(255,255,255,.05); border:1px solid rgba(150,180,240,.22);
  border-radius:9px; padding:0 12px; color:#eaf1ff; font-size:12.5px; font-family:inherit; min-width:0}
.edm-cmd input::placeholder{color:#6d7b9c}
.edm-cmd input:focus{outline:none; border-color:rgba(5,95,254,.70); background:rgba(5,95,254,.10)}
.edm-cmd .edm-btn{height:34px; flex:0 0 auto}
.edm-layers{display:flex; flex-direction:column; gap:5px; margin-top:8px}
.edm-layer{text-align:left; padding:6px 9px; border-radius:7px; font-size:11.5px; color:#cfdcf6;
  background:rgba(255,255,255,.05); border:1px solid rgba(150,180,240,.18);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.edm-layer:hover{background:rgba(5,95,254,.18); border-color:rgba(5,95,254,.50); color:#fff}
