/* Image Editor Overlay v6.14.6 */
/* =========================================== */

/* Spin keyframe for loading indicators */
@keyframes ie-spin {
  to { transform: rotate(360deg); }
}

/* ---------- White-screen fail-safe ---------- */
/* Ensure main content is always visible even if JS crashes or stalls */
.project-generate {
  visibility: visible !important;
  opacity: 1 !important;
}
/* Emergency unlock — if ie-popup-open gets stuck > 30s, CSS animation
   restores pointer-events. (JS safety interval should handle this
   within 2s, but this is the nuclear fallback.) */
@keyframes ie-unlock-ui {
  from { pointer-events: none; }
  to   { pointer-events: auto; }
}
body.ie-popup-open .project-generate-header,
body.ie-popup-open .project-generate-left__menu,
body.ie-popup-open .project-generate-right,
body.ie-popup-open .project-generate-left-menu__bottom {
  animation: ie-unlock-ui 0s 30s forwards;
}

/* ---------- Prevent page-level scrollbars ---------- */

.project-generate {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  /* Prevent browser-level pinch/double-tap zoom on the constructor page */
  touch-action: pan-x pan-y !important;
  -ms-touch-action: pan-x pan-y !important;
}

/* ---------- HEADER LOGO ---------- */
.project-generate-header__logo {
  background-image: url(/static/media/_logo_ils_br.svg) !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center left !important;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  position: relative;
  flex-shrink: 0 !important;
  width: 119px !important;
  height: 20px !important;
}

/* Remove separator from logo — moved to link ::before */
.project-generate-header__logo::after {
  display: none !important;
}

/* ---------- HEADER & MENU above canvas ---------- */
.project-generate-header {
  position: relative;
  z-index: 1001;
  pointer-events: auto !important;
  margin-bottom: 0 !important;
  background: radial-gradient(64.44% 209.98% at 43.25% 49.99%, rgba(255, 178, 0, 0.4) 0%, rgba(255, 242, 211, 0.4) 69.71%, rgba(255, 255, 255, 0.4) 93.75%);
  box-shadow: 0px 20px 30px rgba(0, 0, 0, 0.1) !important;
  padding: 8px 30px !important;
  gap: 0 !important;
  height: 70px !important;
  min-height: 70px !important;
  max-height: 70px !important;
  border-radius: 70px !important;
  box-sizing: border-box !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
}

/* Back link — centered in header with separator before it */
.project-generate-header__link {
  opacity: 1 !important;
  color: #694F12 !important;
  font-family: 'Rubik', sans-serif !important;
  font-weight: 400 !important;
  font-size: 16px !important;
  line-height: 20px !important;
  margin-left: 0 !important;
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 14px !important;
  white-space: nowrap !important;
  transition: opacity 0.2s ease !important;
}
.project-generate-header__link:hover {
  opacity: 0.6 !important;
}
/* Separator bar before the link text */
.project-generate-header__link::before {
  content: '' !important;
  display: block !important;
  width: 1px !important;
  height: 30px !important;
  background: #694F12 !important;
  border-radius: 47px !important;
  flex-shrink: 0 !important;
}
/* Hide the arrow SVG */
.project-generate-header__link svg {
  display: none !important;
}

/* Buttons container — Figma: gap 10px */
.project-generate-header__buttons {
  gap: 10px !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
}
.project-generate-left__menu {
  position: relative;
  z-index: 1003;
  background: transparent !important;
}
/* Desktop only: right panel position */
@media (min-width: 601px) {
  .project-generate-right {
    position: relative;
    z-index: 1001;
    background: transparent;
    isolation: isolate;
  }
  .project-generate-right__bottom {
    background-color: #fff;
    box-shadow: 0px 2px 8px 0px rgba(0,0,0,0.08);
    border-radius: 20px;
  }
}
@media (max-width: 600px) {
  .project-generate-right__bottom {
    border-radius: 16px !important;
  }
}

/* ---------- Right panel top bar (test / Save / Edit) ---------- */
.project-generate-right__top {
  position: relative;
  z-index: 1002 !important;
  pointer-events: auto !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  height: auto !important;
  padding: 8px 0 !important;
}

/* ==========================================================
   BACKDROP OVERLAY for popups/menus
   Dark semi-transparent overlay behind popups (AI gen, Edit, New Project)
   Similar to how "Изображения" popup works
   ========================================================== */
.ie-backdrop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 299999;
  animation: ieBackdropFadeIn .2s ease;
}
@keyframes ieBackdropFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* When a popup/menu is open, lower the header and right panel so they don't overlap */
body.ie-popup-open .project-generate-header,
body.popup-open .project-generate-header {
  z-index: 1 !important;
  pointer-events: none !important;
}

body.ie-popup-open .project-generate-left__menu,
body.popup-open .project-generate-left__menu {
  z-index: 1 !important;
  pointer-events: none !important;
}
body.ie-popup-open .project-generate-right,
body.popup-open .project-generate-right {
  z-index: 1 !important;
  pointer-events: none !important;
}
body.ie-popup-open .project-generate-right *,
body.ie-popup-open .project-generate-right__bottom,
body.ie-popup-open .project-generate-right__bottom button,
body.ie-popup-open .project-generate-right__bottom a,
body.ie-popup-open .project-generate-right__bottom [role="button"],
body.ie-popup-open .project-generate-right-button,
body.ie-popup-open .project-generate-right-button a,
body.ie-popup-open .project-generate-right-button button,
body.ie-popup-open .project-generate-right-button span,
body.popup-open .project-generate-right *,
body.popup-open .project-generate-right__bottom,
body.popup-open .project-generate-right__bottom button,
body.popup-open .project-generate-right__bottom a,
body.popup-open .project-generate-right__bottom [role="button"],
body.popup-open .project-generate-right-button,
body.popup-open .project-generate-right-button a,
body.popup-open .project-generate-right-button button,
body.popup-open .project-generate-right-button span {
  pointer-events: none !important;
}
body.ie-popup-open .project-generate-left-menu__bottom,
body.popup-open .project-generate-left-menu__bottom {
  z-index: 1 !important;
  pointer-events: none !important;
}
body.ie-popup-open .ie-layers-panel,
body.popup-open .ie-layers-panel {
  z-index: 1 !important;
  pointer-events: none !important;
}
body.ie-popup-open .ie-layers-backdrop,
body.popup-open .ie-layers-backdrop {
  z-index: 0 !important;
  pointer-events: none !important;
}

/* ---------- Header dropdown (project name) ---------- */
.project-generate-header__name {
  position: relative;
  z-index: 1002;
}
.project-generate-header__dropdown,
.project-generate-header__name-dropdown {
  z-index: 300003 !important;
  position: absolute !important;
}

