/* ============================================================
   MAKON LISTING IMAGE CONTRACT — PHASE 1
   2026-08-19
   One stable geometry for Listing.photo everywhere it matters.
   This file is intentionally isolated from legacy CSS.
   ============================================================ */

:root {
  --makon-listing-media-ratio: 4 / 3;
  --makon-listing-media-bg: #f5f7f3;
}

/* PUBLIC HOME ------------------------------------------------ */
body.home-page .listing-card-home .home-card-media {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: var(--makon-listing-media-ratio) !important;
  overflow: hidden !important;
  background: var(--makon-listing-media-bg) !important;
}

body.home-page .listing-card-home .home-card-media > img,
body.home-page .listing-card-home .home-card-media > .no-image {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover !important;
  object-position: 50% 50% !important;
}

/* Old/broken images still use the existing fallback behaviour. */
body.home-page .listing-card-home .home-card-media.has-fallback-image > img {
  object-fit: contain !important;
  padding: 10% !important;
  box-sizing: border-box !important;
}

/* Kill legacy phone/tablet height clamps. The ratio is the contract. */
@media (max-width: 920px) {
  body.home-page .listing-card-home .home-card-media {
    height: auto !important;
    aspect-ratio: var(--makon-listing-media-ratio) !important;
  }
}

@media (max-width: 540px) {
  body.home-page .listing-card-home .home-card-media {
    height: auto !important;
    aspect-ratio: var(--makon-listing-media-ratio) !important;
  }
}

/* BUSINESS DASHBOARD ---------------------------------------- */
#listings .business-listing-media,
#companyProfile .business-listing-media,
.company-mini-listings .business-listing-media,
#myListings .business-listing-media {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: var(--makon-listing-media-ratio) !important;
  overflow: hidden !important;
  background: var(--makon-listing-media-bg) !important;
}

#listings .business-listing-media > img,
#companyProfile .business-listing-media > img,
.company-mini-listings .business-listing-media > img,
#myListings .business-listing-media > img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover !important;
  object-position: 50% 50% !important;
}

/* Upload/crop preview --------------------------------------- */
#addListingForm .makon-listing-photo-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(220px, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: -2px;
  padding: 16px;
  border: 1px solid rgba(24, 72, 39, .10);
  border-radius: 18px;
  background: rgba(248, 252, 246, .86);
}

#addListingForm .makon-listing-photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: var(--makon-listing-media-ratio);
  overflow: hidden;
  border: 1px solid rgba(21, 128, 61, .16);
  border-radius: 16px;
  background:
    linear-gradient(45deg, rgba(22, 163, 74, .035) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, rgba(22, 163, 74, .035) 25%, transparent 25%) 0 9px / 18px 18px,
    #f6f8f4;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

#addListingForm .makon-listing-photo-frame.is-empty {
  cursor: default;
}

#addListingForm .makon-listing-photo-frame.is-existing {
  cursor: default;
}

#addListingForm .makon-listing-photo-frame.is-existing .makon-listing-photo-focus {
  display: none;
}

#addListingForm .makon-listing-photo-canvas {
  position: absolute !important;
  z-index: 1 !important;
  inset: 0 !important;
  display: none !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f8f9f7 !important;
  object-fit: fill !important;
  pointer-events: none !important;
}

#addListingForm .makon-listing-photo-frame.has-image > .makon-listing-photo-canvas {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#addListingForm .makon-listing-photo-frame.has-image .makon-listing-photo-empty {
  display: none !important;
}

#addListingForm .makon-listing-photo-frame.is-empty .makon-listing-photo-empty {
  display: grid !important;
}

#addListingForm .makon-listing-photo-empty {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #728072;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

#addListingForm .makon-listing-photo-focus {
  position: absolute;
  z-index: 3;
  left: var(--photo-focus-x, 50%);
  top: var(--photo-focus-y, 50%);
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: #18a94b;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .28), 0 0 0 3px rgba(24, 169, 75, .22);
  pointer-events: none;
}

#addListingForm .makon-listing-photo-frame.is-empty .makon-listing-photo-focus {
  display: none;
}

#addListingForm .makon-listing-photo-help {
  display: grid;
  gap: 10px;
  min-width: 0;
}

#addListingForm .makon-listing-photo-help strong {
  color: #173522;
  font-size: 15px;
  line-height: 1.25;
}

#addListingForm .makon-listing-photo-help p,
#addListingForm .makon-listing-photo-meta {
  margin: 0;
  color: #66756b;
  font-size: 13px;
  line-height: 1.45;
}

#addListingForm .makon-listing-photo-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e6f8df;
  color: #16833a;
  font-size: 12px;
  font-weight: 800;
}

#addListingForm .makon-listing-photo-reset {
  width: fit-content !important;
  min-height: 38px;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 1px solid rgba(24, 72, 39, .12) !important;
  border-radius: 11px !important;
  background: #fff !important;
  color: #31523b !important;
  font: inherit;
  font-size: 12px !important;
  font-weight: 800 !important;
  cursor: pointer;
}

#addListingForm .makon-listing-photo-warning {
  color: #b45309 !important;
}

body.dark #addListingForm .makon-listing-photo-editor,
body.dark-theme #addListingForm .makon-listing-photo-editor {
  border-color: rgba(255,255,255,.10);
  background: rgba(28, 34, 29, .92);
}

body.dark #addListingForm .makon-listing-photo-frame,
body.dark-theme #addListingForm .makon-listing-photo-frame {
  background: #171b18;
  border-color: rgba(153, 228, 62, .18);
}

body.dark #addListingForm .makon-listing-photo-help strong,
body.dark-theme #addListingForm .makon-listing-photo-help strong {
  color: #eff7ec;
}

body.dark #addListingForm .makon-listing-photo-help p,
body.dark #addListingForm .makon-listing-photo-meta,
body.dark-theme #addListingForm .makon-listing-photo-help p,
body.dark-theme #addListingForm .makon-listing-photo-meta {
  color: #aeb9b0;
}

@media (max-width: 760px) {
  #addListingForm .makon-listing-photo-editor {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}


/* ============================================================
   MAKON LISTING IMAGE EDITOR V4 — SCALE / ZOOM
   100% = whole image; "Fill" = minimum edge-to-edge crop.
   ============================================================ */
#addListingForm .makon-listing-photo-zoom {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(24, 72, 39, .10);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
}

#addListingForm .makon-listing-photo-zoom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #31523b;
  font-size: 12px;
  font-weight: 850;
}

#addListingForm .makon-listing-photo-zoom-value {
  min-width: 48px;
  color: #16833a;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#addListingForm .makon-listing-photo-zoom-row {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 38px;
  gap: 9px;
  align-items: center;
}

#addListingForm .makon-listing-photo-zoom-row button,
#addListingForm .makon-listing-photo-presets button {
  width: auto !important;
  margin: 0 !important;
  border: 1px solid rgba(24,72,39,.12) !important;
  background: #fff !important;
  color: #24492f !important;
  cursor: pointer;
  font: inherit;
  font-weight: 800 !important;
}

#addListingForm .makon-listing-photo-zoom-row button {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border-radius: 11px !important;
  font-size: 21px !important;
  line-height: 1 !important;
}

#addListingForm .makon-listing-photo-zoom-range {
  width: 100% !important;
  min-width: 0 !important;
  height: 28px !important;
  min-height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  accent-color: #18a94b;
  cursor: pointer;
}

#addListingForm .makon-listing-photo-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
}

#addListingForm .makon-listing-photo-presets button {
  min-height: 36px !important;
  padding: 0 10px !important;
  border-radius: 10px !important;
  font-size: 11.5px !important;
}

#addListingForm .makon-listing-photo-zoom :disabled,
#addListingForm .makon-listing-photo-reset:disabled {
  cursor: not-allowed !important;
  opacity: .46 !important;
}

#addListingForm .makon-listing-photo-frame.is-contain-zoom::after {
  content: "Фото целиком";
  position: absolute;
  z-index: 4;
  right: 9px;
  bottom: 9px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  color: #2d6f3f;
  box-shadow: 0 5px 16px rgba(0,0,0,.10);
  font-size: 10px;
  font-weight: 850;
  pointer-events: none;
}

#addListingForm .makon-listing-photo-frame.is-locked {
  cursor: default !important;
}

body.dark #addListingForm .makon-listing-photo-zoom,
body.dark-theme #addListingForm .makon-listing-photo-zoom {
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.10);
}

body.dark #addListingForm .makon-listing-photo-zoom-head,
body.dark-theme #addListingForm .makon-listing-photo-zoom-head {
  color: #d8e5d8;
}

body.dark #addListingForm .makon-listing-photo-zoom-row button,
body.dark #addListingForm .makon-listing-photo-presets button,
body.dark-theme #addListingForm .makon-listing-photo-zoom-row button,
body.dark-theme #addListingForm .makon-listing-photo-presets button {
  background: #1d251f !important;
  color: #dff4df !important;
  border-color: rgba(255,255,255,.10) !important;
}

@media (max-width: 430px) {
  #addListingForm .makon-listing-photo-presets {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   MAKON LISTING IMAGE EDITOR V5 — 800×600 + AUTO BACKGROUND
   Flat/logo artwork continues its own edge color; photographs keep blur.
   ============================================================ */
#addListingForm .makon-listing-photo-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

#addListingForm .makon-listing-photo-bg-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(24, 72, 39, .10);
  border-radius: 999px;
  background: #fff;
  color: #52645a;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
}

