/* ===== Alexey edit overlay v2 ===== */
#ed-pill{position:fixed;top:14px;right:16px;z-index:60;font-family:inherit;font-size:.92rem;font-weight:800;
  color:#fff;background:#171512;border:none;border-radius:999px;padding:9px 18px;cursor:pointer;
  box-shadow:0 3px 12px rgba(0,0,0,.25)}
#ed-pill.on{background:#6f4527}
#ed-bar{position:fixed;bottom:0;left:0;right:0;z-index:60;display:none;gap:6px;
  padding:10px 10px calc(10px + env(safe-area-inset-bottom));background:rgba(23,21,18,.94);
  backdrop-filter:blur(8px);overflow-x:auto;-webkit-overflow-scrolling:touch}
#ed-bar.on{display:flex}
#ed-bar button{flex:0 0 auto;font-family:inherit;font-size:.85rem;font-weight:700;border-radius:999px;
  padding:9px 13px;cursor:pointer;border:1px solid rgba(247,243,236,.25)}
#ed-gallery-btn,#ed-note-btn{background:#f7f3ec;color:#171512;border:none}
#ed-addtext-btn,#ed-addimg-btn,#ed-addsec-btn{background:#f7f3ec;color:#171512;border:none}
#ed-mine-btn{background:transparent;color:#f7f3ec}
#ed-exit-btn{background:transparent;color:#b9b2a6}
body.editing .ed-target{outline:2px dashed rgba(111,69,39,.55);outline-offset:3px;border-radius:4px;cursor:text}
body.editing .ed-img{outline:3px dashed rgba(46,80,125,.65);outline-offset:2px;border-radius:6px;cursor:pointer}
body.editing .ed-target.edited,body.editing .ed-img.edited{outline-color:#2e7d32;background:rgba(46,125,50,.08)}
body.picking-pos{cursor:copy}
body.picking-pos main *{cursor:copy!important}
.ed-added{outline:2px solid #2e7d32!important;outline-offset:3px;border-radius:6px;padding:6px}
section.ed-added-sec{outline:2px solid #2e7d32;outline-offset:6px;border-radius:10px}

#ed-sheet,#ed-imgmenu,#ed-list{position:fixed;inset:0;z-index:70;display:none;align-items:flex-end;background:rgba(23,21,18,.5)}
#ed-sheet.open,#ed-imgmenu.open,#ed-list.open{display:flex}
#ed-sheet .card,#ed-imgmenu .card,#ed-list .card{background:#f7f3ec;width:100%;max-height:82vh;overflow-y:auto;
  border-radius:18px 18px 0 0;padding:20px 20px calc(20px + env(safe-area-inset-bottom));
  direction:rtl;font-family:'Heebo',system-ui,sans-serif}
#ed-sheet h3,#ed-imgmenu h3,#ed-list h3{font-size:1.05rem;font-weight:900;margin-bottom:4px}
#ed-sheet .where{font-size:.8rem;color:#5c564d;margin-bottom:12px}
#ed-sec-title{width:100%;font-family:inherit;font-size:1.05rem;font-weight:800;border:1.5px solid #e3dccf;
  border-radius:12px;padding:12px;background:#fff;color:#171512;margin-bottom:10px}
#ed-sheet textarea{width:100%;min-height:110px;font-family:inherit;font-size:1.05rem;line-height:1.6;
  border:1.5px solid #e3dccf;border-radius:12px;padding:12px;background:#fff;color:#171512;resize:vertical;direction:rtl}
#ed-sheet .orig{font-size:.82rem;color:#5c564d;background:#efe9dd;border-radius:10px;padding:10px 12px;margin-top:10px;white-space:pre-wrap}
#ed-sheet .orig b{display:block;font-size:.75rem;margin-bottom:2px}
#ed-sizes{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}
#ed-sizes button{flex:1;font-family:inherit;font-size:.95rem;font-weight:700;border:1.5px solid #e3dccf;
  background:#fff;border-radius:12px;padding:12px 6px;cursor:pointer;color:#171512}
#ed-sizes button.picked{background:#6f4527;color:#fff;border-color:#6f4527}
#ed-sheet .name-row{margin-top:12px}
#ed-sheet .name-row input{width:100%;font-family:inherit;font-size:1rem;border:1.5px solid #e3dccf;border-radius:12px;
  padding:10px 12px;background:#fff;color:#171512}
#ed-sheet .actions{display:flex;gap:10px;margin-top:16px}
#ed-sheet .actions button{flex:1;font-family:inherit;font-size:1rem;font-weight:800;border-radius:999px;padding:13px;cursor:pointer;border:none}
#ed-save{background:#6f4527;color:#fff}
#ed-cancel{background:#e3dccf;color:#171512}
#ed-remove-text{display:block;margin:12px auto 0;background:none;border:none;font-family:inherit;
  font-size:.85rem;color:#b00020;text-decoration:underline;cursor:pointer}
.img-actions{display:flex;flex-direction:column;gap:10px;margin-top:12px}
.img-actions button{font-family:inherit;font-size:1rem;font-weight:800;border-radius:14px;padding:14px;
  cursor:pointer;border:1.5px solid #e3dccf;background:#fff;color:#171512;text-align:right}
.img-actions button.danger{color:#b00020}
.img-actions button.plain{background:#e3dccf;text-align:center}

#ed-gallery{position:fixed;inset:0;z-index:75;display:none;background:#f7f3ec}
#ed-gallery.open{display:block}
#ed-gallery .g-card{height:100%;display:flex;flex-direction:column;direction:rtl;font-family:'Heebo',system-ui,sans-serif}
.g-head{display:flex;justify-content:space-between;align-items:center;padding:16px 18px 8px}
.g-head h3{font-size:1.15rem;font-weight:900}
#g-close,#ed-g-close{font-size:1.1rem;background:#e3dccf;border:none;border-radius:50%;width:36px;height:36px;cursor:pointer;color:#171512}
#ed-g-upload{margin:8px 18px 12px;font-family:inherit;font-size:1rem;font-weight:800;border-radius:14px;
  padding:14px;cursor:pointer;border:none;background:#6f4527;color:#fff}
.g-grid{flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(3,1fr);gap:4px;padding:0 12px 24px;align-content:start}
.g-grid img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:8px;cursor:pointer;background:#e3dccf}
.g-loading{grid-column:1/-1;text-align:center;color:#5c564d;padding:40px 0;font-size:.9rem}

#ed-toast{position:fixed;top:60px;right:50%;transform:translateX(50%);z-index:80;background:#171512;color:#f7f3ec;
  font-size:.9rem;font-weight:700;padding:10px 20px;border-radius:999px;display:none;box-shadow:0 4px 14px rgba(0,0,0,.3);
  max-width:86vw;text-align:center}
#ed-toast.show{display:block}
#ed-list .empty{color:#5c564d;font-size:.9rem;text-align:center;padding:24px 0}
#ed-list .p-item{border:1px solid #e3dccf;border-radius:12px;padding:12px;margin-bottom:10px;background:#fff}
#ed-list .p-where{font-size:.72rem;color:#5c564d;margin-bottom:4px}
#ed-list .p-new{font-size:.95rem;white-space:pre-wrap}
#ed-list .p-status{display:inline-block;font-size:.72rem;font-weight:700;border-radius:999px;padding:2px 10px;margin-top:6px}
#ed-list .p-status.sent{background:#e6f2e6;color:#2e7d32}
#ed-list .p-status.queue{background:#fdf3e0;color:#8a5a33}
#ed-list .p-del{float:left;font-size:.75rem;color:#b9b2a6;background:none;border:none;cursor:pointer;font-family:inherit;text-decoration:underline}
#ed-list .actions{display:flex;margin-top:6px}
#ed-list .actions button{flex:1;font-family:inherit;font-size:1rem;font-weight:800;border-radius:999px;padding:13px;cursor:pointer;border:none;background:#e3dccf;color:#171512}
.g-sec{grid-column:1/-1;font-size:.8rem;font-weight:800;color:#5c564d;padding:14px 4px 6px}