/* ---------- Project dropdown (test ∨) — fix visibility ---------- */
.project-generate-menu-projects {
  z-index: 300020 !important;
  position: fixed !important;
  overflow: visible !important;
  /* ---- Redesign: reference-matching styles ---- */
  background: #fff !important;
  border-radius: 20px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  border: none !important;
  width: 420px !important;
  max-height: 520px !important;
  padding: 24px 20px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Title centered */
.project-generate-menu-projects__title {
  font-family: Rubik, sans-serif !important;
  font-weight: 600 !important;
  font-size: 18px !important;
  line-height: 24px !important;
  color: #1a1a1a !important;
  text-align: center !important;
  padding: 0 0 20px 0 !important;
  margin: 0 !important;
  border-bottom: none !important;
}

/* Layout container */
.project-generate-menu-projects__layout {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0 !important;
}

/* Project card element */
.project-generate-menu-projects__element {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 14px !important;
  border-radius: 16px !important;
  border: 1.5px solid #e8e3da !important;
  background: #fff !important;
  cursor: pointer !important;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: auto !important;
  min-height: 90px !important;
  position: relative !important;
}

/* Hover state — orange dashed border only on hover */
.project-generate-menu-projects__element:hover {
  border: 2px dashed #FCB620 !important;
  background: #FFFDF7 !important;
  box-shadow: 0 2px 8px rgba(252, 182, 32, 0.12) !important;
}

/* Focus-visible state for keyboard accessibility */
.project-generate-menu-projects__element:focus-visible {
  outline: 2px solid #FCB620 !important;
  outline-offset: 2px !important;
  border-color: #FCB620 !important;
  background: #FFFDF7 !important;
}

/* Touch active state for mobile */
.project-generate-menu-projects__element:active {
  background: #FFF8E8 !important;
  transform: scale(0.98) !important;
  transition: transform 0.1s ease !important;
}

/* Image container — larger thumbnail matching reference */
.project-generate-menu-projects-element__conteiner {
  width: 100px !important;
  height: 68px !important;
  min-width: 100px !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  border: none !important;
  padding: 0 !important;
  background: #f0f0f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

/* Image */
.project-generate-menu-projects-element__image {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 12px !important;
  background: #f0f0f0 !important;
  border: none !important;
}

/* Right column — title + row */
.project-generate-menu-projects-element__column {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  padding-left: 0 !important;
  width: auto !important;
  justify-content: center !important;
}

/* Title */
.project-generate-menu-projects-element__title {
  font-family: Rubik, sans-serif !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  line-height: 20px !important;
  color: #1a1a1a !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
}

/* Row — date + badge */
.project-generate-menu-projects-element__row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
}

/* Date */
.project-generate-menu-projects-element__date {
  font-family: Rubik, sans-serif !important;
  font-weight: 400 !important;
  font-size: 13px !important;
  line-height: 18px !important;
  color: #a0a0a0 !important;
  white-space: nowrap !important;
}

/* Hide the separator "|" between date and badge */
.project-generate-menu-projects-element__date:nth-child(2) {
  display: none !important;
}

/* Visibility badge — filled orange pill like reference */
.project-generate-menu-projects-element__visibility {
  font-family: Rubik, sans-serif !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  line-height: 16px !important;
  color: #fff !important;
  padding: 5px 16px !important;
  border-radius: 20px !important;
  background: #FCB620 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  text-transform: lowercase !important;
}

/* Public badge — same orange, slightly different shade for distinction */
.project-generate-menu-projects-element__visibility-public {
  background: #F5A623 !important;
  color: #fff !important;
}

/* Custom scrollbar for the dropdown */
.project-generate-menu-projects::-webkit-scrollbar {
  width: 4px !important;
}
.project-generate-menu-projects::-webkit-scrollbar-track {
  background: transparent !important;
}
.project-generate-menu-projects::-webkit-scrollbar-thumb {
  background: #ddd !important;
  border-radius: 4px !important;
}
.project-generate-menu-projects::-webkit-scrollbar-thumb:hover {
  background: #bbb !important;
}
.project-generate-menu-projects__layout::-webkit-scrollbar {
  width: 4px !important;
}
.project-generate-menu-projects__layout::-webkit-scrollbar-track {
  background: transparent !important;
}
.project-generate-menu-projects__layout::-webkit-scrollbar-thumb {
  background: #ddd !important;
  border-radius: 4px !important;
}
.project-generate-left__menu,
.project-generate-left-menu__top,
.project-generate-left-menu__top > * {
  overflow: visible !important;
}


/* ---------- Align menu bar under header ---------- */
.project-generate-left-menu__top {
  position: relative !important;
}



/* ---------- Canvas extends full viewport ---------- */
.project-generate-left__contant {
  top: 0 !important;
  height: 100vh !important;
  overflow: visible !important;
  z-index: 0 !important;
}
.project-container-scroll {
  position: relative !important;
  padding-top: 80px;
  box-sizing: border-box;
  background-color: #e8e8e8 !important;
  /* Grid dots: initial CSS fallback; JS overrides via inline styles for zoom sync.
     No !important so that JS syncGridBackground() can control these dynamically. */
  background-image: radial-gradient(circle, #c8c8c8 1.2px, transparent 1.2px);
  background-size: 30px 30px;
  /* Prevent smooth scroll which would cause "floating" during zoom */
  scroll-behavior: auto !important;
  overflow: auto !important;
}

/* ---------- Allow canvas items to go under header area ---------- */
.project-generate-left {
  overflow: visible !important;
}
.project-content-container {
  overflow: visible !important;
  /* Allow JS to set min-width/min-height for infinite canvas scrolling */
  box-sizing: border-box !important;
}
.project-content {
  overflow: visible !important;
  /* Disable CSS transitions on transform to prevent "floating" during zoom */
  transition: none !important;
}

/* ---------- Project items: img fills container for resizing ---------- */
.project-item img {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ---------- Goods popup above everything ---------- */
.goods-popup {
  z-index: 300010 !important;
  position: fixed !important;
  background: rgba(52, 52, 52, 0.45) !important;
}
.goods-popup-backdrop {
  position: fixed !important;
}
/* Hide product detail popup that appears inside the goods popup on mobile */
@media (max-width: 768px) {
  .goods-popup .popup:has(.product-popup-layout) {
    display: none !important;
  }
  .goods-popup .popup .projects-block,
  .goods-popup .popup .projects-block-layout,
  .goods-popup .popup .product-popup-layout {
    display: none !important;
  }
}
/* Goods popup must always be interactive, even when ie-popup-open suppresses other elements.
   Specificity must beat "body.ie-popup-open .project-generate-right *" (0,2,0).
   Using "body .goods-popup" = (0,2,0) to match, or body prefix to win. */
body .goods-popup,
body .goods-popup *,
body .goods-popup .goods-layout,
body .goods-popup .goods-header,
body .goods-popup .goods-content,
body .goods-popup .goods-buttons,
body .goods-popup .goods-search,
body .goods-popup button,
body .goods-popup a,
body .goods-popup input,
body.ie-popup-open .goods-popup,
body.ie-popup-open .goods-popup *,
body.ie-popup-open .goods-popup .goods-layout,
body.ie-popup-open .goods-popup .goods-content,
body.ie-popup-open .goods-popup button,
body.ie-popup-open .goods-popup a,
body.ie-popup-open .goods-popup input,
body.popup-open .goods-popup,
body.popup-open .goods-popup * {
  pointer-events: auto !important;
}
/* Goods popup z-index must override the lowered right panel */
body.ie-popup-open .goods-popup,
body.popup-open .goods-popup {
  z-index: 300010 !important;
  position: fixed !important;
}
body.ie-fullscreen .goods-popup,
:fullscreen .goods-popup {
  z-index: 300010 !important;
}

/* ---------- Product popup — prevent scrollbars ---------- */
.popup:has(.product-popup-layout) {
  overflow: hidden !important;
}
.popup:has(.product-popup-layout) .projects-block-layout {
  width: 100% !important;
  max-width: 1280px !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
.popup:has(.product-popup-layout) .product-popup-layout {
  max-height: calc(100vh - 120px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
/* Hide the React images export popup visually (we replace it with our modal).
   Use visibility:hidden instead of display:none so React still renders
   image elements and populates their src attributes. */
.popup:has(.images-popup-layout) {
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
  visibility: hidden !important;
  position: fixed !important;
  left: -9999px !important;
}
/* Images popup above handles/toolbars */
.images-popup,
.images-popup-element {
  z-index: 300008 !important;
}
.popup-backdrop {
  z-index: 300000 !important;
}
.goods-popup-backdrop {
  z-index: 300005 !important;
}

/* ---------- Layers panel z-index toggling (JS adds ie-layers-on-top) ---------- */
body.ie-layers-on-top .ie-layers-panel {
  z-index: 1002 !important;
}
body.ie-layers-on-top .ie-layers-backdrop {
  z-index: 1001 !important;
}
body.ie-layers-on-top .project-generate-right {
  z-index: 999 !important;
}
body:not(.ie-layers-on-top) .ie-layers-panel {
  z-index: 998 !important;
}
body:not(.ie-layers-on-top) .ie-layers-backdrop {
  z-index: 997 !important;
}
body:not(.ie-layers-on-top) .project-generate-right {
  z-index: 1001 !important;
}

/* ---------- Right panel bottom section & cart button ---------- */
.project-generate-right {
  pointer-events: auto !important;
}
@media (min-width: 601px) {
  .project-generate-right {
    position: relative !important;
  }
}
.project-generate-right * {
  pointer-events: auto;
}
.project-generate-right__bottom {
  pointer-events: auto !important;
  position: relative !important;
  z-index: 102 !important;
}
.project-generate-right__bottom button,
.project-generate-right__bottom a,
.project-generate-right__bottom [role="button"] {
  pointer-events: auto !important;
  position: relative !important;
  cursor: pointer !important;
}
.project-generate-right-button {
  pointer-events: auto !important;
  cursor: pointer !important;
  position: relative !important;
  z-index: 5 !important;
}
/* Make sure the cart button link/button is fully clickable */
.project-generate-right-button a,
.project-generate-right-button button,
.project-generate-right-button span {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* ---------- Right panel "N товар" icon — replace with custom PNG ---------- */
.project-generate-right-goods__count > svg {
  display: none !important;
}
.project-generate-right-goods__count {
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  height: auto !important;
}
.project-generate-right-goods__count::before {
  content: '';
  display: inline-block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: url("/static/media/Vector%20(8).png") no-repeat center / contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ---------- Right panel product thumbnails — show original images ---------- */
.project-generate-right__goods .project-generate-right-goods__button img,
.project-generate-right__goods img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 8px;
}

/* ---------- Bottom panel: hide native, show redesigned ---------- */
.project-generate-left__buttons-layout {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: none !important;
}
.project-generate-left__buttons-layout[data-ie-redesigned4] {
  opacity: 1 !important;
  visibility: visible !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

/* ---------- HOVER / SELECTION OUTLINES (blue dashed) ---------- */
.project-item.ie-hover,
.ie-shape.ie-hover,
.ie-text-element.ie-hover {
  outline: 1.5px dashed #4A90D9 !important;
  outline-offset: 2px;
}
.project-item__active,
.ie-shape.ie-active,
.ie-text-element.ie-active {
  outline: 1.5px solid #4A90D9 !important;
  outline-offset: 0px;
}
/* Hide outlines during drag */
body.ie-dragging .project-item,
body.ie-dragging .ie-shape,
body.ie-dragging .ie-text-element {
  outline: none !important;
}

/* ==========================================================
   TOOLBARS — shared base styles for all three toolbars
   JS classes: #ie-toolbar, #ie-text-toolbar, #ie-shape-toolbar
   Visible class: .ie-toolbar--visible
   ========================================================== */
#ie-toolbar,
#ie-text-toolbar,
#ie-shape-toolbar {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 3px 16px rgba(0,0,0,.10);
  user-select: none;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
#ie-toolbar.ie-toolbar--visible,
#ie-text-toolbar.ie-toolbar--visible,
#ie-shape-toolbar.ie-toolbar--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Toolbar buttons ---------- */
/* JS creates: <button class="ie-btn"> and <button class="ie-btn ie-btn--danger"> */
.ie-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  border-radius: 8px;
  white-space: nowrap;
  transition: background .15s;
  line-height: 1;
}
.ie-btn:hover {
  background: #f0f0f0;
}
.ie-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.ie-btn span {
  pointer-events: none;
}
.ie-btn--danger:hover {
  background: #fee;
  color: #c00;
}
.ie-btn--ai {
  color: #4A90D9;
}
.ie-btn--ai:hover {
  background: #e8f0fe;
}

/* ---------- Toolbar separator ---------- */
/* JS creates: <span class="ie-sep"> */
.ie-sep {
  width: 1px;
  height: 20px;
  background: #e0e0e0;
  margin: 0 2px;
  flex-shrink: 0;
}

/* ---------- Toolbar label ---------- */
/* JS creates: <span class="ie-toolbar-label"> */
.ie-toolbar-label {
  font-size: 12px;
  color: #666;
  padding: 0 4px;
  white-space: nowrap;
}

/* ---------- Text toolbar: font select ---------- */
/* JS creates: <select class="ie-font-select"> */
.ie-font-select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  outline: none;
  max-width: 140px;
}

/* ---------- Toolbar color input ---------- */
/* JS creates: <input type="color" class="ie-color-input"> */
.ie-color-input {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ccc;
  cursor: pointer;
  padding: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background: none;
}
.ie-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.ie-color-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.ie-color-input::-moz-color-swatch { border: none; border-radius: 50%; }

/* ---------- Text style buttons (B, I, U, S, align) ---------- */
/* JS creates: <button class="ie-text-style-btn"> */
.ie-text-style-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  transition: background .15s, border-color .15s;
}
.ie-text-style-btn:hover {
  background: #f0f0f0;
  border-color: #bbb;
}
.ie-text-style-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- Number input in shape toolbar ---------- */
/* JS creates: <input type="number" class="ie-number-input"> */
.ie-number-input {
  width: 55px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  outline: none;
}

/* ---------- Range (slider) input ---------- */
.ie-range-input {
  width: 80px;
  height: 4px;
  accent-color: #4A90D9;
  cursor: pointer;
  vertical-align: middle;
}
.ie-opacity-value {
  font-size: 12px;
  color: #555;
  margin-left: 4px;
  min-width: 32px;
  display: inline-block;
}

/* ==========================================================
   RESIZE HANDLES
   JS creates: <div class="ie-resize-handle ie-resize-handle--{pos}">
   Positions: nw, n, ne, e, se, s, sw, w
   ========================================================== */
.ie-resize-handle {
  position: fixed;
  background: #ffffff;
  border: 2px solid #4A90D9;
  cursor: nwse-resize;
  box-sizing: border-box;
  pointer-events: auto;
  transition: box-shadow .1s ease;
}
/* Corner handles - visible square blocks */
.ie-resize-handle--nw,
.ie-resize-handle--ne,
.ie-resize-handle--se,
.ie-resize-handle--sw {
  width: 12px !important;
  height: 12px !important;
  background: #ffffff;
  border: 2px solid #4A90D9;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.ie-resize-handle--nw:hover,
.ie-resize-handle--ne:hover,
.ie-resize-handle--se:hover,
.ie-resize-handle--sw:hover {
  background: #4A90D9;
  box-shadow: 0 0 0 3px rgba(74,144,217,.25);
}
.ie-resize-handle--nw { cursor: nwse-resize; }
.ie-resize-handle--se { cursor: nwse-resize; }
.ie-resize-handle--ne { cursor: nesw-resize; }
.ie-resize-handle--sw { cursor: nesw-resize; }
.ie-resize-handle--n  { cursor: ns-resize; }
.ie-resize-handle--s  { cursor: ns-resize; }
.ie-resize-handle--e  { cursor: ew-resize; }
.ie-resize-handle--w  { cursor: ew-resize; }

/* ---------- ROTATE HANDLE ---------- */
/* JS creates: <div class="ie-rotate-handle"> */
.ie-rotate-handle {
  position: fixed;
  width: 24px;
  height: 24px;
  background: #4A90D9;
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  box-sizing: border-box;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.ie-rotate-handle:active {
  cursor: grabbing;
}

/* ==========================================================
   CONTEXT MENU
   JS creates: <div class="ie-context-menu">
     <div class="ie-context-menu-item"> / <div class="ie-context-menu-item--danger">
     <div class="ie-context-menu-separator">
     <span class="ie-ctx-shortcut"> / <span class="ie-ctx-arrow">
     <div class="ie-context-submenu">
   ========================================================== */
.ie-context-menu {
  position: fixed;
  z-index: 100005;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  padding: 6px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ie-context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: background .1s;
  position: relative;
}
.ie-context-menu-item:hover {
  background: #f5f5f5;
}
.ie-context-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.ie-context-menu-item--danger {
  color: #d32f2f;
}
.ie-context-menu-item--danger:hover {
  background: #fee;
}
.ie-context-menu-separator {
  height: 1px;
  background: #e8e8e8;
  margin: 4px 0;
}
.ie-ctx-shortcut {
  margin-left: auto;
  font-size: 11px;
  color: #999;
}
.ie-ctx-arrow {
  margin-left: auto;
  font-size: 16px;
  color: #999;
}
.ie-context-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  padding: 6px 0;
  z-index: 100006;
}
.ie-context-submenu .ie-context-menu-item {
  padding: 8px 16px;
}

/* ==========================================================
   SHAPES POPUP
   JS creates: <div class="ie-shapes-popup">
     <div class="ie-shapes-popup-item" data-shape="...">
   ========================================================== */
.ie-shapes-popup {
  position: fixed;
  z-index: 100005;
  width: 200px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  padding: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ie-shapes-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  border-radius: 8px;
  transition: background .15s;
}
.ie-shapes-popup-item:hover {
  background: #e8f0fe;
}
.ie-shapes-popup-item svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* ==========================================================
   LAYERS PANEL
   JS creates: <div class="ie-layers-panel">
     <div class="ie-layers-header"><span>Слои</span><button class="ie-layers-close">
     <div class="ie-layers-list">
       <div class="ie-layers-item"> / .ie-layers-item--active / .ie-layers-item--highlighted
         <div class="ie-layers-drag">
         <div class="ie-layers-preview">
           <img class="ie-layers-thumb"> OR <div class="ie-layers-shape-preview"> OR <div class="ie-layers-text-label">
         <button class="ie-layers-eye"> / .ie-layers-eye--hidden
   ========================================================== */
.ie-layers-panel {
  position: fixed;
  right: 320px;
  top: 100px;
  z-index: 100000;
  width: 260px;
  max-height: 400px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ie-layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}
.ie-layers-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  padding: 0 4px;
  line-height: 1;
}
.ie-layers-close:hover {
  color: #333;
}
.ie-layers-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}
.ie-layers-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .1s;
  background: #fafafa;
  border: 1px solid #eee;
}
.ie-layers-item:hover,
.ie-layers-item--highlighted {
  background: #e8f0fe;
}
.ie-layers-item--active {
  background: #d6e4f7;
  border-color: #4A90D9;
}
.ie-layers-item--dragging {
  opacity: 0.5;
}
.ie-layers-item--dragover {
  border-color: #4A90D9;
  border-style: dashed;
}
.ie-layers-drag {
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  flex-shrink: 0;
  min-width: 28px;
  min-height: 36px;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.ie-layers-drag:active {
  cursor: grabbing;
}
.ie-layers-drag svg {
  pointer-events: none;
}
.ie-layers-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.ie-layers-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: #eee;
  flex-shrink: 0;
  border: 1px solid #ddd;
}
.ie-layers-shape-preview {
  width: 40px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ie-layers-shape-preview svg {
  width: 100%;
  height: 100%;
}
.ie-layers-text-label {
  font-size: 12px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.ie-layers-eye {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  flex-shrink: 0;
  min-width: 36px;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ie-layers-eye:hover {
  background: #e0e0e0;
}
.ie-layers-eye:active {
  background: #d0d0d0;
}
.ie-layers-eye--hidden {
  opacity: 0.3;
}
.ie-layers-eye svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* Layers scrollbar */
.ie-layers-panel::-webkit-scrollbar {
  width: 6px;
}
.ie-layers-panel::-webkit-scrollbar-track {
  background: transparent;
}
.ie-layers-panel::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* ==========================================================
   OVERLAY SHAPES
   JS creates: <div class="ie-shape">
   ========================================================== */
.ie-shape {
  position: absolute;
  cursor: move;
  user-select: none;
}
.ie-shape svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================
   TEXT ELEMENTS
   JS creates: <div class="ie-text-element">
   Editing class: .ie-text--editing
   ========================================================== */
.ie-text-element {
  position: absolute;
  cursor: move;
  user-select: none;
  min-width: 40px;
  min-height: 20px;
  outline: none;
  word-break: break-word;
}
.ie-text-element.ie-text--editing {
  cursor: text;
  user-select: text;
}

/* ==========================================================
   SAVE NOTIFICATION
   JS creates: <div class="ie-save-notification">
   ========================================================== */
.ie-save-notification {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: ieFadeIn .2s ease;
}
@keyframes ieFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes ieSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes ieModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==========================================================
   MUSE / KANDINSKY AI PANEL
   JS creates: <div class="ie-muse-panel">
     <div class="ie-muse-header"><span class="ie-muse-title"><button class="ie-muse-close">
     <div class="ie-muse-body"><textarea class="ie-muse-input">
     <div class="ie-muse-tags"><button class="ie-muse-tag">
     <div class="ie-muse-footer"><button class="ie-muse-settings"><button class="ie-muse-submit">
   ========================================================== */
.ie-muse-panel {
  position: fixed;
  z-index: 100005;
  width: 340px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
.ie-muse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #eee;
}
.ie-muse-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.ie-muse-close {
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: #999;
  padding: 0 4px;
  line-height: 1;
}
.ie-muse-close:hover {
  color: #333;
}
.ie-muse-body {
  padding: 14px 16px;
}
.ie-muse-input {
  width: 100%;
  min-height: 80px;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
}
.ie-muse-input:focus {
  border-color: #4A90D9;
}
.ie-muse-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.ie-muse-tag {
  padding: 5px 12px;
  border: 1px solid #ddd;
  border-radius: 16px;
  background: #fafafa;
  cursor: pointer;
  font-size: 12px;
  color: #555;
  transition: background .15s, border-color .15s;
}
.ie-muse-tag:hover {
  background: #e8f0fe;
  border-color: #4A90D9;
}
.ie-muse-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid #eee;
}
  .ie-font-size-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0f0f0;
  border-radius: 6px;
  padding: 2px 6px;
}

.ie-font-size-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  color: #333;
  transition: background 0.2s;
}

.ie-font-size-btn:hover {
  background: #e0e0e0;
}

.ie-font-size-value {
  min-width: 30px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #333;
}
.ie-muse-settings {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  color: #666;
}
.ie-muse-settings:hover {
  background: #f0f0f0;
}
.ie-muse-submit {
  flex: 1;
  padding: 10px 16px;
  background: #4A90D9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.ie-muse-submit:hover {
  background: #3a7bc8;
}
.ie-muse-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================
   DOWNLOAD BUTTONS (in images-popup)
   JS creates: <div class="ie-download-buttons">
     <button class="ie-download-row-btn">
   ========================================================== */
.ie-download-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}
.ie-download-row-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: background .15s, border-color .15s;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ie-download-row-btn:hover {
  background: #e8f0fe;
  border-color: #4A90D9;
}

/* ---------- Images popup fix ---------- */
.images-popup-element .button.button_primary {
  position: relative;
}
.images-popup-element {
  display: flex;
  flex-direction: column;
  overflow: visible !important;
}

/* ==========================================================
   POPUP BACKDROP FIX
   ========================================================== */
.popup-backdrop[style*="display: none"],
.goods-popup-backdrop[style*="display: none"] {
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

/* ==========================================================
   FULLSCREEN MODE
   ========================================================== */
body.ie-fullscreen .project-generate,
:fullscreen.project-generate {
  background: #f5f5f5 !important;
}
body.ie-fullscreen .project-generate-header,
:fullscreen .project-generate-header {
  display: flex !important;
  position: relative !important;
  z-index: 2005 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  height: auto !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  border-radius: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}
body.ie-fullscreen .project-generate-right,
:fullscreen .project-generate-right {
  display: none !important;
}
body.ie-fullscreen .ie-cart-proxy,
:fullscreen .ie-cart-proxy {
  display: none !important;
}
body.ie-fullscreen .project-generate-left__menu,
:fullscreen .project-generate-left__menu {
  display: flex !important;
  z-index: 2004 !important;
  background: transparent !important;
  margin-top: 0 !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  position: relative !important;
}
body.ie-fullscreen .project-generate-left,
:fullscreen .project-generate-left {
  width: 100% !important;
  max-width: 100% !important;
}
body.ie-fullscreen .project-generate-left__contant,
:fullscreen .project-generate-left__contant {
  width: 100% !important;
  height: 100vh !important;
}
body.ie-fullscreen .project-container-scroll,
:fullscreen .project-container-scroll {
  padding-top: 10px !important;
}

/* Fullscreen: toolbar stays at top */
body.ie-fullscreen #ie-toolbar,
body.ie-fullscreen #ie-text-toolbar,
body.ie-fullscreen #ie-shape-toolbar,
:fullscreen #ie-toolbar,
:fullscreen #ie-text-toolbar,
:fullscreen #ie-shape-toolbar {
  z-index: 99995;
}

/* Fullscreen: bottom panel centered */
body.ie-fullscreen .project-generate-left__buttons-layout[data-ie-redesigned4],
:fullscreen .project-generate-left__buttons-layout[data-ie-redesigned4] {
  left: 50% !important;
  transform: translateX(-50%) !important;
  bottom: 20px !important;
}

/* Fullscreen: layers/shapes/context above everything */
body.ie-fullscreen .ie-layers-panel,
body.ie-fullscreen .ie-shapes-popup,
body.ie-fullscreen .ie-context-menu,
body.ie-fullscreen .ie-muse-panel,
:fullscreen .ie-layers-panel,
:fullscreen .ie-shapes-popup,
:fullscreen .ie-context-menu,
:fullscreen .ie-muse-panel {
  z-index: 100005;
}

/* ==========================================================
   BOTTOM PANEL BUTTON STYLES (redesigned panel)
   ========================================================== */
.project-generate-left__buttons-layout[data-ie-redesigned4] .project-generate-left-buttons-container[data-ie-btn] {
  cursor: pointer;
}
.project-generate-left__buttons-layout[data-ie-redesigned4] .project-generate-left-buttons-container[data-ie-btn] .project-generate-left-buttons-element_background {
  color: #fff;
}
.project-generate-left__buttons-layout[data-ie-redesigned4] .project-generate-left-buttons-container[data-ie-btn]:hover .project-generate-left-buttons-element_background {
  opacity: 0.8;
}

/* ==========================================================
   DOWNLOAD MODAL (image download popup)
   ========================================================== */
.ie-download-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300010;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: ieFadeIn .2s ease;
}
.ie-download-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  width: 90%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 28px 28px;
  position: relative;
}
.ie-download-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  position: sticky;
  top: -24px;
  background: #fff;
  padding: 24px 0 12px;
  z-index: 1;
}
.ie-download-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #222;
}
.ie-download-modal-close {
  border: none;
  background: transparent;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color .15s;
}
.ie-download-modal-close:hover {
  color: #333;
}
.ie-download-modal-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ie-download-modal-card {
  display: flex;
  align-items: stretch;
  gap: 24px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 20px;
  transition: border-color .15s, box-shadow .15s;
}
.ie-download-modal-card:hover {
  border-color: #c8c8c8;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.ie-download-modal-card-preview {
  flex-shrink: 0;
  width: 160px;
  min-height: 110px;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}