body.dark #addListingForm .makon-listing-photo-bg-status,
body.dark-theme #addListingForm .makon-listing-photo-bg-status {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
  color: #c8d3ca;
}

/* ============================================================
   MAKON LISTING IMAGE EDITOR V6 — SMART/MANUAL BACKGROUND + FINAL UI
   ============================================================ */

/* The add/edit listing section should feel like a dedicated editor, not a
   narrow legacy form. These rules intentionally live in the feature CSS so
   profile_business.css and global_controls.css remain untouched. */
#addListing {
  width: 100% !important;
  max-width: 1180px !important;
  margin-inline: auto !important;
}

#addListing .listing-form-shell {
  width: 100% !important;
  max-width: 1120px !important;
  margin-inline: auto !important;
  gap: 18px !important;
  padding: clamp(18px, 2.2vw, 28px) !important;
  border: 1px solid rgba(28, 72, 39, .10) !important;
  border-radius: 30px !important;
  background:
    radial-gradient(circle at 94% 4%, rgba(153,228,62,.13), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(250,252,248,.96)) !important;
  box-shadow: 0 26px 70px rgba(26, 46, 31, .10) !important;
}

#addListing .listing-form-header {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 7px !important;
  align-items: start !important;
  padding: clamp(18px, 2vw, 24px) !important;
  border: 1px solid rgba(28, 72, 39, .09) !important;
  border-radius: 22px !important;
  background:
    radial-gradient(circle at top right, rgba(153,228,62,.16), transparent 40%),
    #ffffff !important;
  box-shadow: 0 14px 34px rgba(15,23,42,.06) !important;
}

#addListing .listing-form-header .section-kicker {
  justify-self: start !important;
  margin: 0 !important;
}

#addListing .listing-form-header h2 {
  margin: 0 !important;
  color: #14251a !important;
  font-size: clamp(1.6rem, 2.7vw, 2.3rem) !important;
  line-height: 1.08 !important;
  letter-spacing: -.035em !important;
}

#addListing .listing-form-header p {
  max-width: 680px !important;
  margin: 0 !important;
  color: #66756b !important;
  font-size: .92rem !important;
  line-height: 1.55 !important;
}

#addListingForm.modern-listing-form {
  width: 100% !important;
  max-width: 930px !important;
  margin: 0 auto !important;
  gap: 14px !important;
  padding: clamp(16px, 2vw, 22px) !important;
  border: 1px solid rgba(28,72,39,.08) !important;
  border-radius: 24px !important;
  background: rgba(255,255,255,.78) !important;
  box-shadow: 0 12px 34px rgba(20,35,24,.045) !important;
}

#addListingForm .makon-listing-photo-editor {
  width: 100% !important;
  grid-template-columns: minmax(0, 1.22fr) minmax(300px, .78fr) !important;
  gap: 20px !important;
  align-items: start !important;
  margin: 2px 0 0 !important;
  padding: 18px !important;
  border-radius: 22px !important;
  border-color: rgba(28,72,39,.11) !important;
  background: linear-gradient(145deg, #fbfdf9, #f4f8f1) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85) !important;
}

#addListingForm .makon-listing-photo-frame {
  align-self: start !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 30px rgba(15,23,42,.09) !important;
}

#addListingForm .makon-listing-photo-help {
  gap: 12px !important;
}

#addListingForm .makon-listing-photo-heading {
  display: grid;
  gap: 5px;
}

#addListingForm .makon-listing-photo-heading p {
  margin: 0 !important;
}

#addListingForm .makon-listing-photo-background {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(24,72,39,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
}

#addListingForm .makon-listing-photo-background-head {
  display: grid;
  gap: 3px;
}

#addListingForm .makon-listing-photo-background-head > span {
  color: #31523b;
  font-size: 12px;
  font-weight: 900;
}

#addListingForm .makon-listing-photo-background-head > small {
  color: #728078;
  font-size: 10.5px;
  line-height: 1.35;
}

#addListingForm .makon-listing-photo-background-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 7px;
}

#addListingForm .makon-listing-photo-background-modes button {
  width: 100% !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0 10px !important;
  border: 1px solid rgba(24,72,39,.11) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #31523b !important;
  font-size: 11.5px !important;
  font-weight: 850 !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

#addListingForm .makon-listing-photo-background-modes button.active {
  border-color: rgba(24,169,75,.32) !important;
  background: #e8f9e2 !important;
  color: #11793a !important;
  box-shadow: inset 0 0 0 1px rgba(24,169,75,.08) !important;
}

#addListingForm .makon-listing-photo-color-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

#addListingForm .makon-bg-swatch {
  position: relative;
  width: 31px !important;
  min-width: 31px !important;
  height: 31px !important;
  min-height: 31px !important;
  margin: 0 !important;
  padding: 3px !important;
  border: 1px solid rgba(20,30,22,.14) !important;
  border-radius: 10px !important;
  background: #fff !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

#addListingForm .makon-bg-swatch > span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  background: var(--swatch, #fff);
}

#addListingForm .makon-bg-swatch.is-white > span { background: #fff; border: 1px solid #ececec; }
#addListingForm .makon-bg-swatch.is-black > span { background: #111; }

#addListingForm .makon-bg-swatch.active {
  border-color: #18a94b !important;
  box-shadow: 0 0 0 3px rgba(24,169,75,.13) !important;
}

#addListingForm .makon-listing-photo-custom-color {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 31px !important;
  margin: 0 !important;
  padding: 3px 8px 3px 4px !important;
  border: 1px solid rgba(20,30,22,.12) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #52645a !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
}

#addListingForm .makon-listing-photo-color-picker {
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 7px !important;
  overflow: hidden !important;
  background: transparent !important;
  cursor: pointer !important;
}

#addListingForm .makon-listing-photo-footer-controls {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
}

#addListingForm .makon-listing-photo-footer-controls .makon-listing-photo-reset {
  white-space: nowrap;
}

#addListingForm .makon-listing-photo-editor.is-dirty .makon-listing-photo-badge {
  box-shadow: 0 0 0 3px rgba(24,169,75,.08);
}

/* Never disable zoom/background just because AUTO is selected. */
#addListingForm .makon-listing-photo-background button,
#addListingForm .makon-listing-photo-color-picker {
  pointer-events: auto !important;
}

/* Dark mode */
body.dark #addListing .listing-form-shell,
body.dark-theme #addListing .listing-form-shell,
body.dark #addListing .listing-form-header,
body.dark-theme #addListing .listing-form-header,
body.dark #addListingForm.modern-listing-form,
body.dark-theme #addListingForm.modern-listing-form,
body.dark #addListingForm .makon-listing-photo-editor,
body.dark-theme #addListingForm .makon-listing-photo-editor,
body.dark #addListingForm .makon-listing-photo-background,
body.dark-theme #addListingForm .makon-listing-photo-background {
  background: #1d211e !important;
  border-color: rgba(255,255,255,.09) !important;
}

body.dark #addListing .listing-form-header h2,
body.dark-theme #addListing .listing-form-header h2,
body.dark #addListing .listing-form-header p,
body.dark-theme #addListing .listing-form-header p,
body.dark #addListingForm .makon-listing-photo-background-head > span,
body.dark-theme #addListingForm .makon-listing-photo-background-head > span {
  color: #eef5ed !important;
}

body.dark #addListingForm .makon-listing-photo-background-head > small,
body.dark-theme #addListingForm .makon-listing-photo-background-head > small {
  color: #aeb9b0 !important;
}

body.dark #addListingForm .makon-listing-photo-background-modes button,
body.dark-theme #addListingForm .makon-listing-photo-background-modes button,
body.dark #addListingForm .makon-bg-swatch,
body.dark-theme #addListingForm .makon-bg-swatch,
body.dark #addListingForm .makon-listing-photo-custom-color,
body.dark-theme #addListingForm .makon-listing-photo-custom-color {
  background: #252b27 !important;
  border-color: rgba(255,255,255,.10) !important;
  color: #dce7dd !important;
}

body.dark #addListingForm .makon-listing-photo-background-modes button.active,
body.dark-theme #addListingForm .makon-listing-photo-background-modes button.active {
  background: rgba(24,169,75,.19) !important;
  color: #b7f1c5 !important;
}

/* Tablet */
@media (max-width: 900px) {
  #addListing .listing-form-shell {
    padding: 18px !important;
    border-radius: 24px !important;
  }

  #addListingForm.modern-listing-form {
    max-width: 760px !important;
  }

  #addListingForm .makon-listing-photo-editor {
    grid-template-columns: 1fr !important;
    max-width: 650px !important;
    margin-inline: auto !important;
  }

  #addListingForm .makon-listing-photo-frame {
    width: 100% !important;
    max-width: 620px !important;
    margin-inline: auto !important;
  }
}

/* Phone */
@media (max-width: 600px) {
  #addListing {
    max-width: none !important;
  }

  #addListing .listing-form-shell {
    gap: 12px !important;
    padding: 10px !important;
    border-radius: 20px !important;
  }

  #addListing .listing-form-header {
    gap: 6px !important;
    padding: 15px !important;
    border-radius: 17px !important;
  }

  #addListing .listing-form-header h2 {
    font-size: 1.48rem !important;
  }

  #addListing .listing-form-header p {
    font-size: .82rem !important;
  }

  #addListingForm.modern-listing-form {
    gap: 12px !important;
    padding: 10px !important;
    border: 0 !important;
    border-radius: 16px !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  #addListingForm .makon-listing-photo-editor {
    gap: 14px !important;
    padding: 10px !important;
    border-radius: 17px !important;
  }

  #addListingForm .makon-listing-photo-frame {
    border-radius: 14px !important;
  }

  #addListingForm .makon-listing-photo-badges {
    gap: 5px !important;
  }

  #addListingForm .makon-listing-photo-badge,
  #addListingForm .makon-listing-photo-bg-status {
    min-height: 25px !important;
    padding-inline: 8px !important;
    font-size: 10.5px !important;
  }

  #addListingForm .makon-listing-photo-zoom,
  #addListingForm .makon-listing-photo-background {
    padding: 10px !important;
    border-radius: 12px !important;
  }

  #addListingForm .makon-listing-photo-footer-controls {
    grid-template-columns: 1fr !important;
  }

  #addListingForm .makon-listing-photo-reset {
    width: 100% !important;
  }

  #addListingForm .listing-save-btn {
    width: 100% !important;
    min-height: 48px !important;
    border-radius: 14px !important;
  }
}


/* ============================================================
   MAKON MEDIA IMAGE EDITOR V10 — MENU + COMPANY AVATAR
   ============================================================ */
.makon-media-editor {
  --makon-media-ratio: 4 / 3;
  display: grid;
  grid-template-columns: minmax(240px, 1.15fr) minmax(280px, .85fr);
  gap: 18px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  padding: 16px;
  border: 1px solid rgba(28, 72, 39, .10);
  border-radius: 20px;
  background: linear-gradient(145deg, #fbfdf9, #f4f8f1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
  box-sizing: border-box;
}

#companyProfileForm .makon-media-editor,
#addDishForm .makon-media-editor,
#addDrinkForm .makon-media-editor {
  grid-column: 1 / -1;
}

.makon-media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: var(--makon-media-ratio);
  overflow: hidden;
  border: 1px solid rgba(21,128,61,.16);
  border-radius: 18px;
  background: #f7f9f5;
  box-shadow: 0 12px 30px rgba(15,23,42,.09);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.makon-media-frame.is-empty,
.makon-media-frame.is-locked {
  cursor: default;
}

.makon-media-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.makon-media-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: #728072;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.makon-media-focus {
  position: absolute;
  z-index: 3;
  left: var(--media-focus-x, 50%);
  top: var(--media-focus-y, 50%);
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: #18a94b;
  box-shadow: 0 2px 12px rgba(0,0,0,.28), 0 0 0 3px rgba(24,169,75,.22);
  pointer-events: none;
}

.makon-media-frame.is-empty .makon-media-focus,
.makon-media-frame.is-existing:not(:focus-within) .makon-media-focus {
  opacity: .72;
}

.makon-media-tools {
  display: grid;
  gap: 11px;
  min-width: 0;
}

.makon-media-badges,
.makon-media-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.makon-media-badge,
.makon-media-bg-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 850;
  line-height: 1;
}

.makon-media-badge {
  background: #e6f8df;
  color: #16833a;
}

.makon-media-bg-status {
  border: 1px solid rgba(24,72,39,.10);
  background: #fff;
  color: #52645a;
}

.makon-media-heading {
  display: grid;
  gap: 4px;
}

.makon-media-heading strong {
  color: #173522;
  font-size: 15px;
  line-height: 1.25;
}

.makon-media-heading p,
.makon-media-meta {
  margin: 0;
  color: #66756b;
  font-size: 12.5px;
  line-height: 1.45;
}

.makon-media-zoom,
.makon-media-background {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(24,72,39,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.74);
}

.makon-media-zoom-head,
.makon-media-background-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #31523b;
  font-size: 12px;
  font-weight: 900;
}

.makon-media-background-head {
  display: grid;
  justify-content: stretch;
  gap: 3px;
}

.makon-media-background-head small {
  color: #728078;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.35;
}

.makon-media-zoom-value {
  min-width: 48px;
  color: #16833a;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.makon-media-zoom-row {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 38px;
  gap: 9px;
  align-items: center;
}

.makon-media-zoom-row button,
.makon-media-presets button,
.makon-media-background-modes button,
.makon-media-reset {
  width: auto !important;
  margin: 0 !important;
  border: 1px solid rgba(24,72,39,.12) !important;
  background: #fff !important;
  color: #24492f !important;
  cursor: pointer;
  font: inherit;
  font-weight: 850 !important;
  box-shadow: none !important;
}

.makon-media-zoom-row button {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border-radius: 11px !important;
  font-size: 21px !important;
  line-height: 1 !important;
}

.makon-media-range {
  width: 100% !important;
  min-width: 0 !important;
  height: 28px !important;
  min-height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  accent-color: #18a94b;
}

.makon-media-presets,
.makon-media-background-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 7px;
}

.makon-media-presets button,
.makon-media-background-modes button {
  min-height: 36px !important;
  padding: 0 10px !important;
  border-radius: 10px !important;
  font-size: 11.5px !important;
}

.makon-media-background-modes button.active {
  border-color: rgba(24,169,75,.32) !important;
  background: #e8f9e2 !important;
  color: #11793a !important;
}

.makon-media-swatch {
  width: 31px !important;
  min-width: 31px !important;
  height: 31px !important;
  min-height: 31px !important;
  margin: 0 !important;
  padding: 3px !important;
  border: 1px solid rgba(20,30,22,.14) !important;
  border-radius: 10px !important;
  background: #fff !important;
  cursor: pointer !important;
}

.makon-media-swatch > span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  background: var(--media-swatch, #fff);
}

.makon-media-swatch.is-white > span { background: #fff; border: 1px solid #ececec; }
.makon-media-swatch.is-black > span { background: #111; }
.makon-media-swatch.active { border-color: #18a94b !important; box-shadow: 0 0 0 3px rgba(24,169,75,.13) !important; }

.makon-media-custom-color {
  position: relative;
  width: 31px;
  height: 31px;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px dashed rgba(24,72,39,.26);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}

.makon-media-custom-color input {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0;
  cursor: pointer;
}

.makon-media-custom-color span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #31523b;
  font-size: 18px;
  font-weight: 900;
  pointer-events: none;
}

.makon-media-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.makon-media-meta {
  flex: 1;
  min-width: 0;
}

.makon-media-reset {
  min-height: 38px !important;
  padding: 0 13px !important;
  border-radius: 11px !important;
  font-size: 11.5px !important;
}

.makon-media-editor :disabled {
  cursor: not-allowed !important;
  opacity: .46 !important;
}

#addDishForm.makon-media-enhanced #dishPreview,
#addDrinkForm.makon-media-enhanced #drinkPreview {
  display: none !important;
}

#companyProfileForm .makon-media-editor-avatar {
  grid-template-columns: minmax(220px, 340px) minmax(280px, 1fr);
}

#companyProfileForm .makon-media-editor-avatar .makon-media-frame {
  max-width: 340px;
  justify-self: start;
}

body.dark .makon-media-editor,
body.dark-theme .makon-media-editor {
  border-color: rgba(255,255,255,.10);
  background: linear-gradient(145deg, #1b201c, #171b18);
}

body.dark .makon-media-frame,
body.dark-theme .makon-media-frame {
  background: #151916;
  border-color: rgba(153,228,62,.18);
}

body.dark .makon-media-heading strong,
body.dark-theme .makon-media-heading strong,
body.dark .makon-media-zoom-head,
body.dark-theme .makon-media-zoom-head,
body.dark .makon-media-background-head,
body.dark-theme .makon-media-background-head {
  color: #e5efe2;
}

body.dark .makon-media-heading p,
body.dark-theme .makon-media-heading p,
body.dark .makon-media-meta,
body.dark-theme .makon-media-meta,
body.dark .makon-media-background-head small,
body.dark-theme .makon-media-background-head small {
  color: #aeb9b0;
}

body.dark .makon-media-zoom,
body.dark-theme .makon-media-zoom,
body.dark .makon-media-background,
body.dark-theme .makon-media-background,
body.dark .makon-media-bg-status,
body.dark-theme .makon-media-bg-status {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.10);
  color: #c8d3ca;
}

body.dark .makon-media-zoom-row button,
body.dark-theme .makon-media-zoom-row button,
body.dark .makon-media-presets button,
body.dark-theme .makon-media-presets button,
body.dark .makon-media-background-modes button,
body.dark-theme .makon-media-background-modes button,
body.dark .makon-media-reset,
body.dark-theme .makon-media-reset {
  background: #1d251f !important;
  color: #dff4df !important;
  border-color: rgba(255,255,255,.10) !important;
}

@media (max-width: 760px) {
  .makon-media-editor,
  #companyProfileForm .makon-media-editor-avatar {
    grid-template-columns: 1fr;
    gap: 13px;
    padding: 12px;
    border-radius: 18px;
  }

  #companyProfileForm .makon-media-editor-avatar .makon-media-frame {
    width: min(100%, 320px);
    justify-self: center;
  }
}

@media (max-width: 420px) {
  .makon-media-presets,
  .makon-media-background-modes {
    grid-template-columns: 1fr;
  }

  .makon-media-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .makon-media-reset {
    width: 100% !important;
  }
}

/* ============================================================
   MAKON MEDIA EDITOR V11 — COLLAPSED PROFILE + POST/EVENT MEDIA
   ============================================================ */
.makon-media-canvas[hidden],
.makon-media-empty[hidden] {
  display: none !important;
}

.makon-media-editor.is-collapsed {
  display: none !important;
}