.ie-download-modal-card-preview--transparent {
  background:
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.ie-download-modal-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.ie-download-modal-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
.ie-download-modal-card-format {
  font-size: 13px;
  color: #999;
  font-weight: 400;
}
.ie-download-modal-card-id {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}
.ie-download-modal-card-meta {
  font-size: 13px;
  color: #888;
}
.ie-download-modal-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 28px;
  border: none;
  border-radius: 24px;
  background: #F5A623;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
  box-sizing: border-box;
}
.ie-download-modal-card-btn:hover {
  background: #E09620;
}
.ie-download-modal-card-btn svg {
  flex-shrink: 0;
}
.ie-download-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 8px;
  flex-shrink: 0;
}

/* ===== DOWNLOAD MODAL — Responsive ===== */

/* Large desktops / 2K+ monitors */
@media (min-width: 1921px) {
  .ie-download-modal {
    max-width: 900px;
    padding: 32px 36px 36px;
  }
  .ie-download-modal-title {
    font-size: 22px;
  }
  .ie-download-modal-card {
    gap: 28px;
    padding: 24px;
  }
  .ie-download-modal-card-preview {
    width: 200px;
    min-height: 140px;
  }
  .ie-download-modal-card-id {
    font-size: 18px;
  }
  .ie-download-modal-card-format,
  .ie-download-modal-card-meta {
    font-size: 14px;
  }
  .ie-download-modal-card-btn {
    font-size: 16px;
    padding: 14px 24px;
  }
  .ie-download-btn-icon {
    width: 32px;
    height: 32px;
  }
}

/* Tablets landscape / small laptops */
@media (max-width: 1024px) {
  .ie-download-modal {
    max-width: 680px;
    padding: 20px 22px 24px;
  }
  .ie-download-modal-card-preview {
    width: 140px;
    min-height: 96px;
  }
  .ie-download-modal-card {
    gap: 18px;
    padding: 16px;
  }
}