.makon-media-toggle {
  grid-column: 1 / -1;
  width: 100% !important;
  min-height: 48px !important;
  display: grid !important;
  grid-template-columns: 34px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  margin: 2px 0 0 !important;
  padding: 7px 12px !important;
  border: 1px solid rgba(22, 163, 74, .16) !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, #f5fbf1, #eef8ea) !important;
  color: #1a5430 !important;
  box-shadow: none !important;
  font: inherit !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  text-align: left !important;
  cursor: pointer !important;
}

.makon-media-toggle-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #dcf7d2;
  color: #159044;
  font-size: 16px;
}

.makon-media-toggle b {
  color: #49805a;
  font-size: 18px;
  transition: transform .18s ease;
}

.makon-media-toggle.is-open b { transform: rotate(180deg); }
.makon-media-toggle.has-image .makon-media-toggle-icon { background: #d6f6d0; }
.makon-media-toggle.has-image .makon-media-toggle-icon::after { content: "✓"; }
.makon-media-toggle.has-image .makon-media-toggle-icon { font-size: 0; }
.makon-media-toggle.has-image .makon-media-toggle-icon::after { font-size: 16px; font-weight: 950; }

#businessPostForm .makon-media-editor,
#businessEventForm .makon-media-editor {
  grid-column: 1 / -1 !important;
  width: 100% !important;
}

#businessPostForm .makon-media-editor-post {
  grid-template-columns: minmax(260px, 440px) minmax(300px, 1fr);
}

#businessEventForm .makon-media-editor-event {
  grid-template-columns: minmax(300px, 1.15fr) minmax(280px, .85fr);
  padding: 12px;
  border-radius: 18px;
}

#businessEventForm.makon-media-enhanced #businessEventCoverPreview {
  display: none !important;
}

body.dark .makon-media-toggle,
body.dark-theme .makon-media-toggle {
  border-color: rgba(153,228,62,.15) !important;
  background: rgba(153,228,62,.08) !important;
  color: #d8efce !important;
}

@media (max-width: 820px) {
  #businessPostForm .makon-media-editor-post,
  #businessEventForm .makon-media-editor-event {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 520px) {
  .makon-media-toggle {
    min-height: 46px !important;
    padding: 6px 10px !important;
    border-radius: 13px !important;
    font-size: 12.5px !important;
  }

  #businessPostForm .makon-media-editor,
  #businessEventForm .makon-media-editor {
    padding: 10px !important;
    border-radius: 16px !important;
  }
}


/* ============================================================
   MAKON MEDIA EDITOR V12 — PREVIEW FIX + COMPACT RESPONSIVE UI
   2026-08-19
   ============================================================ */

/* One compact geometry for company avatar, menu, posts and events. */
.makon-media-editor,
#companyProfileForm .makon-media-editor,
#addDishForm .makon-media-editor,
#addDrinkForm .makon-media-editor,
#businessPostForm .makon-media-editor,
#businessEventForm .makon-media-editor {
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr) !important;
  gap: 14px !important;
  align-items: start !important;
  padding: 12px !important;
  border-radius: 18px !important;
}

.makon-media-frame,
#companyProfileForm .makon-media-editor-avatar .makon-media-frame,
#businessPostForm .makon-media-editor-post .makon-media-frame,
#businessEventForm .makon-media-editor-event .makon-media-frame {
  width: 100% !important;
  max-width: 330px !important;
  justify-self: start !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .075) !important;
}

#companyProfileForm .makon-media-editor-avatar {
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr) !important;
}

#companyProfileForm .makon-media-editor-avatar .makon-media-frame {
  max-width: 280px !important;
}

#businessEventForm .makon-media-editor-event {
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr) !important;
}

#businessEventForm .makon-media-editor-event .makon-media-frame {
  max-width: 340px !important;
}

#businessPostForm .makon-media-editor-post {
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr) !important;
}

#businessPostForm .makon-media-editor-post .makon-media-frame {
  max-width: 320px !important;
}

/* Make the right side shorter: zoom + background sit next to each other. */
.makon-media-tools {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  align-content: start !important;
}

.makon-media-badges,
.makon-media-heading,
.makon-media-controls {
  grid-column: 1 / -1 !important;
}

.makon-media-heading {
  gap: 2px !important;
}

.makon-media-heading strong {
  font-size: 14px !important;
}

.makon-media-heading p,
.makon-media-meta {
  font-size: 11.5px !important;
  line-height: 1.35 !important;
}

.makon-media-zoom,
.makon-media-background {
  min-width: 0 !important;
  gap: 7px !important;
  padding: 9px !important;
  border-radius: 13px !important;
}

.makon-media-background-head small {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
  font-size: 9.8px !important;
  line-height: 1.28 !important;
}

.makon-media-zoom-row {
  grid-template-columns: 34px minmax(0, 1fr) 34px !important;
  gap: 7px !important;
}

.makon-media-zoom-row button {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 10px !important;
}

.makon-media-presets button,
.makon-media-background-modes button {
  min-height: 34px !important;
  padding: 0 8px !important;
  font-size: 10.5px !important;
}

/* Palette must stay a row of small swatches even inside the legacy menu form,
   whose old CSS sets every button to width:100%. */
.makon-media-palette,
#addMenu .menu-editor-panel .makon-media-palette,
#businessPostForm .makon-media-palette,
#businessEventForm .makon-media-palette {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 5px !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 2px !important;
  overflow-x: auto !important;
  scrollbar-width: thin;
}

.makon-media-swatch,
#addMenu .menu-editor-panel .makon-media-swatch,
#addMenu .menu-editor-panel button.makon-media-swatch,
#businessPostForm button.makon-media-swatch,
#businessEventForm button.makon-media-swatch {
  flex: 0 0 29px !important;
  width: 29px !important;
  min-width: 29px !important;
  max-width: 29px !important;
  height: 29px !important;
  min-height: 29px !important;
  max-height: 29px !important;
  margin: 0 !important;
  padding: 3px !important;
  border-radius: 9px !important;
}

.makon-media-custom-color,
#addMenu .menu-editor-panel .makon-media-custom-color {
  flex: 0 0 29px !important;
  width: 29px !important;
  min-width: 29px !important;
  max-width: 29px !important;
  height: 29px !important;
  min-height: 29px !important;
  margin: 0 !important;
  border-radius: 9px !important;
}

#addMenu .menu-editor-panel .makon-media-custom-color input,
.makon-media-custom-color input {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
}

/* Override the legacy #addMenu rule that stretches every editor button. */
#addMenu .menu-editor-panel .makon-media-zoom-row button {
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
}

#addMenu .menu-editor-panel .makon-media-presets button,
#addMenu .menu-editor-panel .makon-media-background-modes button,
#addMenu .menu-editor-panel .makon-media-reset {
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.makon-media-controls {
  min-height: 34px !important;
  gap: 8px !important;
}

.makon-media-reset {
  min-height: 34px !important;
  padding: 0 10px !important;
  font-size: 10.5px !important;
  white-space: nowrap !important;
}

/* Selected file must always reveal the canvas, regardless of legacy form CSS. */
.makon-media-frame.has-image .makon-media-canvas {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.makon-media-frame.has-image .makon-media-empty {
  display: none !important;
}

.makon-media-frame.is-empty .makon-media-canvas {
  display: none !important;
}

/* Tablet: keep a side-by-side editor while there is room. */
@media (max-width: 860px) and (min-width: 641px) {
  .makon-media-editor,
  #companyProfileForm .makon-media-editor,
  #addDishForm .makon-media-editor,
  #addDrinkForm .makon-media-editor,
  #businessPostForm .makon-media-editor,
  #businessEventForm .makon-media-editor {
    grid-template-columns: minmax(190px, 270px) minmax(0, 1fr) !important;
    gap: 11px !important;
  }

  .makon-media-frame,
  #companyProfileForm .makon-media-editor-avatar .makon-media-frame,
  #businessPostForm .makon-media-editor-post .makon-media-frame,
  #businessEventForm .makon-media-editor-event .makon-media-frame {
    max-width: 270px !important;
  }

  .makon-media-tools {
    grid-template-columns: 1fr !important;
  }

  .makon-media-badges,
  .makon-media-heading,
  .makon-media-controls {
    grid-column: 1 !important;
  }

  .makon-media-heading p,
  .makon-media-background-head small {
    display: none !important;
  }
}

/* Phone: one compact column, controls stay dense and touch friendly. */
@media (max-width: 640px) {
  .makon-media-editor,
  #companyProfileForm .makon-media-editor-avatar,
  #addDishForm .makon-media-editor,
  #addDrinkForm .makon-media-editor,
  #businessPostForm .makon-media-editor-post,
  #businessEventForm .makon-media-editor-event {
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    padding: 9px !important;
    border-radius: 15px !important;
  }

  .makon-media-frame,
  #companyProfileForm .makon-media-editor-avatar .makon-media-frame,
  #businessPostForm .makon-media-editor-post .makon-media-frame,
  #businessEventForm .makon-media-editor-event .makon-media-frame {
    width: 100% !important;
    max-width: 420px !important;
    justify-self: center !important;
    border-radius: 14px !important;
  }

  .makon-media-tools {
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  .makon-media-badges,
  .makon-media-heading,
  .makon-media-controls {
    grid-column: 1 !important;
  }

  .makon-media-heading p,
  .makon-media-background-head small {
    display: none !important;
  }

  .makon-media-zoom,
  .makon-media-background {
    padding: 8px !important;
  }

  .makon-media-background-modes,
  .makon-media-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .makon-media-palette,
  #addMenu .menu-editor-panel .makon-media-palette {
    padding-bottom: 4px !important;
  }

  .makon-media-controls {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
  }

  .makon-media-meta {
    overflow-wrap: anywhere !important;
  }

  .makon-media-focus {
    width: 19px !important;
    height: 19px !important;
  }
}

@media (max-width: 390px) {
  .makon-media-editor,
  #companyProfileForm .makon-media-editor-avatar,
  #addDishForm .makon-media-editor,
  #addDrinkForm .makon-media-editor,
  #businessPostForm .makon-media-editor-post,
  #businessEventForm .makon-media-editor-event {
    padding: 8px !important;
  }

  .makon-media-badges {
    gap: 5px !important;
  }

  .makon-media-badge,
  .makon-media-bg-status {
    min-height: 25px !important;
    padding: 0 8px !important;
    font-size: 10px !important;
  }

  .makon-media-presets button,
  .makon-media-background-modes button {
    min-height: 32px !important;
    font-size: 10px !important;
  }

  .makon-media-controls {
    grid-template-columns: 1fr !important;
  }

  .makon-media-reset {
    width: 100% !important;
  }
}

/* V13 — extended zoom: 5%..2000% for every MAKON image editor. */
.makon-listing-photo-zoom-value::after,
.makon-media-zoom-value::after {
  content: "";
}
.makon-listing-photo-zoom-row input[type="range"],
.makon-media-zoom-row input[type="range"] {
  min-width: 0 !important;
}
@media (max-width: 560px) {
  .makon-listing-photo-zoom-row,
  .makon-media-zoom-row {
    grid-template-columns: 40px minmax(0,1fr) 40px !important;
  }
}


/* ============================================================
   MAKON MEDIA EDITOR V19 — 8 RESIZE HANDLES
   Mouse + touch. Locked proportions by default; free X/Y mode optional.
   ============================================================ */
.makon-media-editor.is-full-width,
#addCarForm .makon-media-editor,
#catalogProductForm .makon-media-editor,
#roomForm .makon-media-editor,
#procedureForm .makon-media-editor,
#activityResourceForm .makon-media-editor,
#officeSpaceForm .makon-media-editor,
#addServiceForm .makon-media-editor,
#addMasterForm .makon-media-editor,
#cinemaAddMovieForm .makon-media-editor {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  align-self: start !important;
}

.makon-media-frame,
#addListingForm .makon-listing-photo-frame {
  isolation: isolate;
}

.makon-media-resize-box,
#addListingForm .makon-listing-resize-box {
  position: absolute !important;
  z-index: 6 !important;
  box-sizing: border-box !important;
  border: 1.5px dashed rgba(22, 163, 74, .92) !important;
  border-radius: 5px !important;
  pointer-events: none !important;
  touch-action: none !important;
}

.makon-media-resize-box[hidden],
#addListingForm .makon-listing-resize-box[hidden] {
  display: none !important;
}

.makon-media-resize-handle,
#addListingForm .makon-listing-resize-handle {
  position: absolute !important;
  z-index: 7 !important;
  display: block !important;
  width: 14px !important;
  min-width: 14px !important;
  max-width: 14px !important;
  height: 14px !important;
  min-height: 14px !important;
  max-height: 14px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 2px solid #16a34a !important;
  border-radius: 50% !important;
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .26) !important;
  appearance: none !important;
  pointer-events: auto !important;
  touch-action: none !important;
  transform: translate(-50%, -50%) !important;
}

.makon-media-resize-handle::before,
#addListingForm .makon-listing-resize-handle::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.makon-media-resize-handle.is-nw,
#addListingForm .makon-listing-resize-handle.is-nw { left: 0; top: 0; cursor: nwse-resize; }
.makon-media-resize-handle.is-n,
#addListingForm .makon-listing-resize-handle.is-n { left: 50%; top: 0; cursor: ns-resize; }
.makon-media-resize-handle.is-ne,
#addListingForm .makon-listing-resize-handle.is-ne { left: 100%; top: 0; cursor: nesw-resize; }
.makon-media-resize-handle.is-e,
#addListingForm .makon-listing-resize-handle.is-e { left: 100%; top: 50%; cursor: ew-resize; }
.makon-media-resize-handle.is-se,
#addListingForm .makon-listing-resize-handle.is-se { left: 100%; top: 100%; cursor: nwse-resize; }
.makon-media-resize-handle.is-s,
#addListingForm .makon-listing-resize-handle.is-s { left: 50%; top: 100%; cursor: ns-resize; }
.makon-media-resize-handle.is-sw,
#addListingForm .makon-listing-resize-handle.is-sw { left: 0; top: 100%; cursor: nesw-resize; }
.makon-media-resize-handle.is-w,
#addListingForm .makon-listing-resize-handle.is-w { left: 0; top: 50%; cursor: ew-resize; }

.makon-media-resize-controls,
#addListingForm .makon-listing-resize-controls {
  display: grid !important;
  gap: 8px !important;
  min-width: 0 !important;
  padding: 9px !important;
  border: 1px solid rgba(24, 72, 39, .10) !important;
  border-radius: 13px !important;
  background: rgba(255, 255, 255, .72) !important;
}

.makon-media-resize-controls {
  grid-column: 1 / -1 !important;
}

.makon-media-resize-head,
#addListingForm .makon-listing-resize-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  color: #31523b !important;
  font-size: 11px !important;
  font-weight: 900 !important;
}

.makon-media-resize-status,
#addListingForm .makon-listing-resize-status {
  color: #16833a !important;
  font-size: 10px !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.makon-media-resize-actions,
#addListingForm .makon-listing-resize-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 7px !important;
}

.makon-media-aspect-lock,
.makon-media-reset-size,
#addListingForm .makon-listing-aspect-lock,
#addListingForm .makon-listing-reset-size {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 34px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 7px 9px !important;
  border: 1px solid rgba(24, 72, 39, .12) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #31523b !important;
  font: inherit !important;
  font-size: 10.5px !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
}

.makon-media-aspect-lock.active,
#addListingForm .makon-listing-aspect-lock.active {
  border-color: rgba(22, 163, 74, .28) !important;
  background: #eaf8e6 !important;
  color: #147535 !important;
}

.makon-media-resize-controls > small,
#addListingForm .makon-listing-resize-controls > small {
  color: #728078 !important;
  font-size: 9.8px !important;
  font-weight: 650 !important;
  line-height: 1.35 !important;
}

body.dark .makon-media-resize-controls,
body.dark-theme .makon-media-resize-controls,
body.dark #addListingForm .makon-listing-resize-controls,
body.dark-theme #addListingForm .makon-listing-resize-controls {
  border-color: rgba(255, 255, 255, .10) !important;
  background: rgba(22, 28, 24, .82) !important;
}

body.dark .makon-media-resize-head,
body.dark-theme .makon-media-resize-head,
body.dark #addListingForm .makon-listing-resize-head,
body.dark-theme #addListingForm .makon-listing-resize-head {
  color: #e7eee4 !important;
}

body.dark .makon-media-aspect-lock,
body.dark .makon-media-reset-size,
body.dark-theme .makon-media-aspect-lock,
body.dark-theme .makon-media-reset-size,
body.dark #addListingForm .makon-listing-aspect-lock,
body.dark #addListingForm .makon-listing-reset-size,
body.dark-theme #addListingForm .makon-listing-aspect-lock,
body.dark-theme #addListingForm .makon-listing-reset-size {
  border-color: rgba(255,255,255,.10) !important;
  background: rgba(255,255,255,.06) !important;
  color: #edf4ea !important;
}

body.dark .makon-media-aspect-lock.active,
body.dark-theme .makon-media-aspect-lock.active,
body.dark #addListingForm .makon-listing-aspect-lock.active,
body.dark-theme #addListingForm .makon-listing-aspect-lock.active {
  border-color: rgba(153, 228, 62, .28) !important;
  background: rgba(153, 228, 62, .12) !important;
  color: #bce98b !important;
}

/* Do not let grid siblings stretch to the editor height. */
.makon-media-enhanced > *,
#addCarForm > * {
  align-self: start;
}

@media (max-width: 860px) {
  .makon-media-editor.is-full-width,
  #addCarForm .makon-media-editor,
  #catalogProductForm .makon-media-editor,
  #roomForm .makon-media-editor,
  #procedureForm .makon-media-editor,
  #activityResourceForm .makon-media-editor,
  #officeSpaceForm .makon-media-editor,
  #addServiceForm .makon-media-editor,
  #addMasterForm .makon-media-editor,
  #cinemaAddMovieForm .makon-media-editor {
    grid-template-columns: minmax(190px, 270px) minmax(0, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .makon-media-editor.is-full-width,
  #addCarForm .makon-media-editor,
  #catalogProductForm .makon-media-editor,
  #roomForm .makon-media-editor,
  #procedureForm .makon-media-editor,
  #activityResourceForm .makon-media-editor,
  #officeSpaceForm .makon-media-editor,
  #addServiceForm .makon-media-editor,
  #addMasterForm .makon-media-editor,
  #cinemaAddMovieForm .makon-media-editor {
    grid-template-columns: 1fr !important;
    padding: 9px !important;
  }

  .makon-media-resize-handle,
  #addListingForm .makon-listing-resize-handle {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    border-width: 2px !important;
  }

  .makon-media-resize-handle::before,
  #addListingForm .makon-listing-resize-handle::before {
    inset: -10px;
  }

  .makon-media-resize-head,
  #addListingForm .makon-listing-resize-head {
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 2px !important;
  }

  .makon-media-resize-actions,
  #addListingForm .makon-listing-resize-actions {
    grid-template-columns: 1fr 1fr !important;
  }

  .makon-media-resize-controls > small,
  #addListingForm .makon-listing-resize-controls > small {
    display: none !important;
  }
}