/* Tablets portrait */
@media (max-width: 768px) {
  .ie-download-modal {
    width: 95%;
    max-width: 560px;
    padding: 16px 16px 20px;
    border-radius: 16px;
  }
  .ie-download-modal-header {
    margin-bottom: 14px;
    padding: 16px 0 8px;
    top: -16px;
  }
  .ie-download-modal-title {
    font-size: 16px;
  }
  .ie-download-modal-card {
    flex-direction: row;
    gap: 14px;
    padding: 14px;
  }
  .ie-download-modal-card-preview {
    width: 120px;
    min-height: 80px;
    max-height: 120px;
    flex-shrink: 0;
  }
  .ie-download-modal-card-id {
    font-size: 14px;
    font-weight: 700;
    word-break: break-all;
  }
  .ie-download-modal-card-format,
  .ie-download-modal-card-meta {
    font-size: 12px;
  }
  .ie-download-modal-card-btn {
    font-size: 13px;
    padding: 10px 18px;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .ie-download-modal-overlay {
    align-items: center;
    padding: 16px;
  }
  .ie-download-modal {
    width: calc(100% - 24px);
    max-width: 380px;
    border-radius: 20px;
    max-height: 90vh;
    padding: 20px 16px 24px;
  }
  .ie-download-modal-header {
    margin-bottom: 12px;
    padding: 8px 0 8px;
    top: -20px;
  }
  .ie-download-modal-title {
    font-size: 16px;
  }
  .ie-download-modal-close {
    font-size: 22px;
  }
  .ie-download-modal-cards {
    gap: 14px;
  }
  .ie-download-modal-card {
    flex-direction: row;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid #eee;
  }
  .ie-download-modal-card-preview {
    width: 100px;
    min-width: 100px;
    min-height: 70px;
    max-height: 100px;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .ie-download-modal-card-info {
    gap: 2px;
  }
  .ie-download-modal-card-id {
    font-size: 14px;
    font-weight: 700;
    word-break: break-all;
  }
  .ie-download-modal-card-format,
  .ie-download-modal-card-meta {
    font-size: 11px;
  }
  .ie-download-modal-card-btn {
    font-size: 12px;
    padding: 8px 14px;
    border-radius: 20px;
  }
  .ie-download-btn-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
  }
}

/* Very small phones (iPhone SE, etc.) */
@media (max-width: 360px) {
  .ie-download-modal {
    padding: 16px 12px 20px;
    max-height: 85vh;
  }
  .ie-download-modal-card {
    padding: 10px;
    gap: 8px;
  }
  .ie-download-modal-card-preview {
    width: 80px;
    min-width: 80px;
    min-height: 60px;
    max-height: 90px;
  }
  .ie-download-modal-card-btn {
    font-size: 11px;
    padding: 8px 10px;
  }
}


/* EMPTY CART MESSAGE */
.ie-empty-cart-msg {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  min-height: 200px;
  padding: 20px 16px;
  font-size: 14px;
  color: #888;
  box-sizing: border-box;
}

/* ==========================================================
   AI GENERATION POPUP — compact layout, no side gaps
   The React popup with .ai-generator-layout inside .popup
   ========================================================== */
.projects-popup {
  z-index: 300001 !important;
  pointer-events: auto !important;
}
.projects-popup:has(.ai-generator-layout) {
  background: rgba(52, 52, 52, 0.45) !important;
}
.projects-popup:has(.ai-generator-layout) .projects-block-layout,
.projects-popup:has(.ai-generator-layout) .projects-create-layout {
  max-width: 560px !important;
  padding: 20px 24px 24px !important;
  border-radius: 16px !important;
  position: relative !important;
}
.projects-popup:has(.ai-generator-layout) .ai-generator-layout {
  max-width: 100% !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
}
/* Icon + title in one row */
.projects-popup:has(.ai-generator-layout) .ai-generator-icon {
  display: block !important;
  flex-shrink: 0;
  width: 32px !important;
  height: 32px !important;
  margin-right: 10px;
  margin-top: 2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 0C52 28 72 48 100 50C72 52 52 72 50 100C48 72 28 52 0 50C28 48 48 28 50 0Z' fill='%23FFA800'/%3E%3C/svg%3E") no-repeat center / contain;
}
.projects-popup:has(.ai-generator-layout) .ai-generator-icon svg {
  display: none !important;
}
.projects-popup:has(.ai-generator-layout) .ai-generator-title {
  flex: 1 !important;
  min-width: 0 !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  line-height: 30px !important;
  margin-top: 0 !important;
  text-align: left !important;
}
.projects-popup:has(.ai-generator-layout) .ai-generator-input-layout {
  width: 100% !important;
  margin: 16px 0 !important;
}
.projects-popup:has(.ai-generator-layout) .ai-generator-description {
  text-align: left !important;
  font-size: 14px !important;
  line-height: 150% !important;
  margin-bottom: 10px !important;
}
.projects-popup:has(.ai-generator-layout) .ai-generator-input {
  border-radius: 14px !important;
  border: 1px solid #F5E6C8 !important;
  background: #FFF8E7 !important;
  height: 80px !important;
  font-size: 14px !important;
  padding: 12px 18px !important;
}
.projects-popup:has(.ai-generator-layout) .projects-create-close {
  position: absolute !important;
  right: 8px !important;
  top: 8px !important;
}
.projects-popup:has(.ai-generator-layout) .projects-create-close:hover {
  transform: none !important;
}

.projects-popup:has(.ai-generator-layout) .projects-create-layout {
  overflow: hidden !important;
}
.projects-popup:has(.ai-generator-layout) .ai-generator-layout > .button {
  width: 100% !important;
}

/* ==========================================================
   HEADER AI BUTTON — match design with visible sparkle icon
   ========================================================== */
/* General button base */
.project-generate-header-button {
  height: 48px !important;
  min-height: 48px !important;
  padding: 10px 20px !important;
  gap: 10px !important;
  font-family: 'Rubik', sans-serif !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  line-height: 16px !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

/* AI button */
.project-generate-header-button__primary {
  background: #FFB200 !important;
  color: #694F12 !important;
  border-radius: 14px !important;
  height: 48px !important;
  max-width: none !important;
  transition: background 0.2s ease, box-shadow 0.2s ease !important;
}
.project-generate-header-button__primary:hover {
  background: #e9a300 !important;
  box-shadow: 0 2px 8px rgba(255, 178, 0, 0.3) !important;
}
.project-generate-header-button__primary:active {
  background: #d49500 !important;
  transform: scale(0.98) !important;
}
.project-generate-header-button__primary:focus-visible {
  outline: 2px solid #FFB200 !important;
  outline-offset: 2px !important;
}
/* Hide original circle-based SVG icon */
.project-generate-header-button__primary > svg {
  display: none !important;
}
/* Sparkle icon */
.project-generate-header-button__primary::before {
  content: '';
  display: inline-block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: url("/static/media/Group%201052.png") no-repeat center / contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ==========================================================
   PROJECT MENU BAR — replace icons to match design
   ========================================================== */
/* Hide all original SVGs inside menu elements */
.project-generate-left-menu__element > svg,
.project-generate-left-menu__element > span > svg {
  display: none !important;
}
.project-generate-left-menu__element {
  gap: 8px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}
.project-generate-left-menu__element::before {
  content: '';
  display: inline-block;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* Сохранить */
.project-generate-left-menu__element[data-ie-menu="save"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237a5c00'%3E%3Cpath d='M5 3a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V7.414a1 1 0 00-.293-.707l-3.414-3.414A1 1 0 0016.586 3H5zm3 1h6v4H8V4zm4 8a2 2 0 110 4 2 2 0 010-4z'/%3E%3C/svg%3E");
}
/* Редактировать (custom icon) */
.project-generate-left-menu__element[data-ie-menu="edit"]::before {
  background-image: url("/static/media/Group%201053%20(1).png");
  background-size: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
/* Изображения (download with orange bg) */
.project-generate-left-menu__element[data-ie-menu="images"]::before {
  width: 26px; height: 26px;
  border-radius: 6px;
  background-color: #FFA800;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4v10m0 0l-4-4m4 4l4-4' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3Cpath d='M6 18h12' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  background-size: 18px 18px;
}
.project-generate-left-menu__element[data-ie-menu="images"] > .loading-icon {
  display: none !important;
}
/* Поделиться (share) */
.project-generate-left-menu__element[data-ie-menu="share"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='18' cy='5' r='3' fill='%23FFA800'/%3E%3Ccircle cx='6' cy='12' r='3' fill='%23FFA800'/%3E%3Ccircle cx='18' cy='19' r='3' fill='%23FFA800'/%3E%3Cline x1='8.59' y1='13.51' x2='15.42' y2='17.49' stroke='%23FFA800' stroke-width='2'/%3E%3Cline x1='15.41' y1='6.51' x2='8.59' y2='10.49' stroke='%23FFA800' stroke-width='2'/%3E%3C/svg%3E");
}

/* ==========================================================
   EDIT / NEW PROJECT / SHARE POPUPS — dark backdrop same as images popup
   These use .projects-popup (z-index elevated above) — no extra rules needed
   ========================================================== */

/* ==========================================================
   TEXT EDITING — hide cursor blinking when not editing
   ========================================================== */
.ie-text-element:not(.ie-text--editing) {
  caret-color: transparent !important;
}
.ie-text-element.ie-text--editing {
  caret-color: auto !important;
}

/* ==========================================================
   RESIZE IMAGE MODAL (Paint-style)
   ========================================================== */
.ie-resize-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300010;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: ieModalFadeIn .2s ease;
}
.ie-resize-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  width: 420px;
  max-width: 94vw;
  max-height: 92vh;
  overflow-y: auto;
  padding: 0;
  position: relative;
}
.ie-resize-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #eee;
}
.ie-resize-title {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}
.ie-resize-close {
  border: none;
  background: transparent;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color .15s;
}
.ie-resize-close:hover { color: #333; }

.ie-resize-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 20px 8px;
  font-size: 12px;
  color: #888;
}
.ie-resize-info strong {
  color: #444;
}

/* Tabs */
.ie-resize-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid #eee;
}
.ie-resize-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.ie-resize-tab:hover { color: #444; }
.ie-resize-tab--active {
  color: #4A90D9;
  border-bottom-color: #4A90D9;
}

/* Panels */
.ie-resize-panel {
  padding: 16px 20px 8px;
}
.ie-resize-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.ie-resize-row label {
  font-size: 13px;
  color: #555;
  min-width: 140px;
  white-space: nowrap;
}
.ie-resize-row--checkbox {
  padding: 4px 20px 12px;
}
.ie-resize-row--checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  min-width: 0;
}
.ie-resize-row--checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4A90D9;
  cursor: pointer;
}
.ie-resize-input {
  flex: 1;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  color: #333;
  outline: none;
  transition: border-color .15s;
  max-width: 140px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.ie-resize-input:focus {
  border-color: #4A90D9;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}
.ie-resize-input:disabled {
  background: #f5f5f5;
  color: #aaa;
}
.ie-resize-input::-webkit-inner-spin-button,
.ie-resize-input::-webkit-outer-spin-button {
  opacity: 1;
}

/* Preview */
.ie-resize-preview-section {
  padding: 8px 20px 16px;
}
.ie-resize-preview-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}
.ie-resize-preview-label span {
  color: #444;
  font-weight: 500;
}
.ie-resize-preview-box {
  width: 100%;
  height: 150px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ie-resize-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: width .15s, height .15s;
}

/* Footer */
.ie-resize-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid #eee;
}
.ie-resize-btn {
  border: none;
  border-radius: 8px;
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.ie-resize-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.ie-resize-btn--secondary {
  background: #f0f0f0;
  color: #555;
}
.ie-resize-btn--secondary:hover {
  background: #e4e4e4;
}
.ie-resize-btn--primary {
  background: #4A90D9;
  color: #fff;
}
.ie-resize-btn--primary:hover {
  background: #3a7bc8;
}

/* Force disable transitions on items being resized/dragged by our overlay.
   !important overrides React's inline style transition.
   Prevents the "left 0.15s, top 0.15s" from causing drift during resize. */
.ie-no-transition {
  transition: none !important;
}

/* ======================================================================
   CART CONFIRMATION MODAL — centered modal with cart/continue buttons
   ====================================================================== */
.ie-cart-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300010;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: ieModalFadeIn .2s ease;
}
.ie-cart-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  width: 90%;
  max-width: 420px;
  padding: 28px 28px 24px;
  position: relative;
  text-align: center;
}
.ie-cart-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 26px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color .15s;
}
.ie-cart-modal__close:hover {
  color: #333;
}
.ie-cart-modal__icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #4CAF50;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: bold;
  margin: 0 auto 16px;
}
.ie-cart-modal__title {
  font-size: 18px;
  font-weight: 600;
  color: #222;
  margin-bottom: 6px;
}
.ie-cart-modal__subtitle {
  font-size: 14px;
  color: #888;
  margin-bottom: 24px;
}
.ie-cart-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ie-cart-modal__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.ie-cart-modal__btn--cart {
  background: #FCB620;
  color: #343434;
}
.ie-cart-modal__btn--cart:hover {
  background: #E5A51C;
}
.ie-cart-modal__btn--continue {
  background: #f0f0f0;
  color: #555;
}
.ie-cart-modal__btn--continue:hover {
  background: #e4e4e4;
}

@media (max-width: 480px) {
  .ie-cart-modal-overlay {
    align-items: flex-end;
  }
  .ie-cart-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 24px 20px 20px;
  }
}

/* ===== OVERLAY COMPONENTS — Mobile responsive ===== */

/* ==================================================================
   MOBILE CONSTRUCTOR — Complete responsive overhaul
   Targets: menu bar, popups, panels, toolbars, project dropdown, cart
   ================================================================== */

/* ---- Tablet portrait & below (768px) ---- */
/* ==========================================================================
   TABLET (max-width: 1024px) — keep desktop layout, tighten spacing
   ========================================================================== */
@media (max-width: 1024px) {
  /* Header — tablet landscape */
  .project-generate-header {
    padding: 6px 20px !important;
    border-radius: 70px !important;
    gap: 0 !important;
    flex-wrap: nowrap !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
  }
  .project-generate-header__logo {
    width: 100px !important;
    height: 18px !important;
  }
  .project-generate-header__link {
    font-size: 11px !important;
  }
  .project-generate-header__link::before {
    height: 24px !important;
  }
  .project-generate-header-button {
    padding: 5px 10px !important;
    font-size: 10px !important;
    height: 36px !important;
    min-height: 36px !important;
  }
  .project-generate-header-button__primary,
  .project-generate .project-generate-header-button.project-generate-header-button__secondary {
    height: 36px !important;
  }
  .project-generate-header-button__primary::before,
  .project-generate .project-generate-header-button.project-generate-header-button__secondary::before {
    width: 15px !important;
    height: 15px !important;
  }



}