@media (max-width: 390px) {
  .makon-media-resize-actions,
  #addListingForm .makon-listing-resize-actions {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   MAKON V20 — BACKGROUND REMOVAL UI
   Local browser-side removal, shared by listing + generic editors.
   ============================================================ */
.makon-media-bg-removal,
#addListingForm .makon-listing-bg-removal {
  display: grid !important;
  gap: 9px !important;
  min-width: 0 !important;
  padding: 11px !important;
  border: 1px solid rgba(24, 72, 39, .10) !important;
  border-radius: 14px !important;
  background: rgba(250, 253, 249, .88) !important;
  box-shadow: none !important;
}

.makon-media-bg-removal-head,
#addListingForm .makon-listing-bg-removal-head {
  display: grid !important;
  gap: 3px !important;
  min-width: 0 !important;
}

.makon-media-bg-removal-head > span,
#addListingForm .makon-listing-bg-removal-head > span {
  color: #31523b !important;
  font-size: 11.5px !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
}

.makon-media-bg-removal-head > small,
#addListingForm .makon-listing-bg-removal-head > small,
.makon-media-bg-removal-status,
#addListingForm .makon-listing-bg-removal-status {
  margin: 0 !important;
  color: #728078 !important;
  font-size: 9.8px !important;
  font-weight: 650 !important;
  line-height: 1.4 !important;
}

.makon-media-bg-removal-actions,
#addListingForm .makon-listing-bg-removal-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 7px !important;
}

.makon-media-remove-bg,
.makon-media-restore-bg,
#addListingForm .makon-listing-remove-bg,
#addListingForm .makon-listing-restore-bg {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 36px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 1px solid rgba(24, 72, 39, .14) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #31523b !important;
  font: inherit !important;
  font-size: 10.5px !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
}

.makon-media-remove-bg,
#addListingForm .makon-listing-remove-bg {
  border-color: rgba(22, 163, 74, .28) !important;
  background: linear-gradient(180deg, #f1fceb 0%, #e8f8e2 100%) !important;
  color: #126f32 !important;
}

.makon-media-remove-bg:disabled,
.makon-media-restore-bg:disabled,
#addListingForm .makon-listing-remove-bg:disabled,
#addListingForm .makon-listing-restore-bg:disabled {
  opacity: .48 !important;
  cursor: not-allowed !important;
}

.makon-media-bg-tolerance,
#addListingForm .makon-listing-bg-tolerance {
  display: grid !important;
  grid-template-columns: auto minmax(80px, 1fr) 28px !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  color: #506058 !important;
  font-size: 9.8px !important;
  font-weight: 800 !important;
}

.makon-media-bg-tolerance input[type="range"],
#addListingForm .makon-listing-bg-tolerance input[type="range"] {
  width: 100% !important;
  min-width: 0 !important;
  accent-color: #16a34a !important;
}

.makon-media-bg-tolerance output,
#addListingForm .makon-listing-bg-tolerance output {
  color: #16833a !important;
  font-size: 10px !important;
  font-weight: 900 !important;
  text-align: right !important;
  font-variant-numeric: tabular-nums !important;
}

body.dark .makon-media-bg-removal,
body.dark-theme .makon-media-bg-removal,
body.dark #addListingForm .makon-listing-bg-removal,
body.dark-theme #addListingForm .makon-listing-bg-removal {
  border-color: rgba(255,255,255,.10) !important;
  background: rgba(22, 28, 24, .82) !important;
}

body.dark .makon-media-bg-removal-head > span,
body.dark-theme .makon-media-bg-removal-head > span,
body.dark #addListingForm .makon-listing-bg-removal-head > span,
body.dark-theme #addListingForm .makon-listing-bg-removal-head > span {
  color: #e7eee4 !important;
}

body.dark .makon-media-bg-removal-head > small,
body.dark-theme .makon-media-bg-removal-head > small,
body.dark .makon-media-bg-removal-status,
body.dark-theme .makon-media-bg-removal-status,
body.dark #addListingForm .makon-listing-bg-removal-head > small,
body.dark-theme #addListingForm .makon-listing-bg-removal-head > small,
body.dark #addListingForm .makon-listing-bg-removal-status,
body.dark-theme #addListingForm .makon-listing-bg-removal-status {
  color: #aeb9b0 !important;
}

body.dark .makon-media-remove-bg,
body.dark .makon-media-restore-bg,
body.dark-theme .makon-media-remove-bg,
body.dark-theme .makon-media-restore-bg,
body.dark #addListingForm .makon-listing-remove-bg,
body.dark #addListingForm .makon-listing-restore-bg,
body.dark-theme #addListingForm .makon-listing-remove-bg,
body.dark-theme #addListingForm .makon-listing-restore-bg {
  border-color: rgba(255,255,255,.10) !important;
  background: rgba(255,255,255,.06) !important;
  color: #edf4ea !important;
}

body.dark .makon-media-remove-bg,
body.dark-theme .makon-media-remove-bg,
body.dark #addListingForm .makon-listing-remove-bg,
body.dark-theme #addListingForm .makon-listing-remove-bg {
  border-color: rgba(153,228,62,.28) !important;
  background: rgba(153,228,62,.12) !important;
  color: #bce98b !important;
}

@media (max-width: 520px) {
  .makon-media-bg-removal-actions,
  #addListingForm .makon-listing-bg-removal-actions {
    grid-template-columns: 1fr !important;
  }
  .makon-media-bg-tolerance,
  #addListingForm .makon-listing-bg-tolerance {
    grid-template-columns: 1fr 30px !important;
  }
  .makon-media-bg-tolerance > span,
  #addListingForm .makon-listing-bg-tolerance > span {
    grid-column: 1 / -1 !important;
  }
}

/* ============================================================
   MAKON MEDIA V23.1 — stable resize interaction
   Resize follows the pointer globally so the handle cannot "freeze" when
   redraw moves the overlay. Side handles are explicit X/Y stretch controls.
   ============================================================ */
body.makon-image-resizing {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: grabbing !important;
}

.makon-media-frame.is-resizing,
#addListingForm .makon-listing-photo-frame.is-resizing {
  cursor: grabbing !important;
}

.makon-media-frame.is-resizing canvas,
#addListingForm .makon-listing-photo-frame.is-resizing canvas {
  pointer-events: none !important;
}

.makon-media-resize-handle,
#addListingForm .makon-listing-resize-handle {
  will-change: left, top, transform;
}


/* ============================================================
   MAKON V33 — VISIBLE PAN CONTROLS + MANUAL BACKGROUND BRUSH
   Applies to the shared makonMediaImageEditor used by ads, products,
   medicines, menu, listings and the other business media forms.
   ============================================================ */
.makon-media-frame {
  touch-action: none !important;
}

.makon-media-position {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: center !important;
  min-width: 0 !important;
  padding: 10px !important;
  border: 1px solid rgba(24, 72, 39, .10) !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,.64) !important;
}

.makon-media-position-head {
  display: grid !important;
  gap: 3px !important;
  min-width: 0 !important;
}

.makon-media-position-head > span {
  color: #31523b !important;
  font-size: 11.5px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
}

.makon-media-position-head > small {
  color: #728078 !important;
  font-size: 9.6px !important;
  font-weight: 650 !important;
  line-height: 1.35 !important;
}

.makon-media-position-pad {
  display: grid !important;
  grid-template-columns: repeat(3, 32px) !important;
  grid-template-rows: repeat(3, 32px) !important;
  gap: 3px !important;
  flex: 0 0 auto !important;
}

.makon-media-position-pad > button {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(24, 72, 39, .14) !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #236337 !important;
  font: inherit !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  box-shadow: 0 3px 8px rgba(22, 74, 38, .05) !important;
}

.makon-media-position-pad > button:hover:not(:disabled),
.makon-media-position-pad > button:focus-visible {
  border-color: rgba(22, 163, 74, .40) !important;
  background: #effbe9 !important;
  outline: none !important;
}

.makon-media-position-center {
  font-size: 10px !important;
  color: #159447 !important;
}

.makon-media-manual-bg {
  display: grid !important;
  gap: 8px !important;
  min-width: 0 !important;
  margin-top: 2px !important;
  padding: 9px !important;
  border: 1px solid rgba(24, 72, 39, .10) !important;
  border-radius: 11px !important;
  background: rgba(255,255,255,.58) !important;
}

.makon-media-manual-bg-head {
  display: grid !important;
  gap: 2px !important;
}

.makon-media-manual-bg-head > span {
  color: #31523b !important;
  font-size: 10.7px !important;
  font-weight: 900 !important;
}

.makon-media-manual-bg-head > small {
  color: #728078 !important;
  font-size: 9.3px !important;
  font-weight: 650 !important;
  line-height: 1.35 !important;
}

.makon-media-manual-bg-actions {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 5px !important;
}

.makon-media-manual-bg-actions > button,
.makon-media-manual-reset {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 34px !important;
  margin: 0 !important;
  padding: 7px 8px !important;
  border: 1px solid rgba(24, 72, 39, .13) !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #31523b !important;
  font: inherit !important;
  font-size: 9.8px !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
}

.makon-media-manual-bg-actions > button.active {
  border-color: rgba(22, 163, 74, .35) !important;
  background: linear-gradient(180deg, #eefbe9, #e5f7df) !important;
  color: #126f32 !important;
  box-shadow: inset 0 0 0 1px rgba(22,163,74,.06) !important;
}

.makon-media-brush-size {
  display: grid !important;
  grid-template-columns: auto minmax(74px, 1fr) 30px !important;
  gap: 7px !important;
  align-items: center !important;
  color: #506058 !important;
  font-size: 9.6px !important;
  font-weight: 800 !important;
}

.makon-media-brush-size input {
  width: 100% !important;
  min-width: 0 !important;
  accent-color: #159447 !important;
}

.makon-media-brush-size output {
  text-align: right !important;
  color: #15803d !important;
  font-weight: 900 !important;
}

.makon-media-manual-reset {
  min-height: 32px !important;
  background: rgba(255,255,255,.75) !important;
}

.makon-media-manual-reset:disabled,
.makon-media-manual-bg-actions > button:disabled {
  opacity: .45 !important;
  cursor: not-allowed !important;
}

.makon-media-frame.is-manual-brush {
  cursor: crosshair !important;
}

.makon-media-frame.is-manual-erase {
  box-shadow: inset 0 0 0 2px rgba(220, 38, 38, .18) !important;
}

.makon-media-frame.is-manual-restore {
  box-shadow: inset 0 0 0 2px rgba(22, 163, 74, .18) !important;
}

body.dark .makon-media-position,
body.dark-theme .makon-media-position,
body.dark .makon-media-manual-bg,
body.dark-theme .makon-media-manual-bg {
  border-color: rgba(255,255,255,.09) !important;
  background: rgba(255,255,255,.035) !important;
}

body.dark .makon-media-position-head > span,
body.dark-theme .makon-media-position-head > span,
body.dark .makon-media-manual-bg-head > span,
body.dark-theme .makon-media-manual-bg-head > span {
  color: #e3ede5 !important;
}

body.dark .makon-media-position-head > small,
body.dark-theme .makon-media-position-head > small,
body.dark .makon-media-manual-bg-head > small,
body.dark-theme .makon-media-manual-bg-head > small,
body.dark .makon-media-brush-size,
body.dark-theme .makon-media-brush-size {
  color: #aeb9b0 !important;
}

body.dark .makon-media-position-pad > button,
body.dark-theme .makon-media-position-pad > button,
body.dark .makon-media-manual-bg-actions > button,
body.dark-theme .makon-media-manual-bg-actions > button,
body.dark .makon-media-manual-reset,
body.dark-theme .makon-media-manual-reset {
  border-color: rgba(255,255,255,.10) !important;
  background: #252b27 !important;
  color: #dce7dd !important;
}

body.dark .makon-media-manual-bg-actions > button.active,
body.dark-theme .makon-media-manual-bg-actions > button.active {
  border-color: rgba(153,228,62,.24) !important;
  background: rgba(153,228,62,.12) !important;
  color: #bdf17e !important;
}

@media (max-width: 720px) {
  .makon-media-position {
    grid-template-columns: 1fr !important;
  }

  .makon-media-position-pad {
    justify-self: center !important;
  }

  .makon-media-manual-bg-actions {
    grid-template-columns: 1fr 1fr 1fr !important;
  }
}

@media (max-width: 420px) {
  .makon-media-manual-bg-actions {
    grid-template-columns: 1fr !important;
  }

  .makon-media-position-pad {
    grid-template-columns: repeat(3, 36px) !important;
    grid-template-rows: repeat(3, 36px) !important;
  }

  .makon-media-position-pad > button {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
  }
}

/* ============================================================
   MAKON V133 — ADD LISTING PHOTO EDITOR / APP-LIKE WORKSPACE
   This is the actual editor used by Add listing (makon-listing-photo-*).
   ============================================================ */

#addListingForm .makon-listing-photo-editor {
  --photo-app-bg: #f3f6f1;
  --photo-app-panel: #ffffff;
  --photo-app-soft: #f7faf5;
  --photo-app-border: rgba(26, 76, 42, .11);
  --photo-app-border-strong: rgba(22, 163, 74, .24);
  --photo-app-text: #173522;
  --photo-app-muted: #718078;
  --photo-app-green: #16a34a;
  position: relative !important;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr) !important;
  gap: 14px !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: none !important;
  margin: 6px 0 0 !important;
  padding: 12px !important;
  overflow: hidden !important;
  border: 1px solid var(--photo-app-border) !important;
  border-radius: 28px !important;
  background: linear-gradient(180deg, #f8faf6 0%, #f2f6ef 100%) !important;
  box-shadow: 0 20px 44px rgba(20, 44, 26, .07) !important;
}

#addListingForm .makon-listing-photo-editor::before {
  content: "PHOTO EDITOR";
  position: absolute;
  z-index: 8;
  top: 24px;
  left: 24px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 999px;
  background: rgba(15, 24, 18, .58);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .14em;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

#addListingForm .makon-listing-photo-frame {
  position: sticky !important;
  top: 12px !important;
  align-self: start !important;
  width: 100% !important;
  max-width: none !important;
  aspect-ratio: 4 / 3 !important;
  border: 1px solid rgba(18, 42, 24, .16) !important;
  border-radius: 22px !important;
  background:
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(-45deg, rgba(255,255,255,.035) 25%, transparent 25%) 0 11px / 22px 22px,
    #192019 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 36px rgba(14, 28, 18, .18) !important;
}

#addListingForm .makon-listing-photo-empty {
  color: rgba(255,255,255,.68) !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

#addListingForm .makon-listing-photo-help {
  min-width: 0 !important;
  max-height: min(72vh, 720px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  display: grid !important;
  align-content: start !important;
  gap: 10px !important;
  padding: 12px !important;
  border: 1px solid var(--photo-app-border) !important;
  border-radius: 22px !important;
  background: rgba(255,255,255,.96) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85) !important;
  scrollbar-width: none !important;
}

#addListingForm .makon-listing-photo-help::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}

#addListingForm .makon-listing-photo-tool-tabs {
  position: sticky !important;
  z-index: 12 !important;
  top: -12px !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0,1fr)) !important;
  gap: 6px !important;
  margin: -12px -12px 2px !important;
  padding: 10px 12px !important;
  border-bottom: 1px solid rgba(26, 76, 42, .08) !important;
  background: rgba(255,255,255,.94) !important;
  backdrop-filter: blur(16px);
}

#addListingForm .makon-listing-photo-tool-tabs button {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 54px !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  place-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  padding: 7px 5px !important;
  border: 1px solid transparent !important;
  border-radius: 14px !important;
  background: transparent !important;
  color: #68766d !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

#addListingForm .makon-listing-photo-tool-tabs button span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eff4ec;
  color: #31523b;
  font-size: 15px;
  font-weight: 900;
}

#addListingForm .makon-listing-photo-tool-tabs button b {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 9.5px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#addListingForm .makon-listing-photo-tool-tabs button.active {
  border-color: rgba(22,163,74,.16) !important;
  background: #eef9e9 !important;
  color: #127d39 !important;
}

#addListingForm .makon-listing-photo-tool-tabs button.active span {
  background: #18a94b !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(24,169,75,.18);
}

#addListingForm .makon-listing-photo-badges {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 7px !important;
}

#addListingForm .makon-listing-photo-badge,
#addListingForm .makon-listing-photo-bg-status {
  min-height: 30px !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 0 10px !important;
  border: 1px solid rgba(24,72,39,.08) !important;
  border-radius: 999px !important;
  background: #f3f7f1 !important;
  color: #52645a !important;
  font-size: 10.5px !important;
  font-weight: 850 !important;
}

#addListingForm .makon-listing-photo-badge {
  border-color: rgba(22,163,74,.13) !important;
  background: #eaf8e5 !important;
  color: #147b39 !important;
}

#addListingForm .makon-listing-photo-heading {
  gap: 3px !important;
  padding: 2px 2px 0 !important;
}

#addListingForm .makon-listing-photo-heading strong {
  color: var(--photo-app-text) !important;
  font-size: 17px !important;
  font-weight: 950 !important;
  letter-spacing: -.015em;
}

#addListingForm .makon-listing-photo-heading p {
  color: var(--photo-app-muted) !important;
  font-size: 11.5px !important;
  line-height: 1.42 !important;
}

#addListingForm .makon-listing-photo-zoom,
#addListingForm .makon-listing-resize-controls,
#addListingForm .makon-listing-bg-removal,
#addListingForm .makon-listing-photo-background {
  gap: 10px !important;
  padding: 12px !important;
  border: 1px solid rgba(24,72,39,.09) !important;
  border-radius: 17px !important;
  background: linear-gradient(180deg, #ffffff, #f8fbf6) !important;
  box-shadow: none !important;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease !important;
}

#addListingForm .makon-listing-photo-zoom.is-tool-highlight,
#addListingForm .makon-listing-resize-controls.is-tool-highlight,
#addListingForm .makon-listing-bg-removal.is-tool-highlight,
#addListingForm .makon-listing-photo-background.is-tool-highlight {
  border-color: rgba(22,163,74,.34) !important;
  box-shadow: 0 0 0 3px rgba(22,163,74,.08) !important;
}

#addListingForm .makon-listing-photo-zoom-head,
#addListingForm .makon-listing-resize-head,
#addListingForm .makon-listing-bg-removal-head,
#addListingForm .makon-listing-photo-background-head {
  color: #264633 !important;
}

#addListingForm .makon-listing-photo-zoom-head > span,
#addListingForm .makon-listing-resize-head > span,
#addListingForm .makon-listing-bg-removal-head > span,
#addListingForm .makon-listing-photo-background-head > span {
  font-size: 12px !important;
  font-weight: 900 !important;
}