/* ==========================================================================
   TABLET PORTRAIT (max-width: 768px) — all buttons remain visible
   ========================================================================== */
@media (max-width: 768px) {
  /* ---- TABLET LAYOUT — flex column, canvas fills available space ---- */
  .project-generate {
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .project-generate-main {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .project-generate-left {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .project-generate-left__contant {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .project-container-scroll {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: auto !important;
    touch-action: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-top: 0 !important;
  }
  .project-generate-header {
    flex-shrink: 0 !important;
  }
  .project-generate-left__menu {
    flex-shrink: 0 !important;
  }

  /* ---- RIGHT PANEL — floating on tablet ---- */
  .project-generate-right {
    position: fixed !important;
    top: auto !important;
    right: 8px !important;
    bottom: 80px !important;
    width: 260px !important;
    max-height: 50vh !important;
    z-index: 1001 !important;
    background: transparent !important;
  }
  .project-generate-right__bottom {
    background: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1) !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
  }

  /* ---- BOTTOM PANEL (tools) ---- */
  .project-generate-left__buttons-layout,
  .project-generate-left__buttons-layout[data-ie-redesigned4] {
    position: fixed !important;
    bottom: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    z-index: 110 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: calc(100vw - 24px) !important;
  }

  /* Muse AI panel */
  .ie-muse-panel {
    width: 300px;
  }
  /* Resize modal */
  .ie-resize-modal {
    width: 380px;
  }
  .ie-resize-row label {
    min-width: 110px;
    font-size: 12px;
  }
  .ie-resize-input {
    max-width: 110px;
  }
  /* AI generator popup override */
  .popup:has(.ai-generator-layout) .popup-block,
  .popup:has(.ai-generator-layout) .projects-block-layout {
    max-width: calc(100% - 20px) !important;
    padding: 16px 16px 24px !important;
  }
  .popup:has(.ai-generator-layout) .ai-generator-title {
    font-size: 20px !important;
    line-height: 28px !important;
  }




  /* Left menu — tighter padding */
  .project-generate-left__menu {
    padding: 0 12px !important;
    margin-top: 6px !important;
  }
  .project-generate-left-menu__top {
    gap: 8px !important;
    font-size: 13px !important;
  }

  /* Overlay toolbars — scale for tablet */
  #ie-toolbar,
  #ie-text-toolbar,
  #ie-shape-toolbar {
    padding: 4px 8px !important;
    gap: 1px !important;
    max-width: calc(100vw - 16px) !important;
    overflow-x: auto !important;
    transform: none !important;
  }
  #ie-toolbar .ie-btn,
  #ie-text-toolbar .ie-btn,
  #ie-shape-toolbar .ie-btn,
  #ie-text-toolbar .ie-text-style-btn {
    min-width: 28px !important;
    height: 28px !important;
    padding: 2px !important;
  }

  /* Shapes popup */
  .ie-shapes-popup {
    max-width: calc(100vw - 20px) !important;
    width: calc(100vw - 20px) !important;
  }

  /* Layers panel */
  .ie-layers-panel {
    max-width: calc(100vw - 20px) !important;
    max-height: 50vh !important;
  }

  /* Right panel goods grid */
  .project-generate-right__goods {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px !important;
  }

  /* All popups — ensure proper display */
  .popup {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .projects-popup {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: rgba(0, 0, 0, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .popup .popup-block,
  .projects-popup .projects-block-layout {
    max-width: calc(100% - 32px) !important;
    max-width: min(440px, calc(100% - 32px)) !important;
    margin: 16px auto !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
  }
  .projects-popup .projects {
    display: contents !important;
  }
  .projects-popup .projects > div {
    max-width: min(440px, calc(100% - 32px)) !important;
    width: 100% !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    box-sizing: border-box !important;
    padding: 24px 16px !important;
  }
  /* Show title on tablet (overrides global hide for AI auto-select) */
  .project-generate .projects-create-layout .projects-create-title {
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 0 16px !important;
    padding: 0 !important;
  }

  /* Projects dropdown — bottom sheet (tablet redesign) */
  .project-generate-menu-projects {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 75vh !important;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15) !important;
    z-index: 300025 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px !important;
    transform: none !important;
  }
  .project-generate-menu-projects__title {
    font-size: 18px !important;
    padding: 0 0 16px 0 !important;
  }
  .project-generate-menu-projects__layout {
    gap: 10px !important;
  }
  .project-generate-menu-projects__element {
    padding: 12px !important;
    min-height: 80px !important;
  }
  .project-generate-menu-projects-element__conteiner {
    width: 90px !important;
    height: 62px !important;
    min-width: 90px !important;
  }

  /* Goods popup — bottom sheet for tablet */
  .goods-popup {
    z-index: 300010 !important;
    display: flex !important;
    align-items: flex-end !important;
    position: fixed !important;
    inset: 0 !important;
    pointer-events: auto !important;
    background: rgba(52, 52, 52, 0.45) !important;
  }
  .goods-popup .goods {
    width: 100% !important;
  }
  .goods-popup .goods-layout {
    width: 100% !important;
    max-width: 100% !important;
    height: 85vh !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    margin-top: auto !important;
    background: #fff !important;
    pointer-events: auto !important;
  }
  .goods-popup .goods-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: #fff !important;
    padding: 16px !important;
    flex-shrink: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .goods-popup .goods-header .filter-popup__close {
    min-width: 32px !important;
    width: 32px !important;
    height: 32px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    z-index: 20 !important;
  }
  .goods-popup .goods-content {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    min-height: 0 !important;
  }

  /* ---- Image selection popup (goods-popup-small) — compact card on tablet ---- */
  .goods-popup.goods-popup-small .add-good-layout {
    max-width: 480px !important;
    max-height: 80vh !important;
    padding: 20px !important;
    border-radius: 20px !important;
    gap: 14px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    margin: auto !important;
  }
  .goods-popup.goods-popup-small .add-good-content {
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow: hidden !important;
  }
  .goods-popup.goods-popup-small .add-good-grid-layout {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 0 !important;
  }
  .goods-popup.goods-popup-small .add-good-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .goods-popup.goods-popup-small .add-good-grid-element {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1.14 !important;
  }
  .goods-popup.goods-popup-small .add-good-content > .button {
    flex-shrink: 0 !important;
    width: 100% !important;
    padding: 14px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
  }
}

/* ==========================================================================
   PHONE (max-width: 600px) — stack layout, bottom panel, mobile popups
   ========================================================================== */
@media (max-width: 600px) {
  /* ---- LAYOUT ---- */
  .project-generate {
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .project-generate-main {
    flex-direction: column !important;
    overflow: hidden !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
  }
  .project-generate-left {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .project-container-scroll {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: auto !important;
  }

  /* ---- HEADER ---- */
  .project-generate-header {
    width: calc(100% - 16px) !important;
    padding: 5px 16px !important;
    border-radius: 70px !important;
    margin: 6px auto 0px !important;
    gap: 0 !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    z-index: 1001 !important;
    background: radial-gradient(64.44% 209.98% at 43.25% 49.99%, rgba(255, 178, 0, 0.4) 0%, rgba(255, 242, 211, 0.4) 69.71%, rgba(255, 255, 255, 0.4) 93.75%) !important;
    box-shadow: 0px 20px 30px rgba(0, 0, 0, 0.1) !important;
    overflow: visible !important;
    position: relative !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    box-sizing: border-box !important;
  }

  /* ---- HEADER CHILDREN ---- */
  .project-generate-left__menu {
    flex-shrink: 0 !important;
    background: transparent !important;
  }
  .project-generate-header__logo {
    width: 90px !important;
    min-width: 60px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
  }
  .project-generate-header__link {
    display: none !important;
  }
  .project-generate-header__link::before {
    display: none !important;
  }
  .project-generate-header__buttons {
    gap: 6px !important;
    flex-wrap: nowrap !important;
    flex: 1 1 auto !important;
    justify-content: flex-end !important;
    min-width: 0 !important;
  }
  .project-generate-header-button {
    height: 34px !important;
    padding: 5px 8px !important;
    font-size: 9px !important;
    border-radius: 10px !important;
    gap: 6px !important;
    min-height: 34px !important;
    white-space: nowrap !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    line-height: 12px !important;
    color: #694F12 !important;
  }
  .project-generate-header-button__primary {
    background: #FFB200 !important;
    color: #694F12 !important;
    box-shadow: none !important;
    font-weight: 400 !important;
    flex-shrink: 1 !important;
    height: 32px !important;
  }
  .project-generate .project-generate-header-button.project-generate-header-button__secondary {
    background: #fff !important;
    border: none !important;
    color: #694F12 !important;
    flex-shrink: 1 !important;
    height: 32px !important;
  }
  .project-generate-header-button__primary::before,
  .project-generate .project-generate-header-button.project-generate-header-button__secondary::before {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
  }

  /* ---- MENU CONTAINER ---- */
  .project-generate-left__menu {
    padding: 0px !important;
    margin-top: 0px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0px !important;
  }

  /* ---- BACK BUTTON — hidden completely ---- */
  .ie-mobile-back-btn {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
  }

  /* ---- TOP ROW CONTAINER (project name + menus are both inside this) ---- */
  .project-generate-left-menu__top {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 0px !important;
    flex-wrap: nowrap !important;
    position: relative !important;
    padding: 0px !important;
    background: transparent !important;
    border-radius: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
    pointer-events: none !important; /* let clicks pass through empty areas to goods clone below */
  }


  /* Projects dropdown itself must remain clickable */
  .project-generate-left-menu__top .project-generate-menu-projects {
    pointer-events: auto !important;
  }

 

  /* ---- PROJECT NAME ROW — order 1, below menu buttons ---- */
  .project-generate-header__name {
    color: #343434 !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow: visible !important;
    white-space: nowrap !important;
    flex: 1 1 0% !important;
    order: 1 !important;
    padding: 4px 12px !important;
    height: 32px !important;
    line-height: 32px !important;
  }
  /* Ensure dropdown text inside name is visible */
  .project-generate-header__name span,
  .project-generate-header__name div,
  .project-generate-header__name p {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* ---- RIGHT PANEL — hidden on mobile, goods counter moved to project row by JS ---- */
  .project-generate-right {
    position: fixed !important;
    top: 200px !important;
    right: 8px !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 250px !important;
    max-height: calc(100vh - 280px) !important;
    z-index: 1001 !important;
    background: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1) !important;
    margin: 0 !important;
    flex-direction: column !important;
    gap: 0 !important;
  }
  .project-generate-right__top {
    display: none !important;
  }
  .project-generate-right-goods {
    display: none !important;
  }
  .project-generate-right__bottom {
    background: #fff !important;
    border-radius: 16px !important;
    box-shadow: none !important;
    max-height: calc(100vh - 280px) !important;
    overflow-y: auto !important;
  }

  /* ---- CANVAS CONTAINER — must flex, not fixed ---- */
  .project-generate-left__contant {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .project-container-scroll {
    padding-top: 0 !important;
    touch-action: auto !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }


  /* ---- HEADER NAME (Project 1) row ---- */
  .project-generate-header__name {
    color: #343434 !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  /* ---- Goods count styling ---- */
  .project-generate-right-goods__count {
    color: #64748b !important;
  }

  /* ---- Projects dropdown — ensure visible above everything ---- */
  .project-generate-menu-projects {
    z-index: 300025 !important;
    pointer-events: auto !important;
  }

 

  /* ---- OVERLAY TOOLBARS — positioned above selected element, not at bottom ---- */
  #ie-toolbar,
  #ie-shape-toolbar,
  #ie-text-toolbar {
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    overflow-x: auto !important;
    z-index: 99995 !important;
    transition: none !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12) !important;
    width: auto !important;
    padding: 4px 8px !important;
    gap: 2px !important;
  }
  /* Hide ALL button text labels on mobile so toolbar stays narrow and follows element */
  #ie-toolbar .ie-btn span,
  #ie-shape-toolbar .ie-toolbar-label,
  #ie-shape-toolbar .ie-opacity-value {
    display: none !important;
  }
  /* Compact all toolbar controls */
  #ie-toolbar .ie-sep,
  #ie-shape-toolbar .ie-sep,
  #ie-text-toolbar .ie-sep {
    height: 18px !important;
    margin: 0 1px !important;
  }
  #ie-shape-toolbar .ie-color-input,
  #ie-text-toolbar .ie-color-input {
    width: 24px !important;
    height: 24px !important;
  }
  #ie-shape-toolbar .ie-number-input {
    width: 36px !important;
    height: 26px !important;
    font-size: 12px !important;
    padding: 2px 3px !important;
  }
  #ie-shape-toolbar .ie-range-input {
    width: 50px !important;
  }
  #ie-shape-toolbar .ie-btn,
  #ie-toolbar .ie-btn {
    padding: 4px 6px !important;
  }
  #ie-text-toolbar .ie-font-select {
    max-width: 90px !important;
    font-size: 12px !important;
    padding: 3px 4px !important;
    height: 28px !important;
  }
  #ie-text-toolbar .ie-color-input {
    width: 26px !important;
    height: 26px !important;
  }
  #ie-text-toolbar .ie-text-style-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 2px !important;
    font-size: 13px !important;
  }
  #ie-text-toolbar .ie-btn {
    min-width: 28px !important;
    height: 28px !important;
    padding: 2px !important;
  }
  #ie-text-toolbar .ie-btn svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* ---- BOTTOM PANEL (black bar with icons) ---- */
  .project-generate-left__buttons-layout,
  .project-generate-left__buttons-layout[data-ie-redesigned4] {
    position: fixed !important;
    bottom: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    z-index: 110 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: calc(100vw - 24px) !important;
    height: auto !important;
    min-height: 50px !important;
  }

  /* ---- POPUPS — above everything ---- */

  .popup .popup-block,
  .popup .popup-content {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }

  /* projects-popup on mobile: dark overlay + centered compact card */
  .projects-popup {
    background: rgba(0, 0, 0, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
  }
  .projects-popup .popup-block,
  .projects-popup .projects-block-layout {
    max-width: 360px !important;
    width: calc(100% - 16px) !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
  }
  /* projects-popup form (Tailwind w-screen): compact card */
  .projects-popup .projects {
    display: contents !important;
  }
  .projects-popup .projects > div {
    max-width: 360px !important;
    width: 100% !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    box-sizing: border-box !important;
    padding: 20px 16px !important;
  }
  /* AI choice "Создать новый проект" screen (no .projects-popup, uses Tailwind fixed overlay) */
  .project-generate > div[class*="fixed"][class*="inset-0"][class*="z-"] {
    padding: 16px !important;
    box-sizing: border-box !important;
  }
  .project-generate > div[class*="fixed"][class*="inset-0"][class*="z-"] > div {
    max-width: 360px !important;
    width: 100% !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    border-radius: 20px !important;
    padding: 24px 16px !important;
    box-sizing: border-box !important;
  }
  /* Compact AI choice cards on mobile */
  .project-generate > div[class*="fixed"][class*="inset-0"][class*="z-"] button[class*="min-h-"] {
    min-height: 140px !important;
    padding: 20px 12px !important;
  }

  /* ---- PROJECTS DROPDOWN (My Projects) — mobile centered card ---- */
  .project-generate-menu-projects {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100vw - 32px) !important;
    max-width: 400px !important;
    height: auto !important;
    max-height: 80vh !important;
    border-radius: 24px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
    z-index: 300025 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px !important;
    background: #fff !important;
    margin-top: 0 !important;
  }
  .project-generate-menu-projects__title {
    font-size: 17px !important;
    font-weight: 700 !important;
    padding: 0 0 16px 0 !important;
    color: #1a1a1a !important;
    text-align: center !important;
  }
  .project-generate-menu-projects__layout {
    gap: 10px !important;
  }
  .project-generate-menu-projects__element {
    border-radius: 14px !important;
    margin-bottom: 0 !important;
    padding: 12px !important;
    border: 1.5px solid #e8e3da !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    background: #fff !important;
    min-height: 80px !important;
  }
  .project-generate-menu-projects__element:hover {
    border: 2px dashed #FCB620 !important;
    background: #FFFDF7 !important;
    box-shadow: 0 2px 8px rgba(252, 182, 32, 0.12) !important;
  }
  /* Image container */
  .project-generate-menu-projects-element__conteiner {
    flex-shrink: 0 !important;
    width: 80px !important;
    height: 56px !important;
    min-width: 80px !important;
    border-radius: 10px !important;
    border: none !important;
    padding: 0 !important;
    background: #f0f0f0 !important;
  }
  .project-generate-menu-projects-element__image {
    width: 100% !important;
    height: 100% !important;
    border-radius: 10px !important;
    object-fit: cover !important;
    background: #f0f0f0 !important;
    border: none !important;
  }
  /* Right column (title + row) */
  .project-generate-menu-projects-element__column {
    min-width: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding-left: 0 !important;
    justify-content: center !important;
  }
  .project-generate-menu-projects-element__title {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding-bottom: 0 !important;
  }
  /* Bottom row: date + badge */
  .project-generate-menu-projects-element__row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
  }
  .project-generate-menu-projects-element__date {
    font-size: 12px !important;
    color: #a0a0a0 !important;
    white-space: nowrap !important;
  }
  /* Hide separator */
  .project-generate-menu-projects-element__date:nth-child(2) {
    display: none !important;
  }
  .project-generate-menu-projects-element__visibility {
    font-size: 11px !important;
    padding: 4px 14px !important;
    border-radius: 20px !important;
    background: #FCB620 !important;
    color: #fff !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    text-transform: lowercase !important;
  }

  /* ---- SHAPES POPUP — small floating popup (like desktop) ---- */
  .ie-shapes-popup {
    max-width: 220px !important;
    width: 220px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12) !important;
    z-index: 300010 !important;
    padding: 8px !important;
    background: #fff !important;
  }

  /* ---- LAYERS PANEL — Figma style card ---- */
  .ie-layers-panel {
    position: fixed !important;
    bottom: auto !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    max-width: 320px !important;
    width: calc(100vw - 40px) !important;
    max-height: 80vh !important;
    border-radius: 20px !important;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1) !important;
    z-index: 300020 !important;
    background: #fff !important;
    padding: 20px !important;
    gap: 20px !important;
  }

  /* ---- MUSE AI PANEL — Figma style card ---- */
  .ie-muse-panel {
    width: 320px !important;
    max-width: calc(100vw - 40px) !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    border-radius: 20px !important;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1) !important;
    z-index: 300020 !important;
    background: #fff !important;
    padding: 20px !important;
    gap: 20px !important;
  }

  /* ---- CONTEXT MENU ---- */
  .ie-context-menu {
    max-width: calc(100vw - 20px) !important;
    z-index: 300010 !important;
  }

  /* ---- RESIZE MODAL — Figma 320px card ---- */
  .ie-resize-modal-overlay {
    align-items: center !important;
    justify-content: center !important;
  }
  .ie-resize-modal {
    width: 320px !important;
    max-width: calc(100vw - 40px) !important;
    border-radius: 20px !important;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1) !important;
    padding: 20px !important;
  }

  /* ---- CART MODAL — Figma 320px card ---- */
  .ie-cart-modal-overlay {
    align-items: center !important;
    justify-content: center !important;
  }
  .ie-cart-modal {
    width: 320px !important;
    max-width: calc(100vw - 40px) !important;
    border-radius: 20px !important;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1) !important;
    padding: 20px !important;
  }

  /* ---- DOWNLOAD MODAL — Figma 320px centered card ---- */
  .ie-download-modal-overlay {
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
  }
  .ie-download-modal {
    width: 320px !important;
    max-width: calc(100vw - 40px) !important;
    max-height: 80vh !important;
    border-radius: 20px !important;
    padding: 20px !important;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1) !important;
    gap: 10px !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .ie-download-modal-header {
    margin-bottom: 14px !important;
    padding: 8px 0 8px !important;
    top: -20px !important;
    flex-shrink: 0 !important;
  }
  .ie-download-modal-cards {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    min-height: 0 !important;
  }
  .ie-download-modal-title {
    font-size: 16px !important;
  }
  .ie-download-modal-close {
    font-size: 22px !important;
  }
  .ie-download-modal-cards {
    gap: 14px !important;
  }
  .ie-download-modal-card {
    flex-direction: row !important;
    gap: 12px !important;
    padding: 14px !important;
    border-radius: 14px !important;
    border: 1px solid #eee !important;
    background: #fff !important;
    align-items: flex-start !important;
  }
  .ie-download-modal-card-preview {
    width: 100px !important;
    min-width: 100px !important;
    min-height: 70px !important;
    max-height: 100px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }
  .ie-download-modal-card-info {
    gap: 2px !important;
    flex: 1 !important;
  }
  .ie-download-modal-card-format {
    font-size: 12px !important;
  }
  .ie-download-modal-card-id {
    font-size: 14px !important;
    font-weight: 700 !important;
  }
  .ie-download-modal-card-meta {
    font-size: 11px !important;
  }
  .ie-download-modal-card-btn {
    font-size: 12px !important;
    padding: 8px 14px !important;
    border-radius: 20px !important;
    width: 100% !important;
    text-align: center !important;
  }

  /* ---- PROJECT CREATE/EDIT FORM ---- */
  .projects-popup:has(.projects-create-layout) .projects {
    width: 100% !important;
    max-width: 360px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .projects-popup:has(.projects-create-layout) .projects-block-layout,
  .projects-popup:has(.projects-create-layout) .projects-create-layout {
    width: 100% !important;
    max-width: 360px !important;
    max-height: 75vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 20px !important;
    padding: 40px 16px 16px !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    position: relative !important;
    background: #fff !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
  }
  /* Show AI choice cards on mobile — NOTE: global hide rules come later,
     so we double the selector to win specificity over global .project-generate ... !important */
  .projects-popup .project-generate .projects-create-layout .ai-choice-container {
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  .projects-popup .project-generate .projects-create-layout .ai-choice-container > * {
    border-radius: 16px !important;
    padding: 16px !important;
    border: 1px solid #f0e6d0 !important;
  }
  /* Show title on mobile (overrides global hide for AI auto-select) */
  .projects-popup .project-generate .projects-create-layout .projects-create-title {
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 0 10px !important;
    padding: 0 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-align: center !important;
  }
  .projects-popup .projects-create-title {
    font-size: 16px !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
  }
 
  .projects-popup .projects-create-form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    gap: 10px !important;
  }
  .projects-popup .projects-create-form input,
  .projects-popup .projects-create-form textarea {
    border-radius: 12px !important;
    border: 1px solid #F0E6D0 !important;
    background: #FFF8E7 !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
  }
  .projects-popup .projects-create-form textarea {
    min-height: 60px !important;
    resize: vertical !important;
  }
  .projects-popup .projects-create-form label {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #222 !important;
    margin-bottom: 4px !important;
  }
  /* Visibility toggle row */
  .projects-popup .projects-create-form .projects-create-visibility,
  .projects-popup .projects-create-form [class*="visibility"] {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 0 !important;
  }
  /* Additional section (Стиль / Помещение) */
  .projects-popup .projects-create-additional {
    border-top: none !important;
    padding-top: 4px !important;
  }
  .projects-popup .projects-create-additional-button,
  .projects-popup .projects-create-additional__button {
    font-size: 14px !important;
    text-align: center !important;
    cursor: pointer !important;
    padding: 8px 0 !important;
    color: #555 !important;
  }
  .projects-popup .projects-create-additional__layout {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }
  .projects-popup .projects-create-additional-radio,
  .projects-popup .projects-create-additional__layout label {
    padding: 8px 0 !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
  }
  .projects-popup .projects-create-additional-radio input[type="radio"],
  .projects-popup .projects-create-additional__layout input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
    accent-color: #FCB620 !important;
    flex-shrink: 0 !important;
  }
  /* Radio selected state — orange dot */
  .projects-popup .projects-create-additional-radio input[type="radio"]:checked {
    accent-color: #FCB620 !important;
  }
  .projects-popup .button.button_primary {
    border-radius: 24px !important;
    height: 48px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    background: #FCB620 !important;
    color: #343434 !important;
  }
  /* Delete project button */
  .projects-popup .projects-create-delete,
  .projects-popup [class*="delete-project"],
  .projects-popup .projects-create-remove {
    text-align: center !important;
    padding: 12px 0 4px !important;
    font-size: 14px !important;
    color: #555 !important;
  }

  /* ---- AI GENERATOR POPUP — Figma style (320px card) ---- */
  .projects-popup:has(.ai-generator-layout) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
  }
  .projects-popup:has(.ai-generator-layout) .projects-block-layout,
  .projects-popup:has(.ai-generator-layout) .projects-create-layout {
    width: 320px !important;
    max-width: calc(100vw - 40px) !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    border-radius: 20px !important;
    padding: 20px !important;
    margin: 0 auto !important;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1) !important;
    gap: 20px !important;
  }
  .projects-popup:has(.ai-generator-layout) .ai-generator-icon {
    width: 28px !important;
    height: 28px !important;
    margin-bottom: 4px !important;
  }
  .projects-popup:has(.ai-generator-layout) .ai-generator-title {
    font-size: 18px !important;
    line-height: 26px !important;
    font-weight: 700 !important;
  }
  .projects-popup:has(.ai-generator-layout) .ai-generator-description {
    font-size: 13px !important;
    line-height: 145% !important;
    color: #555 !important;
    margin-bottom: 12px !important;
  }
  .projects-popup:has(.ai-generator-layout) .ai-generator-input {
    height: 70px !important;
    font-size: 13px !important;
    padding: 12px 14px !important;
    border-radius: 14px !important;
    border: 1px solid #F0E6D0 !important;
    background: #FFF8E7 !important;
  }
  .projects-popup:has(.ai-generator-layout) .ai-generator-layout > .button {
    border-radius: 24px !important;
    height: 48px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    background: #FCB620 !important;
    color: #343434 !important;
    margin-top: 8px !important;
  }

  /* ---- GOODS POPUP (Add product) — mobile centered card ---- */
  .goods-popup {
    z-index: 300010 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: fixed !important;
    inset: 0 !important;
    pointer-events: auto !important;
    background: rgba(52, 52, 52, 0.45) !important;
  }
  .goods-popup .goods {
    width: 100% !important;
    max-width: calc(100vw - 32px) !important;
    display: flex !important;
    justify-content: center !important;
  }
  .goods-popup .goods-layout {
    width: 100% !important;
    max-width: 360px !important;
    height: auto !important;
    max-height: 85vh !important;
    border-radius: 20px !important;
    padding: 20px 16px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    flex-direction: column !important;
    background: #fff !important;
    pointer-events: auto !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    gap: 12px !important;
  }

  /* --- Header --- */
  .goods-popup .goods-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }
  .goods-popup .goods-header-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #2E2E2E !important;
  }
  .goods-popup .goods-header .popup-close,
  .goods-popup .goods-header .filter-popup__close {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    background-color: #f0f0f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* --- Content area — reorder children via display:contents --- */
  .goods-popup .goods-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    min-height: 0 !important;
    flex: 1 !important;
    padding: 0 !important;
  }
  .goods-popup .goods-content-left {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 12px !important;
  }
  .goods-popup .goods-content-right {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 12px !important;
  }
  /* Use display:contents only when supported (modern browsers) */
  @supports (display: contents) {
    .goods-popup .goods-content-left {
      display: contents !important;
    }
    .goods-popup .goods-content-right {
      display: contents !important;
    }
  }

  /* --- Tabs (Категории / Избранное) — order 1 --- */
  .goods-popup .goods-content-left-category {
    order: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 40px !important;
    border-radius: 24px !important;
    padding: 4px !important;
    box-sizing: border-box !important;
    background: #FCB62030 !important;
    display: flex !important;
    gap: 0 !important;
    flex-shrink: 0 !important;
  }
  .goods-popup .goods-content-left-category-button {
    flex: 1 !important;
    text-align: center !important;
    padding: 8px 12px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    cursor: pointer !important;
    color: #2E2E2E !important;
  }
  .goods-popup .goods-content-left-category-button__active {
    background: #FCB620 !important;
    color: #fff !important;
    border-radius: 20px !important;
    padding: 8px 12px !important;
    font-weight: 600 !important;
  }

  /* --- Search — order 2 --- */
  .goods-popup .goods-content-right-search-container {
    order: 2 !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    position: relative !important;
  }
  .goods-popup .goods-content-right-search {
    height: 42px !important;
    border-radius: 12px !important;
    padding: 10px 40px !important;
    font-size: 12px !important;
    background: #FFFBF2 !important;
    border: 1px solid #f0e6d0 !important;
  }
  .goods-popup .goods-content-right-search-icon {
    left: 12px !important;
    width: 18px !important;
    height: 18px !important;
    background-size: contain !important;
  }
  .goods-popup .goods-content-right-search-clear {
    right: 12px !important;
    width: 18px !important;
    height: 18px !important;
    background-size: contain !important;
  }

  /* --- Category menu — order 3 --- */
  .goods-popup .goods-content-left-menu {
    order: 3 !important;
    width: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    flex: 1 !important;
    margin-top: 0 !important;
  }
  /* "Выберите категорию" label above category list */
  .goods-popup .goods-content-left-menu::before {
    content: "Выберите категорию" !important;
    display: block !important;
    font-family: Rubik, sans-serif !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    color: #2E2E2E !important;
    margin-bottom: 8px !important;
    padding: 0 4px !important;
  }

  /* Category container */
  .goods-popup .project-generate-menu-conteiner {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    height: auto !important;
    align-items: stretch !important;
    padding-bottom: 0 !important;
    overflow-x: hidden !important;
  }

  /* Category items */
  .goods-popup .project-generate-menu-item {
    padding: 10px 8px !important;
    border-radius: 12px !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
  }
  .goods-popup .project-generate-menu-item__container {
    gap: 10px !important;
  }
  .goods-popup .project-generate-menu-item__image {
    width: 36px !important;
    height: 36px !important;
    margin-right: 0 !important;
    border-radius: 8px !important;
    object-fit: cover !important;
    background: #f5f5f5 !important;
    flex-shrink: 0 !important;
  }
  .goods-popup .project-generate-menu-item__title {
    font-size: 14px !important;
    line-height: 1.3 !important;
    color: #343434 !important;
    width: auto !important;
  }
  .goods-popup .project-generate-menu-item__icon {
    width: 8px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
    opacity: 0.4 !important;
  }
  .goods-popup .project-generate-menu-item svg {
    display: block !important;
  }
  .goods-popup .project-generate-menu-item__active {
    background-color: #FCB62040 !important;
    border-radius: 12px !important;
  }

  /* Back button in subcategories */
  .goods-popup .project-generate-menu-item-back__container {
    position: relative !important;
    left: auto !important;
    transform: none !important;
    padding: 8px 4px !important;
    margin-bottom: 4px !important;
    cursor: pointer !important;
  }
  .goods-popup .project-generate-menu-item-back__icon {
    width: 8px !important;
    height: 14px !important;
  }
  .goods-popup .project-generate-menu-item-back__title {
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
  }

  /* --- Products layout — order 4 --- */
  .goods-popup .goods-content-right-layout {
    order: 4 !important;
    width: 100% !important;
  }

  /* Product header: title, count, sort */
  .goods-popup .goods-content-right-layout-header {
    padding: 4px 0 !important;
    gap: 6px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .goods-popup .goods-content-right-layout-header__block {
    flex-direction: column !important;
    width: 100% !important;
  }
  .goods-popup .goods-content-right-layout-header__title-container {
    min-width: 0 !important;
    width: 100% !important;
    gap: 8px !important;
    align-items: baseline !important;
  }
  .goods-popup .goods-content-right-layout-header__title {
    font-size: 18px !important;
    line-height: 1.2 !important;
  }
  .goods-popup .goods-content-right-layout-header__count {
    font-size: 12px !important;
  }
  .goods-popup .goods-content-right-layout-header__count-small {
    font-size: 11px !important;
  }
  .goods-popup .goods-content-right-layout-header__sort {
    font-size: 12px !important;
    justify-content: flex-start !important;
    width: 100% !important;
    line-height: 1.4 !important;
    flex-wrap: nowrap !important;
  }
  .goods-popup .goods-content-right-layout-header__sort-title {
    font-size: 12px !important;
    padding-right: 4px !important;
    white-space: nowrap !important;
  }
  .goods-popup .goods-content-right-layout-header__sort-value {
    font-size: 12px !important;
    color: #FCB620 !important;
    white-space: nowrap !important;
  }
  .goods-popup .goods-content-right-layout-header__sort-list {
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    z-index: 20 !important;
    right: 0 !important;
    left: auto !important;
  }
  .goods-popup .goods-content-right-layout-header__sort-element {
    padding: 8px 14px !important;
    font-size: 13px !important;
  }

  /* Share button — hide on mobile */
  .goods-popup .goods-content-right-layout-header-share {
    display: none !important;
  }

  /* Product content area */
  .goods-popup .goods-content-right-layout-content {
    max-height: none !important;
    overflow-y: visible !important;
    gap: 10px !important;
    padding: 0 !important;
  }

  /* Product grid — force 2 columns */
  .goods-popup .project-generate-goods-content-area {
    gap: 10px !important;
  }
  .goods-popup .project-generate-goods-content,
  .goods-popup .project-generate-goods-content-4,
  .goods-popup .project-generate-goods-content-undef {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Product cards */
  .goods-popup .product-cart {
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
    gap: 6px !important;
  }
  .goods-popup .product-cart-image {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 !important;
    border-radius: 10px !important;
    object-fit: cover !important;
    background-color: #f3f3f3 !important;
  }
  .goods-popup .product-cart-image-likes {
    top: 8px !important;
    right: 8px !important;
    min-width: 28px !important;
    height: 28px !important;
    padding: 0 5px !important;
  }
  .goods-popup .product-cart-image-title {
    font-size: 11px !important;
    line-height: 1.3 !important;
    color: #858585 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    padding: 0 4px !important;
  }
  .goods-popup .product-cart-image-price {
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    color: #2E2E2E !important;
    padding: 0 4px !important;
  }
  .goods-popup .product-cart-image-button {
    height: 34px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    background: #FCB620 !important;
    color: #343434 !important;
    border: none !important;
    margin: 2px 4px 4px !important;
  }
  .goods-popup .product-cart-image-button.button.button_primary_white {
    background: #FCB620 !important;
    color: #343434 !important;
    border: none !important;
  }

  /* ---- PRODUCT POPUP (Купить товар) ---- */

  /* ======================================================================
     GOODS POPUP STEP NAVIGATION — show/hide based on navigation step
     Step 1/2 (categories/subcategories): show left panel, hide products
     Step 3 (products): show products, hide category menu
     Favorites: show products directly
     ====================================================================== */

  /* Default state (categories): hide product listing */
  .goods-popup .goods-content-right-layout {
    display: none !important;
  }

  /* When in products step: show products, hide category menu */
  .goods-popup.ie-goods-step-products .goods-content-right-layout {
    display: flex !important;
  }
  .goods-popup.ie-goods-step-products .goods-content-left-menu {
    display: none !important;
  }
  /* Keep search visible in products step */
  .goods-popup.ie-goods-step-products .goods-content-right-search-container {
    display: block !important;
  }
  /* Hide category tabs when viewing products (not favorites) */
  .goods-popup.ie-goods-step-products:not(.ie-goods-favorites) .goods-content-left-category {
    display: none !important;
  }

  /* Back button to categories */
  .ie-goods-back-to-categories {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 4px !important;
    margin-bottom: 4px !important;
    cursor: pointer !important;
    font-family: Rubik, sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #2E2E2E !important;
    order: 2 !important;
    -webkit-tap-highlight-color: transparent !important;
    flex-shrink: 0 !important;
  }
  .ie-goods-back-to-categories svg {
    width: 8px !important;
    height: 14px !important;
    transform: rotate(180deg) !important;
    opacity: 0.5 !important;
  }
  .ie-goods-back-to-categories:active {
    opacity: 0.6 !important;
  }

  /* Hide back button when not in products step */
  .goods-popup:not(.ie-goods-step-products) .ie-goods-back-to-categories {
    display: none !important;
  }

  /* Transition for smooth step switching */
  .goods-popup .goods-content-left-menu,
  .goods-popup .goods-content-right-layout {
    transition: opacity 0.15s ease !important;
  }

  .popup:has(.product-popup-layout) .projects-block-layout {
    border-radius: 20px !important;
    padding: 16px !important;
  }
  .product-popup-layout {
    flex-direction: column !important;
    gap: 12px !important;
  }

  /* ---- BACKDROP ---- */
  .ie-backdrop-overlay {
    z-index: 299999 !important;
  }
}

/* ---- Phone portrait (max-width: 480px) ---- */
@media (max-width: 480px) {
  /* Header — compact but readable (small phone) */
  .project-generate-header {
    padding: 5px 10px !important;
    border-radius: 70px !important;
    margin: 4px auto 2px !important;
    gap: 0 !important;
    background: radial-gradient(64.44% 209.98% at 43.25% 49.99%, rgba(255, 178, 0, 0.4) 0%, rgba(255, 242, 211, 0.4) 69.71%, rgba(255, 255, 255, 0.4) 93.75%) !important;
    box-shadow: 0px 20px 30px rgba(0, 0, 0, 0.1) !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }
  .project-generate-header__logo {
    width: 80px !important;
    min-width: 60px !important;
    height: 16px !important;
  }
  .project-generate-header-button {
    height: 30px !important;
    padding: 4px 8px !important;
    font-size: 9px !important;
    border-radius: 8px !important;
    gap: 5px !important;
    min-height: 30px !important;
  }
  .project-generate-header-button__primary,
  .project-generate .project-generate-header-button.project-generate-header-button__secondary {
    height: 30px !important;
  }
  .project-generate-header-button__primary::before,
  .project-generate .project-generate-header-button.project-generate-header-button__secondary::before {
    width: 13px !important;
    height: 13px !important;
  }

  /* Menu bar — tighter */
  .project-generate-left__menu {
    padding: 0 6px !important;
    margin-top: 2px !important;
  }
  
  .project-generate-left-menu__element {
    font-size: 12px !important;
    gap: 4px !important;
    min-height: 44px !important;
  }
  .project-generate-left-menu__element[data-ie-menu]::before {
    width: 18px !important;
    height: 18px !important;
    background-size: contain !important;
  }
  .project-generate-left-menu__top {
    padding: 3px 8px !important;
    border-radius: 12px !important;
    margin: 0 2px !important;
  }

  /* Canvas — less top padding */
  .project-container-scroll {
    padding-top: 50px !important;
  }

  /* Bottom toolbar — smaller */
  .project-generate-left__buttons-layout,
  .project-generate-left__buttons-layout[data-ie-redesigned4] {
    bottom: 0 !important;
    padding: 4px 10px !important;
    border-radius: 18px !important;
    min-height: 44px !important;
  }
  .project-generate-left__buttons-layout .project-generate-left-buttons-container {
    max-width: 40px !important;
  }

  /* Overlay toolbars */
  #ie-toolbar,
  #ie-shape-toolbar,
  #ie-text-toolbar {
    border-radius: 10px !important;
    padding: 3px 6px !important;
    font-size: 11px !important;
    bottom: auto !important;
  }
  #ie-toolbar .ie-btn,
  #ie-text-toolbar .ie-btn,
  #ie-shape-toolbar .ie-btn,
  #ie-text-toolbar .ie-text-style-btn {
    min-width: 26px !important;
    height: 26px !important;
    padding: 2px !important;
  }
  #ie-text-toolbar .ie-font-select {
    max-width: 80px !important;
    font-size: 11px !important;
    padding: 2px 4px !important;
    height: 26px !important;
  }
  .ie-font-select {
    max-width: 80px !important;
    font-size: 11px !important;
  }
  .ie-color-input {
    width: 24px !important;
    height: 24px !important;
  }
  #ie-text-toolbar .ie-color-input {
    width: 24px !important;
    height: 24px !important;
  }

  /* Projects dropdown — smaller phone adjustments */
  .project-generate-menu-projects {
    padding: 16px 12px !important;
    border-radius: 20px !important;
    max-height: 75vh !important;
  }
  .project-generate-menu-projects__title {
    font-size: 16px !important;
    padding: 0 0 12px 0 !important;
  }
  .project-generate-menu-projects__layout {
    gap: 8px !important;
  }
  .project-generate-menu-projects__element {
    padding: 10px !important;
    gap: 10px !important;
    border-radius: 12px !important;
    min-height: 70px !important;
  }
  .project-generate-menu-projects-element__conteiner {
    width: 70px !important;
    height: 48px !important;
    min-width: 70px !important;
    border-radius: 8px !important;
  }
  .project-generate-menu-projects-element__title {
    font-size: 13px !important;
  }
  .project-generate-menu-projects-element__date {
    font-size: 11px !important;
  }
  .project-generate-menu-projects-element__visibility {
    font-size: 10px !important;
    padding: 3px 10px !important;
  }
}

/* ---- Very small phones (360px) ---- */
@media (max-width: 360px) {
  .project-generate-header {
    padding: 4px 8px !important;
    border-radius: 20px !important;
    background: radial-gradient(64.44% 209.98% at 43.25% 49.99%, rgba(255, 178, 0, 0.4) 0%, rgba(255, 242, 211, 0.4) 69.71%, rgba(255, 255, 255, 0.4) 93.75%) !important;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1) !important;
    height: auto !important;
    max-height: none !important;
  }
  .project-generate-header__logo {
    width: 90px !important;
    min-width: 75px !important;
  }
  .project-generate-header-button {
    height: 30px !important;
    padding: 4px 6px !important;
    font-size: 9px !important;
    min-height: 44px !important;
  }
 
  .project-generate-left-menu__element {
    font-size: 11px !important;
    gap: 3px !important;
    min-height: 44px !important;
  }
  .project-generate-right {
    width: 160px !important;
  }
  .project-generate-right__goods {
    grid-template-columns: 1fr !important;
  }
  #ie-toolbar .ie-btn,
  #ie-text-toolbar .ie-btn,
  #ie-shape-toolbar .ie-btn {
    min-width: 24px !important;
    height: 24px !important;
  }

  .project-generate-left__buttons-layout,
  .project-generate-left__buttons-layout[data-ie-redesigned4] {
    bottom: 0 !important;
    min-height: 40px !important;
    padding: 3px 8px !important;
  }
  /* Goods popup — tighter on small screens */
  .goods-popup .goods-header {
    padding: 14px 12px 8px !important;
  }
  .goods-popup .goods-header-title {
    font-size: 16px !important;
  }
  .goods-popup .goods-buttons {
    padding: 0 12px !important;
  }
  .goods-popup .goods-search {
    padding: 0 12px !important;
  }
  .goods-popup .goods-content {
    padding: 0 12px 12px !important;
  }
  .goods-popup .add-good-grid {
    gap: 8px !important;
  }

  /* ---- Image selection popup (goods-popup-small) — compact card on mobile ---- */
  .goods-popup.goods-popup-small {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.45) !important;
    z-index: 300010 !important;
  }
  .goods-popup.goods-popup-small .goods {
    width: 100% !important;
    max-width: calc(100vw - 32px) !important;
    display: flex !important;
    justify-content: center !important;
  }
  .goods-popup.goods-popup-small .add-good-layout {
    width: 100% !important;
    max-width: 380px !important;
    max-height: 80vh !important;
    padding: 16px !important;
    border-radius: 20px !important;
    gap: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .goods-popup.goods-popup-small .goods-header {
    padding: 0 !important;
    flex-shrink: 0 !important;
  }
  .goods-popup.goods-popup-small .goods-header-title {
    font-size: 15px !important;
    font-weight: 600 !important;
  }
  .goods-popup.goods-popup-small .goods-header .filter-popup__close {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: #f0f0f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .goods-popup.goods-popup-small .add-good-content {
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow: hidden !important;
  }
  .goods-popup.goods-popup-small .add-good-grid-layout {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 0 !important;
  }
  .goods-popup.goods-popup-small .add-good-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .goods-popup.goods-popup-small .add-good-grid-element {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1.14 !important;
  }
  .goods-popup.goods-popup-small .add-good-content > .button {
    flex-shrink: 0 !important;
    width: 100% !important;
    padding: 12px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    background: #FCB620 !important;
    color: #343434 !important;
    border: none !important;
    cursor: pointer !important;
  }
}