#addListingForm .makon-listing-bg-removal-head small,
#addListingForm .makon-listing-photo-background-head small,
#addListingForm .makon-listing-resize-controls > small {
  color: #7b8980 !important;
  font-size: 10px !important;
  line-height: 1.35 !important;
}

#addListingForm .makon-listing-photo-zoom-row {
  grid-template-columns: 42px minmax(0,1fr) 42px !important;
  gap: 8px !important;
}

#addListingForm .makon-listing-photo-zoom-row button,
#addListingForm .makon-listing-photo-presets button,
#addListingForm .makon-listing-resize-actions button,
#addListingForm .makon-listing-bg-removal-actions button,
#addListingForm .makon-listing-photo-background-modes button,
#addListingForm .makon-listing-photo-reset {
  min-height: 40px !important;
  border: 1px solid rgba(24,72,39,.10) !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: #274b33 !important;
  box-shadow: none !important;
  font-size: 11px !important;
  font-weight: 850 !important;
}

#addListingForm .makon-listing-photo-zoom-row button {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  font-size: 22px !important;
}

#addListingForm .makon-listing-photo-presets,
#addListingForm .makon-listing-resize-actions,
#addListingForm .makon-listing-bg-removal-actions,
#addListingForm .makon-listing-photo-background-modes {
  gap: 7px !important;
}

#addListingForm .makon-listing-photo-presets button:hover,
#addListingForm .makon-listing-resize-actions button:hover,
#addListingForm .makon-listing-bg-removal-actions button:hover,
#addListingForm .makon-listing-photo-background-modes button:hover,
#addListingForm .makon-listing-photo-reset:hover,
#addListingForm .makon-listing-photo-zoom-row button:hover {
  border-color: rgba(22,163,74,.24) !important;
  background: #f3faf0 !important;
  transform: translateY(-1px);
}

#addListingForm .makon-listing-photo-background-modes button.active,
#addListingForm .makon-listing-aspect-lock.active {
  border-color: rgba(22,163,74,.34) !important;
  background: #eaf8e5 !important;
  color: #117b38 !important;
}

#addListingForm .makon-listing-photo-color-palette {
  flex-wrap: nowrap !important;
  gap: 7px !important;
  overflow-x: auto !important;
  padding: 2px 1px 4px !important;
  scrollbar-width: none !important;
}

#addListingForm .makon-listing-photo-color-palette::-webkit-scrollbar {
  display: none !important;
}

#addListingForm .makon-bg-swatch,
#addListingForm .makon-listing-photo-custom-color {
  flex: 0 0 auto !important;
}

#addListingForm .makon-listing-photo-footer-controls {
  position: sticky !important;
  bottom: -12px !important;
  z-index: 10 !important;
  grid-template-columns: minmax(0,1fr) auto !important;
  gap: 8px !important;
  margin: 2px -12px -12px !important;
  padding: 10px 12px !important;
  border-top: 1px solid rgba(24,72,39,.08) !important;
  background: rgba(255,255,255,.95) !important;
  backdrop-filter: blur(14px);
}

#addListingForm .makon-listing-photo-meta {
  color: #6d7b72 !important;
  font-size: 10.5px !important;
  line-height: 1.35 !important;
}

#addListingForm .makon-listing-photo-reset {
  min-width: 118px !important;
  padding: 0 14px !important;
}

#addListingForm .makon-listing-photo-focus {
  width: 24px !important;
  height: 24px !important;
  border-width: 2px !important;
  box-shadow: 0 0 0 4px rgba(24,169,75,.16), 0 5px 18px rgba(0,0,0,.30) !important;
}

#addListingForm .makon-listing-resize-handle {
  box-shadow: 0 0 0 3px rgba(24,169,75,.12), 0 5px 12px rgba(0,0,0,.22) !important;
}

/* Tablet: preview stays generous, controls below */
@media (max-width: 980px) {
  #addListingForm .makon-listing-photo-editor {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 10px !important;
    border-radius: 24px !important;
  }

  #addListingForm .makon-listing-photo-frame {
    position: relative !important;
    top: auto !important;
    max-width: 720px !important;
    margin-inline: auto !important;
  }

  #addListingForm .makon-listing-photo-help {
    max-height: none !important;
    overflow: visible !important;
  }

  #addListingForm .makon-listing-photo-tool-tabs {
    top: 0 !important;
  }
}

/* Phone: editor behaves like a compact mobile app sheet */
@media (max-width: 640px) {
  #addListingForm .form-field:has(> input[name="photo"]) {
    margin-inline: -2px !important;
  }

  #addListingForm .makon-listing-photo-editor {
    gap: 8px !important;
    margin: 4px -2px 0 !important;
    padding: 8px !important;
    border-radius: 20px !important;
    box-shadow: none !important;
  }

  #addListingForm .makon-listing-photo-editor::before {
    top: 18px;
    left: 18px;
    min-height: 24px;
    padding-inline: 8px;
    font-size: 8px;
  }

  #addListingForm .makon-listing-photo-frame {
    border-radius: 17px !important;
    box-shadow: 0 10px 22px rgba(14,28,18,.14) !important;
  }

  #addListingForm .makon-listing-photo-help {
    gap: 8px !important;
    padding: 9px !important;
    border-radius: 17px !important;
    box-shadow: none !important;
  }

  #addListingForm .makon-listing-photo-tool-tabs {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 7px !important;
    margin: -9px -9px 1px !important;
    padding: 8px 9px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  #addListingForm .makon-listing-photo-tool-tabs::-webkit-scrollbar {
    display: none !important;
  }

  #addListingForm .makon-listing-photo-tool-tabs button {
    flex: 0 0 78px !important;
    min-height: 52px !important;
    border-radius: 13px !important;
  }

  #addListingForm .makon-listing-photo-heading strong {
    font-size: 15px !important;
  }

  #addListingForm .makon-listing-photo-heading p {
    display: none !important;
  }

  #addListingForm .makon-listing-photo-zoom,
  #addListingForm .makon-listing-resize-controls,
  #addListingForm .makon-listing-bg-removal,
  #addListingForm .makon-listing-photo-background {
    padding: 10px !important;
    border-radius: 15px !important;
  }

  #addListingForm .makon-listing-photo-zoom-row {
    grid-template-columns: 44px minmax(0,1fr) 44px !important;
  }

  #addListingForm .makon-listing-photo-zoom-row button {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  #addListingForm .makon-listing-photo-presets,
  #addListingForm .makon-listing-resize-actions,
  #addListingForm .makon-listing-bg-removal-actions,
  #addListingForm .makon-listing-photo-background-modes {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }

  #addListingForm .makon-listing-photo-footer-controls {
    bottom: -9px !important;
    grid-template-columns: 1fr !important;
    margin: 1px -9px -9px !important;
    padding: 9px !important;
  }

  #addListingForm .makon-listing-photo-reset {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
  }

  #addListingForm .makon-listing-photo-meta {
    font-size: 10px !important;
  }
}

@media (max-width: 390px) {
  #addListingForm .makon-listing-photo-tool-tabs button {
    flex-basis: 72px !important;
  }

  #addListingForm .makon-listing-photo-badges {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }

  #addListingForm .makon-listing-photo-badge,
  #addListingForm .makon-listing-photo-bg-status {
    justify-content: center !important;
    min-width: 0 !important;
    padding-inline: 7px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Dark mode */
body.dark #addListingForm .makon-listing-photo-editor,
body.dark-theme #addListingForm .makon-listing-photo-editor {
  --photo-app-border: rgba(255,255,255,.08);
  --photo-app-text: #edf6ee;
  --photo-app-muted: #aebbb1;
  background: linear-gradient(180deg, #171d18, #141a16) !important;
  box-shadow: 0 22px 48px rgba(0,0,0,.24) !important;
}

body.dark #addListingForm .makon-listing-photo-help,
body.dark-theme #addListingForm .makon-listing-photo-help,
body.dark #addListingForm .makon-listing-photo-tool-tabs,
body.dark-theme #addListingForm .makon-listing-photo-tool-tabs,
body.dark #addListingForm .makon-listing-photo-footer-controls,
body.dark-theme #addListingForm .makon-listing-photo-footer-controls {
  background: rgba(27,34,29,.96) !important;
  border-color: rgba(255,255,255,.07) !important;
}

body.dark #addListingForm .makon-listing-photo-zoom,
body.dark #addListingForm .makon-listing-resize-controls,
body.dark #addListingForm .makon-listing-bg-removal,
body.dark #addListingForm .makon-listing-photo-background,
body.dark-theme #addListingForm .makon-listing-photo-zoom,
body.dark-theme #addListingForm .makon-listing-resize-controls,
body.dark-theme #addListingForm .makon-listing-bg-removal,
body.dark-theme #addListingForm .makon-listing-photo-background {
  background: rgba(255,255,255,.035) !important;
  border-color: rgba(255,255,255,.07) !important;
}

body.dark #addListingForm .makon-listing-photo-heading strong,
body.dark-theme #addListingForm .makon-listing-photo-heading strong,
body.dark #addListingForm .makon-listing-photo-zoom-head,
body.dark-theme #addListingForm .makon-listing-photo-zoom-head,
body.dark #addListingForm .makon-listing-resize-head,
body.dark-theme #addListingForm .makon-listing-resize-head,
body.dark #addListingForm .makon-listing-bg-removal-head,
body.dark-theme #addListingForm .makon-listing-bg-removal-head,
body.dark #addListingForm .makon-listing-photo-background-head,
body.dark-theme #addListingForm .makon-listing-photo-background-head {
  color: #edf6ee !important;
}