/* ======================================================================
   Task 3: "Новый проект" button — re-enabled by request.
   ====================================================================== */
/* Новый проект button — Figma: #FFFFFF, border-radius 10px, color #694F12, no border */
.project-generate .project-generate-header-button.project-generate-header-button__secondary {
  display: flex !important;
  background: #FFFFFF !important;
  border: none !important;
  border-radius: 14px !important;
  color: #694F12 !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  line-height: 16px !important;
  padding: 10px 20px !important;
  gap: 10px !important;
  height: 48px !important;
  white-space: nowrap !important;
  transition: background 0.2s ease !important;
}
.project-generate .project-generate-header-button.project-generate-header-button__secondary:active {
  background: #f5f0e5 !important;
  transform: scale(0.98) !important;
}
.project-generate .project-generate-header-button.project-generate-header-button__secondary:focus-visible {
  outline: 2px solid #FFB200 !important;
  outline-offset: 2px !important;
}

/* ======================================================================
   MOBILE: Close button in projects dropdown
   ====================================================================== */
.ie-projects-close-btn {
  display: none;
}
@media (max-width: 768px) {
  .ie-projects-close-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    background: #f5f5f5 !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: #666 !important;
    z-index: 10 !important;
    padding: 0 !important;
    transition: background 0.15s, color 0.15s !important;
  }
  .ie-projects-close-btn:hover,
  .ie-projects-close-btn:active {
    background: #e8e8e8 !important;
    color: #333 !important;
  }
  /* Ensure the dropdown is positioned relative for the absolute close button */
  .project-generate-menu-projects {
    position: fixed !important;
  }
}

/* ======================================================================
   MOBILE/TABLET: Close button in goods popup
   ====================================================================== */
.ie-goods-close-btn {
  display: none;
}
@media (max-width: 1024px) {
  .ie-goods-close-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: fixed !important;
    top: 16px !important;
    right: 16px !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 50% !important;
    background: rgba(0,0,0,0.55) !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 26px !important;
    line-height: 1 !important;
    color: #fff !important;
    z-index: 300020 !important;
    padding: 0 !important;
    transition: background 0.15s !important;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  .ie-goods-close-btn:hover,
  .ie-goods-close-btn:active {
    background: rgba(0,0,0,0.75) !important;
  }
}
/* Hide floating close on mobile — the in-popup header close is visible */
@media (max-width: 600px) {
  .ie-goods-close-btn {
    display: none !important;
  }
}

/* ======================================================================
   MOBILE: Resize handles — larger touch targets
   ====================================================================== */
@media (max-width: 768px) {
  .ie-resize-handle {
    min-width: 20px !important;
    min-height: 20px !important;
  }
  .ie-rotate-handle {
    width: 32px !important;
    height: 32px !important;
  }
  /* Prevent default touch behaviors on handles */
  .ie-resize-handle,
  .ie-rotate-handle {
    touch-action: none !important;
  }
}

/* ======================================================================
   MOBILE: Goods counter clone styling
   ====================================================================== */
@media (max-width: 768px) {
  /* Goods clone: visually move from header to project name row */
  .ie-mobile-goods-clone {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 13px !important;
    color: #343434 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 4px 12px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    height: 32px !important;
    line-height: 32px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    font-weight: 600 !important;
    /* Position: absolute within header, aligned to project name row below */
    position: absolute !important;
    bottom: -86px !important;
    right: 0 !important;
    z-index: 10 !important;
    justify-content: flex-end !important;
    pointer-events: auto !important; /* ensure goods clone is always clickable */
  }
  .ie-mobile-goods-clone svg {
    display: none !important;
  }
  .ie-mobile-goods-clone img {
    flex-shrink: 0 !important;
    width: 16px !important;
    height: 16px !important;
  }
  .ie-mobile-goods-clone span {
    display: inline !important;
  }
  .ie-mobile-goods-clone:active {
    color: #2d3748 !important;
  }
}
.project-generate .project-generate-header-button.project-generate-header-button__secondary:hover {
  background: #f5f0e5 !important;
}
/* Hide original SVG in New Project button, replace with PNG icon */
.project-generate .project-generate-header-button.project-generate-header-button__secondary > svg {
  display: none !important;
}
/* Icon */
.project-generate .project-generate-header-button.project-generate-header-button__secondary::before {
  content: '';
  display: inline-block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: url("/static/media/Vector%20(7).png") no-repeat center / contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ======================================================================
   Task 4: Hide AI choice container — auto-selected by JS, no flash
   ====================================================================== */
.project-generate .projects-create-layout .ai-choice-container {
  opacity: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}
.project-generate .projects-create-layout .projects-create-title {
  opacity: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ======================================================================
   MOBILE BACK BUTTON — orange circle with left arrow (opens project menu)
   ====================================================================== */
.ie-mobile-back-btn {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
}
@media (max-width: 768px) {
  .ie-mobile-back-btn {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
  }
}
@media (max-width: 480px) {
  .ie-mobile-back-btn {
    display: none !important;
    visibility: hidden !important;
  }
  .ie-mobile-back-btn svg {
    width: 14px !important;
    height: 14px !important;
  }
}

/* ======================================================================
   GOODS POPUP FIX — ensure content is always visible above everything
   Higher specificity overrides to beat body.ie-popup-open rules
   ====================================================================== */
body.ie-popup-open .goods-popup,
body.ie-popup-open .goods-popup *,
body.ie-popup-open .goods-popup .goods-layout,
body.ie-popup-open .goods-popup .goods-header,
body.ie-popup-open .goods-popup .goods-content,
body.ie-popup-open .goods-popup .goods-buttons,
body.ie-popup-open .goods-popup .goods-search,
body.ie-popup-open .goods-popup button,
body.ie-popup-open .goods-popup a,
body.ie-popup-open .goods-popup input {
  pointer-events: auto !important;
}
.goods-popup {
  z-index: 300010 !important;
}
.goods-popup .goods-layout {
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  min-height: 200px !important;
}

/* ======================================================================
   TOOLBAR FLICKER FIX — smoother transitions to prevent flash
   ====================================================================== */
@media (min-width: 601px) {
  #ie-toolbar,
  #ie-text-toolbar,
  #ie-shape-toolbar {
    transition: opacity .12s ease, visibility .12s ease !important;
    will-change: opacity;
  }
}

/* Remove extra backgrounds on mobile toolbars (clean minimal look) */
@media (max-width: 768px) {
  #ie-shape-toolbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
  }
  #ie-shape-toolbar .ie-toolbar-label {
    background: transparent !important;
  }
  #ie-shape-toolbar .ie-number-input,
  #ie-shape-toolbar .ie-color-input {
    background: #fff !important;
  }
}
