:root {
            --primary-color: #000000;
            --secondary-color: #333333;
            --accent-color: #000000;
            --light-bg: #f8f9fa;
            --border-color: #dee2e6;
            --sidebar-width: 340px;
            --viewer-surface: #ebebeb;
        }

        html {
            margin: 0;
            padding: 0;
            min-height: 100%;
            background-color: var(--light-bg);
            max-width: 100%;
            width: 100%;
        }

        html:not(.itqan-editor-active) {
            overflow-x: visible;
        }

        body,
        body.bg-light-subtle {
            margin: 0;
            padding: 0;
            min-height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: var(--light-bg) !important;
        }

        html:not(.itqan-editor-active) body.bg-light-subtle {
            overflow-x: visible;
            overflow-y: auto;
        }

        html.itqan-editor-active {
            height: 100%;
            overflow: hidden;
        }

        html.itqan-editor-active body.bg-light-subtle {
            overflow: hidden !important;
            height: 100%;
            max-height: 100dvh;
        }

        html.itqan-editor-active nav.navbar.navbar-expand-xl.navbar-dark.bg-dark {
            position: sticky;
            top: 0;
            z-index: 1040;
        }

        html.itqan-editor-active .navbar .dropdown-menu {
            z-index: 1060 !important;
        }

        @media (min-width: 1200px) {
            html.itqan-editor-active .navbar.navbar-expand-xl #navbarNav.collapse.navbar-collapse {
                max-height: none !important;
                overflow: visible !important;
            }
        }

        .upload-area {
            position: relative;
            cursor: pointer;
            isolation: isolate;
            transition: background-color 0.3s ease, border-color 0.3s ease;
            border: 2px dashed #ced4da;
            border-radius: 12px;
            background: var(--light-bg, #f8f9fa);
            min-height: auto;
        }

        .upload-area:hover,
        .upload-area.dragover {
            background-color: #eef0f2;
            border-color: #6b7280 !important;
        }

        #dropArea,
        .upload-area.card {
            overflow: visible;
            max-width: 100%;
            --bs-card-bg: #f8f9fa;
            background-color: #f8f9fa !important;
            background: #f8f9fa !important;
            box-shadow: none !important;
            border: 2px dashed #ced4da !important;
        }

        .container.my-5 > .row.justify-content-center > .col-lg-8 {
            min-width: 0;
        }

        #upload-section #imagesUpload {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            opacity: 0;
            cursor: pointer;
            z-index: 10;
        }

        #upload-section #selectFileBtn {
            min-width: 240px;
        }

        .cloud-upload-btn {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid #dee2e6;
            background: white;
            transition: all 0.3s;
            cursor: pointer;
            padding: 0;
            position: relative;
            z-index: 100;
        }

        .cloud-upload-btn:hover {
            border-color: #000;
            transform: scale(1.1);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        }

        .cloud-icon {
            position: relative;
            display: inline-block;
            transition: transform 0.3s ease;
            z-index: 101;
        }

        .cloud-tooltip {
            visibility: hidden;
            width: 140px;
            background-color: #333;
            color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 8px 5px;
            position: absolute;
            z-index: 1000;
            bottom: 125%;
            left: 50%;
            margin-left: -70px;
            opacity: 0;
            transition: opacity 0.3s;
            font-size: 12px;
            white-space: nowrap;
            pointer-events: none;
        }

        .cloud-tooltip::after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: #333 transparent transparent transparent;
        }

        .cloud-icon:hover .cloud-tooltip {
            visibility: visible;
            opacity: 1;
        }

        #adContainer {
            margin: 20px 0;
            text-align: center;
            overflow: hidden;
            max-width: 100%;
            box-sizing: border-box;
        }

        #adContainer ins.adsbygoogle {
            display: block !important;
            width: min(100%, 728px) !important;
            max-width: 100% !important;
            margin-left: auto !important;
            margin-right: auto !important;
        }

        .main-editor {
            display: none;
            height: calc(100vh - 60px);
            flex-direction: row;
            min-width: 0;
            min-height: 0;
        }

        html.itqan-editor-active #imgeditEditorSection.main-editor {
            display: flex !important;
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            top: var(--itqan-editor-top, 72px);
            height: auto !important;
            min-height: 0 !important;
            box-sizing: border-box;
            z-index: 1;
        }

        #imgeditEditorSection .sidebar {
            width: var(--sidebar-width);
            min-width: var(--sidebar-width);
            flex: 0 0 var(--sidebar-width);
            background: #fff;
            border-left: 1px solid #ddd;
            display: flex;
            flex-direction: column;
            position: relative;
            z-index: 1;
            overflow: hidden;
            min-height: 0;
            height: 100%;
        }

        #imgeditEditorSection .sidebar .merge-sidebar-body {
            flex: 1 1 auto;
            min-height: 0;
            overflow-x: hidden;
            overflow-y: auto;
            padding-top: 0;
        }

        .merge-sidebar-header {
            flex-shrink: 0;
            padding: 16px 18px;
            border-bottom: 1px solid #eee;
            font-weight: 700;
            font-size: 17px;
            background: #fff;
            text-align: center;
            color: #222;
        }

        .merge-sidebar-body {
            padding: 16px 18px 12px;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        #imgeditEditorSection .sidebar > .merge-sidebar-footer {
            flex-shrink: 0;
            margin-top: auto;
            padding: 14px 18px 18px;
            border-top: 1px solid #eee;
            background: #fff;
        }

        .merge-sidebar-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .merge-sidebar-label {
            font-size: 0.8rem;
            font-weight: 700;
            color: #666;
            text-align: center;
            margin: 0;
        }

        #imgeditEditorSection .merge-cloud-stack {
            display: flex;
            flex-direction: row;
            gap: 12px;
            align-items: center;
            justify-content: center;
            padding: 12px 14px;
            background: #f8f9fa;
            border: 1px dashed #dee2e6;
            border-radius: 10px;
            width: 100%;
            box-sizing: border-box;
        }

        .merge-sidebar-help-btn {
            width: 100%;
            margin: 0 0 0.85rem;
            padding: 0.55rem 0.75rem;
            font-size: 0.82rem;
            font-weight: 600;
            border: 1px dashed var(--border-color);
            border-radius: 8px;
            background: #fff;
            color: #333;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.45rem;
        }

        .merge-sidebar-help-btn:hover {
            background: #f8f9fa;
            border-color: #adb5bd;
            color: #111;
        }

        .merge-stats-sidebar.stats-card {
            display: flex;
            flex-direction: column;
            gap: 0;
            margin: 0;
            width: 100%;
            background: transparent;
            border: none;
            padding: 0;
        }

        .merge-stats-sidebar .merge-stat-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 0;
            border-bottom: 1px solid #f0f0f0;
        }

        .merge-stats-sidebar .merge-stat-item:last-child {
            border-bottom: 0;
        }

        .merge-stats-sidebar .merge-stat-icon {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: #111;
            color: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            flex-shrink: 0;
        }

        .merge-stats-sidebar .merge-stat-text strong {
            display: block;
            font-size: 0.95rem;
            line-height: 1.15;
        }

        .merge-stats-sidebar .merge-stat-text small {
            font-size: 0.72rem;
            color: #888;
        }

        .merge-sidebar-btn-clear {
            width: 100%;
            padding: 10px 14px;
            border-radius: 10px;
            border: 1px solid #ddd;
            background: #f5f5f5;
            color: #444;
            font-weight: 600;
            font-size: 0.9rem;
            cursor: pointer;
        }

        .merge-sidebar-btn-clear:hover {
            background: #eee;
            border-color: #bbb;
            color: #222;
        }

        .btn-finish {
            background: #000;
            color: #fff;
            width: 100%;
            border: none;
            padding: 15px;
            font-size: 18px;
            font-weight: 700;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .btn-finish:hover:not(:disabled) {
            background: #222;
            color: #fff;
        }

        .btn-finish:disabled {
            opacity: 0.55;
            cursor: not-allowed;
        }

        .btn-finish.imgedit-finish {
            background: #111111;
        }

        .btn-finish.imgedit-finish:hover:not(:disabled) {
            background: #000000;
            color: #fff;
        }

        .viewer-container {
            flex: 1 1 auto;
            min-width: 0;
            min-height: 0;
            background: var(--viewer-surface);
            overflow: hidden;
            padding: 0 12px 12px;
            height: 100%;
            display: flex;
            flex-direction: column;
        }

        .imgedit-stage-wrap {
            flex: 1 1 auto;
            min-height: 0;
            min-width: 0;
            max-width: 100%;
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            grid-template-rows: auto 1fr;
            grid-template-areas:
                "chrome"
                "stage";
            overflow: hidden;
            position: relative;
        }

        .imgedit-toolbar {
            grid-area: chrome;
            flex-shrink: 0;
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            align-items: stretch;
            gap: 4px;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
            background: #f0f1f3;
            border: 1px solid #e0e2e6;
            border-radius: 10px;
            padding: 8px 10px;
            margin: 10px 0 8px;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
            position: relative;
            z-index: 5;
        }

        /* عند فتح أداة: الشريط الرئيسي يختفي ويظهر شريط الإلغاء/التطبيق مكانه */
        .imgedit-stage-wrap.is-tool-open .imgedit-toolbar {
            display: none !important;
        }

        .imgedit-tool-btn {
            flex: 0 0 auto;
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 5px;
            min-width: 78px;
            max-width: 110px;
            padding: 8px 10px;
            border: 1px solid transparent;
            border-radius: 8px;
            background: transparent;
            color: #333;
            cursor: pointer;
            transition: background 0.15s, border-color 0.15s, color 0.15s;
        }

        .imgedit-tool-btn i {
            font-size: 18px;
            color: #444;
        }

        .imgedit-tool-btn span {
            font-size: 0.68rem;
            font-weight: 600;
            line-height: 1.25;
            text-align: center;
            white-space: normal;
        }

        .imgedit-tool-btn:hover {
            background: #fff;
            border-color: #d0d5dd;
        }

        .imgedit-tool-btn.active {
            background: #fff;
            border-color: #111111;
            color: #111111;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
        }

        .imgedit-tool-btn.active i {
            color: #111111;
        }

        /* يستبدل شريط الأدوات الرئيسي في نفس المكان */
        .imgedit-panels {
            grid-area: chrome;
            display: none;
            background: transparent;
            border: none;
            border-radius: 0;
            padding: 0;
            margin: 10px 0 8px;
            min-height: 0;
            min-width: 0;
            max-width: 100%;
            z-index: 6;
        }

        .imgedit-panels.is-open {
            display: block;
        }

        .imgedit-panels .imgedit-panel {
            pointer-events: auto;
        }

        .imgedit-panel {
            display: none;
            background: #f0f1f3;
            border: 1px solid #e0e2e6;
            border-radius: 10px;
            padding: 8px 12px;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
        }

        .imgedit-panel-title {
            display: none;
        }

        .imgedit-panel-row {
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            gap: 10px;
            width: 100%;
        }

        .imgedit-panel-tools {
            flex: 1 1 auto;
            min-width: 0;
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            justify-content: center;
            gap: 8px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
        }

        .imgedit-panel-actions {
            display: none;
        }

        .imgedit-field-row {
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            gap: 10px 14px;
        }

        .imgedit-panel-hint {
            font-size: 0.86rem;
            font-weight: 600;
            color: #555;
            white-space: nowrap;
        }

        .imgedit-text-tools {
            gap: 8px 10px;
        }

        .imgedit-draw-tools {
            gap: 10px 12px;
        }

        /* منتقي حجم الفرشاة */
        .imgedit-brush-size {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 10px;
            background: #fff;
            border: 1px solid #e0e2e6;
            border-radius: 999px;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
        }

        .imgedit-brush-size__label {
            font-size: 0.72rem;
            font-weight: 700;
            color: #666;
            white-space: nowrap;
            margin-inline-end: 2px;
        }

        .imgedit-brush-size-btn {
            flex: 0 0 auto;
            width: 34px;
            height: 34px;
            border: 2px solid transparent;
            border-radius: 50%;
            background: transparent;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            transition: border-color .15s, background .15s, transform .12s;
        }

        .imgedit-brush-size-btn:hover {
            background: #f4f7ff;
            border-color: #c8d8ff;
        }

        .imgedit-brush-size-btn.active {
            border-color: #4d7cff;
            background: #eef3ff;
            box-shadow: 0 0 0 2px rgba(77, 124, 255, 0.15);
        }

        .imgedit-brush-size-btn__dot {
            display: block;
            border-radius: 50%;
            background: #222;
            pointer-events: none;
        }

        .imgedit-brush-size-btn.active .imgedit-brush-size-btn__dot {
            background: #4d7cff;
        }

        /* أنواع الفرشاة */
        .imgedit-brush-types {
            gap: 8px;
            flex-wrap: nowrap;
            justify-content: center;
        }

        .imgedit-brush-type-btn {
            flex: 0 0 auto;
            width: 52px;
            height: 52px;
            border: 2px solid #e0e2e6;
            border-radius: 10px;
            background: #fff;
            cursor: pointer;
            padding: 4px;
            transition: border-color .15s, box-shadow .15s, transform .12s;
        }

        .imgedit-brush-type-btn:hover {
            border-color: #4d7cff;
            transform: translateY(-1px);
        }

        .imgedit-brush-type-btn.active {
            border-color: #4d7cff;
            box-shadow: 0 0 0 2px rgba(77, 124, 255, 0.18);
        }

        .imgedit-brush-type-btn__preview {
            display: block;
            width: 100%;
            height: 100%;
            border-radius: 6px;
            background: #f5f6f8 center / cover no-repeat;
        }

        .imgedit-brush-type-btn__preview.is-pencil {
            background-image: radial-gradient(circle at 50% 50%, #111 0 38%, transparent 40%);
            background-size: 100% 100%;
        }

        .imgedit-brush-type-btn__preview.is-circle {
            background:
                radial-gradient(circle at 30% 55%, #111 0 22%, transparent 24%),
                radial-gradient(circle at 55% 40%, #111 0 18%, transparent 20%),
                radial-gradient(circle at 70% 65%, #111 0 14%, transparent 16%);
        }

        .imgedit-brush-type-btn__preview.is-spray {
            background:
                radial-gradient(circle at 20% 30%, #111 0 1px, transparent 2px),
                radial-gradient(circle at 40% 50%, #111 0 1px, transparent 2px),
                radial-gradient(circle at 60% 35%, #111 0 1px, transparent 2px),
                radial-gradient(circle at 75% 60%, #111 0 1px, transparent 2px),
                radial-gradient(circle at 35% 70%, #111 0 1px, transparent 2px),
                radial-gradient(circle at 55% 75%, #111 0 1px, transparent 2px);
            background-color: #f5f6f8;
        }

        .imgedit-brush-type-btn__preview.is-vstripes {
            background: repeating-linear-gradient(90deg, #111 0 2px, transparent 2px 5px);
        }

        .imgedit-brush-type-btn__preview.is-hstripes {
            background: repeating-linear-gradient(0deg, #111 0 2px, transparent 2px 5px);
        }

        .imgedit-brush-type-btn__preview.is-grid {
            background:
                repeating-linear-gradient(90deg, #111 0 1px, transparent 1px 6px),
                repeating-linear-gradient(0deg, #111 0 1px, transparent 1px 6px);
        }

        .imgedit-brush-type-btn__preview.is-dots {
            background:
                radial-gradient(circle at 25% 25%, #111 0 2px, transparent 3px),
                radial-gradient(circle at 75% 25%, #111 0 2px, transparent 3px),
                radial-gradient(circle at 25% 75%, #111 0 2px, transparent 3px),
                radial-gradient(circle at 75% 75%, #111 0 2px, transparent 3px);
        }

        .imgedit-brush-type-btn__preview.is-marker {
            background: linear-gradient(180deg, rgba(17, 17, 17, 0.15) 0%, rgba(17, 17, 17, 0.85) 100%);
            border-radius: 4px;
        }

        .imgedit-brush-type-btn__preview.is-calligraphy {
            background:
                radial-gradient(ellipse 60% 40% at 35% 50%, #111 0 35%, transparent 38%),
                radial-gradient(ellipse 40% 60% at 65% 50%, #111 0 30%, transparent 33%);
        }

        /* شريط الأشكال — تنقل أفقي فقط داخل صف الأشكال */
        .imgedit-shapes-scroll {
            flex: 1 1 auto;
            width: 100%;
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 6px;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
            padding: 2px 4px;
        }

        .imgedit-shape-btn {
            flex: 0 0 auto;
            width: 40px;
            height: 40px;
            border: 2px solid #e0e2e6;
            border-radius: 10px;
            background: #fff;
            color: #222;
            font-size: 1.05rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            transition: border-color .15s, background .15s, transform .12s;
        }

        .imgedit-shape-btn:hover,
        .imgedit-shape-btn.active {
            border-color: #4d7cff;
            background: #eef3ff;
            color: #1a1a1a;
        }

        .imgedit-shape-ico {
            width: 22px;
            height: 22px;
            display: block;
            flex-shrink: 0;
        }

        #imgeditPanel_shapes {
            min-width: 0;
            max-width: 100%;
            overflow: hidden;
        }

        #imgeditPanel_shapes .imgedit-panel-row {
            min-width: 0;
            max-width: 100%;
        }

        /* صف أدوات الشكل: لا تمرير هنا حتى لا يختفي اللون/السماكة */
        .imgedit-shape-tools {
            gap: 10px 12px;
            flex-wrap: nowrap;
            overflow: visible;
            justify-content: center;
            flex: 1 1 auto;
            min-width: 0;
        }

        .imgedit-shapes-row {
            margin-top: 6px;
            min-width: 0;
            max-width: 100%;
        }

        .imgedit-shapes-row .imgedit-shapes-scroll {
            justify-content: flex-start;
        }

        /* رموز تعبيرية — فئات + شريط عناصر */
        #imgeditPanel_stickers {
            min-width: 0;
            max-width: 100%;
            overflow: hidden;
        }
        #imgeditPanel_stickers .imgedit-panel-row {
            min-width: 0;
            max-width: 100%;
        }
        .imgedit-sticker-tools {
            gap: 10px 12px;
            flex-wrap: nowrap;
            overflow: visible;
            justify-content: center;
            flex: 1 1 auto;
            min-width: 0;
        }
        .imgedit-sticker-controls {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            gap: 12px;
            padding: 5px 10px;
            background: #fff;
            border: 1px solid #e0e2e6;
            border-radius: 10px;
            white-space: nowrap;
        }
        .imgedit-sticker-cats-row,
        .imgedit-stickers-items-row {
            margin-top: 6px;
            min-width: 0;
            max-width: 100%;
        }
        .imgedit-sticker-cats-scroll,
        .imgedit-stickers-scroll {
            flex: 1 1 auto;
            width: 100%;
            min-width: 0;
            display: flex;
            align-items: stretch;
            gap: 8px;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
            padding: 4px 2px 6px;
        }
        .imgedit-sticker-cat {
            flex: 0 0 auto;
            width: 92px;
            min-height: 78px;
            border: 1px solid #e4e6eb;
            border-radius: 12px;
            background: #fff;
            color: #333;
            cursor: pointer;
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 8px 6px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.04);
            transition: border-color .15s, box-shadow .15s, background .15s;
        }
        .imgedit-sticker-cat:hover {
            border-color: #c9ced8;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }
        .imgedit-sticker-cat.is-active {
            border-color: #9eb6ff;
            background: #f5f8ff;
            box-shadow: 0 3px 10px rgba(60, 100, 200, 0.18);
        }
        .imgedit-sticker-cat__ico {
            font-size: 1.55rem;
            line-height: 1;
        }
        .imgedit-sticker-cat__label {
            font-size: 0.72rem;
            font-weight: 600;
            text-align: center;
            line-height: 1.25;
            color: #444;
        }
        .imgedit-sticker-btn {
            flex: 0 0 auto;
            width: 48px;
            height: 48px;
            border: 1px solid #e0e2e6;
            border-radius: 12px;
            background: #f3f4f6;
            font-size: 1.45rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
        }
        .imgedit-sticker-btn:hover,
        .imgedit-sticker-btn.active {
            border-color: #b8c0cc;
            background: #fff;
            box-shadow: 0 3px 10px rgba(0,0,0,0.1);
            transform: translateY(-1px);
        }

        /* لون + سماكة — ظاهران دائماً في الصف الأول */
        .imgedit-shape-controls {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            gap: 12px;
            padding: 5px 10px;
            background: #fff;
            border: 1px solid #e0e2e6;
            border-radius: 10px;
            white-space: nowrap;
            max-width: 100%;
        }

        .imgedit-shape-controls .imgedit-field {
            margin: 0;
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .imgedit-shape-controls input[type="color"] {
            width: 40px;
            height: 34px;
            min-width: 40px;
            padding: 2px;
            border: 1px solid #c5cad3;
            border-radius: 6px;
            background: #fff;
            cursor: pointer;
            flex-shrink: 0;
            box-sizing: border-box;
        }

        .imgedit-shape-controls input[type="range"] {
            width: 110px;
            min-width: 90px;
        }

        .imgedit-shape-controls .imgedit-field > span {
            font-size: 0.8rem;
            font-weight: 700;
            color: #333;
        }

        /* قوالب لون الخلفية — مثل إزالة الخلفية */
        .imgedit-bg-swatches {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            flex-wrap: nowrap;
        }

        .imgedit-bg-swatch {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
            min-width: 58px;
            padding: 6px 8px;
            border: 2px solid #e0e2e6;
            border-radius: 10px;
            background: #fff;
            cursor: pointer;
            font: inherit;
            color: #333;
            position: relative;
            margin: 0;
            transition: border-color .15s, box-shadow .15s;
        }

        .imgedit-bg-swatch:hover {
            border-color: #bbb;
        }

        .imgedit-bg-swatch.is-active {
            border-color: #111;
            box-shadow: 0 0 0 1px #111;
        }

        .imgedit-bg-swatch__preview {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            display: block;
            box-sizing: border-box;
        }

        .imgedit-bg-swatch__preview--checker {
            background-color: #cfcfcf;
            background-image:
                linear-gradient(45deg, #bdbdbd 25%, transparent 25%),
                linear-gradient(-45deg, #bdbdbd 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #bdbdbd 75%),
                linear-gradient(-45deg, transparent 75%, #bdbdbd 75%);
            background-size: 10px 10px;
            background-position: 0 0, 0 5px, 5px -5px, -5px 0;
            border: 1px solid #ccc;
        }

        .imgedit-bg-swatch__label {
            font-size: 0.72rem;
            font-weight: 700;
            line-height: 1.2;
            text-align: center;
            white-space: nowrap;
        }

        .imgedit-bg-swatch--custom input[type="color"] {
            position: absolute;
            inset: 0;
            opacity: 0;
            cursor: pointer;
            width: 100%;
            height: 100%;
        }

        .imgedit-text-input {
            display: none;
        }

        .imgedit-panel-btn--danger {
            border-color: #f0c9c9;
            color: #c0392b;
        }

        .imgedit-panel-btn--danger:hover {
            border-color: #e74c3c;
            color: #a93226;
            background: #fef2f2;
        }

        .imgedit-select {
            border: 1px solid #d0d5dd;
            border-radius: 8px;
            padding: 5px 8px;
            font-size: 0.82rem;
            background: #fff;
            max-width: 150px;
        }

        .imgedit-aspect-row {
            gap: 6px;
        }

        .imgedit-aspect-btn {
            border: 1px solid #d8dce2;
            background: #fff;
            color: #333;
            border-radius: 8px;
            padding: 6px 12px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
            transition: border-color .15s, color .15s, background .15s;
        }

        .imgedit-aspect-btn.active,
        .imgedit-aspect-btn:hover {
            border-color: #111111;
            color: #111111;
            background: #f5f5f5;
        }

        .imgedit-field {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.82rem;
            font-weight: 600;
            color: #555;
        }

        .imgedit-field input[type="range"],
        .imgedit-shape-controls input[type="range"] {
            accent-color: #111111;
            -webkit-appearance: none;
            appearance: none;
            height: 6px;
            border-radius: 999px;
            background: #d0d5dd;
            outline: none;
        }
        .imgedit-field input[type="range"] {
            width: 120px;
        }
        .imgedit-shape-controls input[type="range"] {
            width: 110px;
            min-width: 90px;
        }
        .imgedit-field input[type="range"]::-webkit-slider-thumb,
        .imgedit-shape-controls input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #111111;
            border: none;
            cursor: pointer;
            margin-top: -5px;
        }
        .imgedit-field input[type="range"]::-webkit-slider-runnable-track,
        .imgedit-shape-controls input[type="range"]::-webkit-slider-runnable-track {
            height: 6px;
            border-radius: 999px;
            background: #d0d5dd;
        }
        .imgedit-field input[type="range"]::-moz-range-thumb,
        .imgedit-shape-controls input[type="range"]::-moz-range-thumb {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #111111;
            border: none;
            cursor: pointer;
        }
        .imgedit-field input[type="range"]::-moz-range-track,
        .imgedit-shape-controls input[type="range"]::-moz-range-track {
            height: 6px;
            border-radius: 999px;
            background: #d0d5dd;
        }
        .imgedit-field input[type="range"]::-moz-range-progress,
        .imgedit-shape-controls input[type="range"]::-moz-range-progress {
            height: 6px;
            border-radius: 999px;
            background: #111111;
        }
        .imgedit-field--radius {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            flex-direction: row;
            white-space: nowrap;
        }
        .imgedit-field--radius input[type="range"] {
            width: min(280px, 42vw);
            min-width: 140px;
            accent-color: #111111;
        }

        .imgedit-field input[type="number"],
        .imgedit-field input[type="color"],
        .imgedit-field input.imgedit-num {
            border: 1px solid #d0d5dd;
            border-radius: 8px;
            padding: 5px 8px;
            font-size: 0.85rem;
        }

        .imgedit-field input[type="number"],
        .imgedit-field input.imgedit-num {
            width: 90px;
            text-align: center;
        }

        /* English UI: keep Western digits (123), not Arabic-Indic (١٢٣) */
        html[lang="en"] .pn-latin-digits,
        html[lang="en"] #imgeditTextSize,
        html[lang="en"] #imgeditFrameWidth,
        html[lang="en"] #imgeditResizeW,
        html[lang="en"] #imgeditResizeH {
            font-family: Arial, "Segoe UI", Tahoma, sans-serif !important;
            font-feature-settings: "locl" 0;
            font-variant-numeric: lining-nums;
            -webkit-locale: "en";
            direction: ltr;
            unicode-bidi: isolate;
        }

        .imgedit-field input[type="color"] {
            width: 42px;
            height: 34px;
            padding: 2px;
            cursor: pointer;
        }

        .imgedit-panel-btn {
            border: 1px solid #d8dce2;
            background: #fff;
            color: #333;
            border-radius: 8px;
            padding: 7px 12px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
        }

        .imgedit-panel-btn:hover {
            border-color: #111111;
            color: #111111;
            background: #f5f5f5;
        }

        /* شريط المرشح: إلغاء | فلاتر | تطبيق */
        #imgeditPanel_filters {
            padding: 8px 10px;
        }

        #imgeditPanel_filters .imgedit-filters-toolbar,
        #imgeditPanel_filters .imgedit-panel-row {
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            gap: 10px;
            width: 100%;
        }

        #imgeditPanel_filters .imgedit-filter-presets {
            flex: 1 1 auto;
            display: flex;
            flex-wrap: nowrap;
            gap: 10px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            padding: 2px 4px;
            margin: 0;
            scrollbar-width: thin;
            justify-content: center;
            min-width: 0;
        }

        #imgeditPanel_filters .imgedit-filters-lights {
            display: flex;
            flex-wrap: nowrap;
            gap: 10px 16px;
            justify-content: center;
            padding: 8px 4px 2px;
            border-top: 1px solid #f0f1f3;
            margin-top: 8px;
            overflow-x: auto;
        }

        .imgedit-filter-preset {
            flex: 0 0 auto;
            width: 72px;
            border: 1px solid #e0e2e6;
            border-radius: 8px;
            background: #fff;
            padding: 4px;
            cursor: pointer;
            text-align: center;
            transition: border-color .15s, box-shadow .15s;
        }

        .imgedit-filter-preset:hover {
            border-color: #cfd4dc;
        }

        .imgedit-filter-preset.active {
            border-color: #111111;
            box-shadow: 0 0 0 1px #111111;
        }

        .imgedit-filter-preset__thumb {
            display: block;
            width: 100%;
            aspect-ratio: 1 / 1;
            border-radius: 6px;
            background-size: cover;
            background-position: center;
            background-color: #dfe3e8;
        }

        .imgedit-filter-preset__thumb.is-none { background: linear-gradient(135deg, #eee, #ccc); }
        .imgedit-filter-preset__thumb.is-grayscale { filter: grayscale(1); }
        .imgedit-filter-preset__thumb.is-bw { filter: grayscale(1) contrast(1.8); }
        .imgedit-filter-preset__thumb.is-invert { filter: invert(1); }
        .imgedit-filter-preset__thumb.is-clarify { filter: contrast(1.35) saturate(1.15); }
        .imgedit-filter-preset__thumb.is-vintage { filter: sepia(.75) contrast(1.1); }
        .imgedit-filter-preset__thumb.is-polaroid { filter: sepia(.35) saturate(.85) brightness(1.08); }
        .imgedit-filter-preset__thumb.is-kodachrome { filter: contrast(1.25) saturate(1.35) hue-rotate(-8deg); }
        .imgedit-filter-preset__thumb.is-technicolor { filter: saturate(1.8) contrast(1.2) hue-rotate(12deg); }

        .imgedit-filter-preset__label {
            display: block;
            margin-top: 4px;
            font-size: 0.68rem;
            font-weight: 600;
            color: #444;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* برواز الصورة — شريط أنماط مثل المرشحات */
        #imgeditPanel_frame {
            min-width: 0;
            max-width: 100%;
            overflow: hidden;
        }
        #imgeditPanel_frame .imgedit-panel-row {
            min-width: 0;
            max-width: 100%;
        }
        .imgedit-frame-presets-row {
            margin-top: 6px;
            min-width: 0;
            max-width: 100%;
        }
        .imgedit-frame-presets {
            display: flex;
            align-items: stretch;
            gap: 8px;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
            padding: 4px 2px 6px;
            width: 100%;
            min-width: 0;
        }
        .imgedit-frame-preset {
            flex: 0 0 auto;
            width: 76px;
            border: 2px solid #e0e2e6;
            border-radius: 10px;
            background: #fff;
            padding: 4px;
            cursor: pointer;
            text-align: center;
            transition: border-color .15s, box-shadow .15s;
        }
        .imgedit-frame-preset:hover {
            border-color: #cfd4dc;
        }
        .imgedit-frame-preset.active {
            border-color: #4d7cff;
            box-shadow: 0 0 0 1px #4d7cff;
        }
        .imgedit-frame-preset__thumb {
            display: block;
            width: 100%;
            aspect-ratio: 1 / 1;
            border-radius: 6px;
            background: #dfe3e8 center / cover no-repeat;
            box-sizing: border-box;
        }
        .imgedit-frame-preset__thumb.is-none {
            background: linear-gradient(135deg, #eee, #ccc);
            border: 1px dashed #bbb;
        }
        .imgedit-frame-preset__thumb.is-basic {
            background: #89b4ff;
            box-shadow: inset 0 0 0 7px #3b82f6;
        }
        .imgedit-frame-preset__thumb.is-pine {
            background:
                linear-gradient(90deg, rgba(255,255,255,.12) 0 2px, transparent 2px) 0 0 / 8px 100%,
                linear-gradient(180deg, #c4a574, #8b6914 40%, #a67c3a 70%, #6b4423);
            box-shadow: inset 0 0 0 8px rgba(90, 55, 20, 0.55);
        }
        .imgedit-frame-preset__thumb.is-oak {
            background:
                linear-gradient(90deg, rgba(0,0,0,.12) 0 1px, transparent 1px) 0 0 / 6px 100%,
                linear-gradient(180deg, #5c3a1e, #3e2412 45%, #2a160c);
            box-shadow: inset 0 0 0 9px #241208;
        }
        .imgedit-frame-preset__thumb.is-rainbow {
            background: conic-gradient(from 180deg, #ef4444, #f59e0b, #22c55e, #3b82f6, #a855f7, #ef4444);
            box-shadow: inset 0 0 0 8px transparent;
            border: 8px solid transparent;
            background-clip: padding-box;
            /* fallback visual */
            outline: 1px solid rgba(0,0,0,.08);
        }
        .imgedit-frame-preset__thumb.is-grunge1 {
            background:
                radial-gradient(ellipse at center, #f5f5f5 42%, transparent 68%),
                #111;
        }
        .imgedit-frame-preset__thumb.is-grunge2 {
            background:
                radial-gradient(ellipse at center, #222 40%, transparent 70%),
                #f3f3f3;
        }
        .imgedit-frame-preset__thumb.is-ebony {
            background: #111;
            box-shadow: inset 0 0 0 10px #000;
        }
        .imgedit-frame-preset__thumb.is-art1 {
            background: #fff;
            border: 2px solid #222;
            box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 6px #222;
        }
        .imgedit-frame-preset__thumb.is-art2 {
            background: #fff;
            border: 1px solid #444;
            box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #888;
        }
        .imgedit-frame-preset__thumb.is-lowpoly {
            background:
                linear-gradient(135deg, #ef4444 0 25%, #f59e0b 25% 40%, #84cc16 40% 55%, #06b6d4 55% 75%, #8b5cf6 75% 100%);
            box-shadow: inset 0 0 0 8px rgba(255,255,255,.25);
        }
        .imgedit-frame-preset__thumb.is-classic {
            background:
                linear-gradient(#f5efe3, #f5efe3) center / 56% 56% no-repeat,
                linear-gradient(145deg, #6b4423, #3e2412 40%, #2a160c);
            box-shadow: inset 0 0 0 3px #c4a574;
        }
        .imgedit-frame-preset__label {
            display: block;
            margin-top: 4px;
            font-size: 0.68rem;
            font-weight: 600;
            color: #444;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .imgedit-panel-actions {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid #eceef2;
        }

        .imgedit-btn-cancel,
        .imgedit-btn-apply {
            flex: 0 0 auto;
            min-width: 88px;
            border-radius: 8px;
            padding: 8px 16px;
            font-size: 0.86rem;
            font-weight: 700;
            cursor: pointer;
            transition: background .15s, border-color .15s, color .15s;
            white-space: nowrap;
        }

        .imgedit-btn-cancel {
            border: 1px solid #d8dce2;
            background: #fff;
            color: #333;
        }

        .imgedit-btn-cancel:hover {
            border-color: #b9bfc8;
            background: #f7f8fa;
        }

        .imgedit-btn-apply {
            border: 1px solid #111;
            background: #111;
            color: #fff;
        }

        .imgedit-btn-apply:hover {
            background: #333;
            border-color: #333;
        }

        .imgedit-btn-apply:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }

        .imgedit-canvas-host {
            grid-area: stage;
            flex: 1 1 auto;
            min-height: 280px;
            background: transparent;
            border-radius: 8px;
            overflow: hidden;
            display: flex;
            align-items: stretch;
            justify-content: center;
            position: relative;
            z-index: 1;
        }

        /* شبكة واحدة تمتد لكامل منطقة المعاينة — بدون مربع داخلي */
        #imgeditCanvasWrap.canvas-wrapper {
            width: 100%;
            height: 100%;
            max-width: 100%;
            max-height: 100%;
            display: block;
            position: relative;
            z-index: 1;
            overflow: hidden;
            background-color: #ebecf0;
            background-image: url('images/editor/viewport-bg.png');
            background-repeat: repeat;
            background-position: center;
        }

        #imgeditCanvasWrap .canvas-mask-wrapper {
            width: 100%;
            height: 100%;
            display: block;
            position: absolute;
            inset: 0;
            touch-action: none;
            user-select: none;
            -webkit-user-drag: none;
            background: transparent;
        }

        /* الكانفس يملأ المنطقة بالكامل — شفاف فوق الشبكة فقط */
        #imgeditCanvasWrap .canvas-container {
            margin: 0 !important;
            box-shadow: none !important;
            background: transparent !important;
            line-height: 0;
            position: absolute !important;
            left: 0 !important;
            top: 0 !important;
        }

        #imgeditCanvasWrap .canvas-container canvas.lower-canvas,
        #imgeditCanvasWrap .canvas-container canvas.upper-canvas {
            max-width: none !important;
            max-height: none !important;
        }

        #imgeditCropHost {
            display: none;
            width: 100%;
            height: 100%;
            max-height: 100%;
            position: absolute;
            inset: 0;
            z-index: 2;
            background-color: #ebecf0;
            background-image: url('images/editor/viewport-bg.png');
            background-repeat: repeat;
        }

        #imgeditCropHost img {
            max-width: 100%;
            display: block;
        }

        .imgedit-canvas-host .cropper-container,
        .imgedit-canvas-host .cropper-wrap-box,
        .imgedit-canvas-host .cropper-canvas,
        .imgedit-canvas-host .cropper-drag-box {
            background-color: var(--viewer-surface) !important;
        }

        /* إعلان المعاينة أُزيل لإفساح مساحة أكبر للصورة */

        .upload-pick-wrap {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            transform: translateX(18px);
            position: relative;
            z-index: 20;
        }

        .upload-cloud-stack {
            display: flex;
            flex-direction: column;
            gap: 1px;
            position: relative;
            z-index: 220;
            pointer-events: auto;
        }

        .upload-cloud-stack .cloud-icon,
        .upload-cloud-stack .cloud-upload-btn {
            pointer-events: auto;
        }

        .container.my-5 {
            margin-top: 1rem !important;
            margin-bottom: 2rem !important;
        }

        #mergePageHeader {
            margin-bottom: 0 !important;
        }

        #mergePageHeader .display-5 {
            font-size: clamp(1.75rem, 3.5vw, 2.15rem);
            margin-bottom: 0.55rem !important;
            line-height: 1.25;
        }

        #mergePageHeader .lead {
            margin-bottom: 1.15rem !important;
            font-size: 0.98rem;
            line-height: 1.45;
        }

        #upload-section #dropArea.upload-area,
        #upload-section #dropArea.card.upload-area,
        #upload-section #dropArea.card.shadow-sm.upload-area {
            width: min(100%, var(--itqan-tool-panel-w, 46.5rem));
            max-width: min(100%, var(--itqan-tool-panel-w, 46.5rem));
            margin-left: auto;
            margin-right: auto;
            padding: 0.65rem 1.55rem 0.45rem !important;
            box-shadow: none !important;
            overflow: visible !important;
            --bs-card-bg: #f8f9fa;
            background-color: #f8f9fa !important;
            background: #f8f9fa !important;
            border: 2px dashed #ced4da !important;
        }

        @media (min-width: 576px) {
            #upload-section #dropArea.upload-area,
            #upload-section #dropArea .card-body,
            #upload-section #dropArea .upload-row-wrap,
            #upload-section #dropArea .d-flex.justify-content-center {
                overflow: visible !important;
            }
        }

        @media (min-width: 992px) {
            #upload-section #dropArea.upload-area {
                padding-block: 0.75rem 0.5rem !important;
                padding-inline: 1.55rem !important;
                overflow: visible !important;
            }
        }

        @media (max-width: 575.98px) {
            #upload-section #dropArea.upload-area {
                width: 100%;
                padding: 1rem !important;
                overflow: visible !important;
            }
            #upload-section #dropArea .card-body,
            #upload-section #dropArea .upload-row-wrap {
                overflow: visible !important;
            }
        }

        #upload-section #dropArea .card-body {
            padding: 0.3rem 0.85rem 0.2rem;
            overflow: visible !important;
            width: 100%;
            background: transparent !important;
        }

        #upload-section #dropArea .upload-row-wrap {
            overflow: visible !important;
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .cropper-view-box {
            outline: 2px solid #111111 !important;
            outline-color: #111111 !important;
        }
        .cropper-face {
            background-color: transparent !important;
        }
        .cropper-line {
            background-color: #111111 !important;
        }
        .cropper-point {
            width: 10px !important;
            height: 10px !important;
            background-color: #fff !important;
            border: 2px solid #111111 !important;
            opacity: 1 !important;
            border-radius: 1px !important;
        }
        .cropper-point.point-e,
        .cropper-point.point-w {
            margin-top: -5px !important;
        }
        .cropper-point.point-n,
        .cropper-point.point-s {
            margin-left: -5px !important;
        }
        .cropper-modal {
            background-color: #000 !important;
            opacity: 0.45 !important;
        }
        .cropper-dashed {
            border-color: rgba(255,255,255,0.55) !important;
        }



        @media (max-width: 991.98px) {
            html.itqan-editor-active { overflow: auto !important; height: auto !important; }
            html.itqan-editor-active body {
                overflow: auto !important;
                height: auto !important;
                max-height: none !important;
                padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
            }
            .main-editor { flex-direction: column !important; height: auto !important; }
            html.itqan-editor-active .main-editor { position: relative !important; flex-direction: column !important; height: auto !important; top: auto !important; left: auto !important; right: auto !important; bottom: auto !important; }
            #imgeditEditorSection .sidebar {
                order: 1 !important;
                position: relative !important;
                width: 100% !important;
                min-width: 0 !important;
                max-height: none !important;
                height: auto !important;
                flex: none !important;
                border-left: none;
                border-top: 1px solid #ddd;
                overflow: visible !important;
            }
            #imgeditEditorSection .sidebar .merge-sidebar-body {
                overflow: visible !important;
                max-height: none !important;
                height: auto !important;
                padding: 12px 14px 14px !important;
                gap: 12px;
            }
            #imgeditEditorSection .merge-sidebar-header {
                padding: 12px 16px;
                font-size: 18px;
            }
            #imgeditEditorSection .merge-sidebar-help-btn {
                margin-bottom: 0;
                min-height: 44px;
                font-size: 0.86rem;
            }
            #imgeditEditorSection .merge-sidebar-section {
                gap: 8px;
            }
            #imgeditEditorSection .merge-sidebar-label {
                font-size: 0.82rem;
            }
            #imgeditEditorSection .merge-cloud-stack {
                padding: 10px 12px;
            }
            #imgeditEditorSection .merge-stats-sidebar {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 8px;
            }
            #imgeditEditorSection .merge-stats-sidebar .merge-stat-item {
                border: 1px solid #eceef1;
                border-radius: 10px;
                padding: 9px 10px;
                min-width: 0;
            }
            #imgeditEditorSection .merge-stats-sidebar .merge-stat-item:last-child {
                border-bottom: 1px solid #eceef1;
            }
            #imgeditEditorSection .merge-stat-text {
                min-width: 0;
            }
            #imgeditEditorSection .merge-stat-text strong {
                font-size: 0.86rem;
                overflow-wrap: anywhere;
            }
            #imgeditEditorSection .merge-sidebar-btn-clear {
                min-height: 44px;
                font-size: 0.9rem;
            }
            #imgeditEditorSection .viewer-container {
                order: 2 !important;
                width: 100% !important;
                min-height: 0 !important;
                height: auto !important;
                overflow: visible !important;
                padding: 10px 10px 20px;
            }
            #imgeditEditorSection .imgedit-stage-wrap {
                display: flex;
                flex-direction: column;
                width: 100%;
                min-height: 0;
                overflow: visible;
            }
            #imgeditEditorSection .sidebar > .merge-sidebar-footer {
                display: block !important;
                visibility: visible !important;
                position: fixed !important;
                bottom: 0;
                left: 0;
                right: 0;
                z-index: 1050;
                width: 100%;
                padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
                background: #fff;
                border-top: 1px solid #e8e8e8;
                box-shadow: 0 -4px 20px rgba(0,0,0,0.14);
            }
            #imgeditProcessBtn {
                display: flex !important;
                visibility: visible !important;
                align-items: center;
                justify-content: center;
                width: 100% !important;
                min-height: 52px;
                padding: 14px !important;
                font-size: 17px !important;
                border-radius: 10px !important;
                background: #000 !important;
                color: #fff !important;
            }
            .upload-pick-wrap { transform: none; }
            html.itqan-editor-active .tool-seo-visible-wrap, html.itqan-editor-active .merge-seo-content { display: none !important; }

            /* جميع الأدوات ظاهرة كشبكة واضحة بدلاً من صف أفقي مخفي. */
            #imgeditEditorSection .imgedit-toolbar {
                display: grid;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 7px;
                width: 100%;
                overflow: visible;
                margin: 0 0 10px;
                padding: 9px;
                border-radius: 12px;
                background: #f2f3f5;
            }
            #imgeditEditorSection .imgedit-tool-btn {
                width: 100%;
                min-width: 0;
                max-width: none;
                min-height: 68px;
                padding: 8px 5px;
                gap: 5px;
                border-color: #e0e3e7;
                background: #fff;
            }
            #imgeditEditorSection .imgedit-tool-btn i {
                font-size: 19px;
                color: #222;
            }
            #imgeditEditorSection .imgedit-tool-btn span {
                display: block;
                width: 100%;
                min-height: 2.5em;
                font-size: 0.76rem;
                font-weight: 700;
                line-height: 1.25;
                white-space: normal;
                overflow: visible;
                text-overflow: clip;
                overflow-wrap: anywhere;
            }
            #imgeditEditorSection .imgedit-tool-btn.active {
                border-color: #111;
                box-shadow: 0 0 0 1px #111;
            }

            /* لوحات الخيارات تتحول إلى تخطيط رأسي قابل للتمرير. */
            #imgeditEditorSection .imgedit-panels {
                width: 100%;
                margin: 0 0 10px;
                overflow: visible;
            }
            #imgeditEditorSection .imgedit-panel {
                width: 100%;
                padding: 10px;
                border-radius: 12px;
                overflow: visible !important;
            }
            #imgeditEditorSection .imgedit-panel-row,
            #imgeditEditorSection #imgeditPanel_filters .imgedit-panel-row,
            #imgeditEditorSection #imgeditPanel_filters .imgedit-filters-toolbar {
                display: flex;
                flex-wrap: wrap;
                align-items: stretch;
                gap: 9px;
                width: 100%;
                overflow: visible;
            }
            #imgeditEditorSection .imgedit-panel-tools {
                order: 1;
                flex: 1 1 100%;
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                gap: 8px;
                width: 100%;
                overflow: visible;
            }
            #imgeditEditorSection .imgedit-btn-cancel,
            #imgeditEditorSection .imgedit-btn-apply {
                order: 2;
                flex: 1 1 calc(50% - 5px);
                min-width: 0;
                min-height: 44px;
                padding: 10px 12px;
                font-size: 0.9rem;
            }
            #imgeditEditorSection .imgedit-btn-apply {
                order: 3;
            }
            #imgeditEditorSection .imgedit-panel-btn {
                min-height: 42px;
                padding: 9px 11px;
                font-size: 0.82rem;
                white-space: normal;
            }
            #imgeditEditorSection .imgedit-field {
                flex: 1 1 140px;
                min-height: 42px;
                justify-content: space-between;
                padding: 6px 8px;
                border: 1px solid #e0e2e6;
                border-radius: 8px;
                background: #fff;
                color: #333;
                font-size: 0.84rem;
            }
            #imgeditEditorSection .imgedit-field input[type="range"] {
                flex: 1 1 auto;
                width: auto;
                min-width: 90px;
            }
            #imgeditEditorSection .imgedit-field input[type="number"],
            #imgeditEditorSection .imgedit-field input.imgedit-num,
            #imgeditEditorSection .imgedit-select {
                width: min(150px, 52vw);
                max-width: 100%;
                min-height: 36px;
                font-size: 0.86rem;
            }
            #imgeditEditorSection .imgedit-aspect-row {
                justify-content: center;
                overflow: visible;
            }
            #imgeditEditorSection .imgedit-aspect-btn {
                min-height: 40px;
                padding: 8px 11px;
                font-size: 0.82rem;
            }

            #imgeditEditorSection #imgeditPanel_filters .imgedit-filter-presets {
                order: 1;
                flex: 1 1 100%;
                justify-content: flex-start;
                overflow-x: auto;
                padding: 4px 2px 8px;
            }
            #imgeditEditorSection #imgeditPanel_filters .imgedit-btn-cancel,
            #imgeditEditorSection #imgeditPanel_filters .imgedit-btn-apply {
                margin-top: 2px;
            }
            #imgeditEditorSection #imgeditPanel_filters .imgedit-filters-lights {
                display: grid;
                grid-template-columns: 1fr;
                gap: 7px;
                width: 100%;
                overflow: visible;
                padding: 9px 0 0;
            }
            #imgeditEditorSection #imgeditPanel_filters .imgedit-filters-lights .imgedit-field {
                width: 100%;
                flex: none;
            }
            #imgeditEditorSection .imgedit-filter-preset,
            #imgeditEditorSection .imgedit-frame-preset {
                width: 78px;
            }
            #imgeditEditorSection .imgedit-filter-preset__label,
            #imgeditEditorSection .imgedit-frame-preset__label,
            #imgeditEditorSection .imgedit-sticker-cat__label,
            #imgeditEditorSection .imgedit-bg-swatch__label {
                font-size: 0.75rem;
                overflow: visible;
                text-overflow: clip;
                white-space: normal;
            }

            #imgeditEditorSection .imgedit-brush-size,
            #imgeditEditorSection .imgedit-shape-controls,
            #imgeditEditorSection .imgedit-sticker-controls {
                flex: 1 1 100%;
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                max-width: 100%;
                white-space: normal;
            }
            #imgeditEditorSection .imgedit-brush-types,
            #imgeditEditorSection .imgedit-shape-tools,
            #imgeditEditorSection .imgedit-sticker-tools,
            #imgeditEditorSection .imgedit-text-tools,
            #imgeditEditorSection .imgedit-draw-tools {
                flex-wrap: wrap;
                overflow: visible;
            }
            #imgeditEditorSection .imgedit-shape-controls .imgedit-field {
                flex: 1 1 130px;
            }
            #imgeditEditorSection .imgedit-shape-controls input[type="range"] {
                flex: 1 1 auto;
                width: auto;
                min-width: 80px;
            }
            #imgeditEditorSection .imgedit-bg-swatches {
                flex-wrap: wrap;
                justify-content: center;
            }
            #imgeditEditorSection .imgedit-shapes-scroll,
            #imgeditEditorSection .imgedit-sticker-cats-scroll,
            #imgeditEditorSection .imgedit-stickers-scroll,
            #imgeditEditorSection .imgedit-frame-presets {
                justify-content: flex-start;
                padding-bottom: 9px;
            }

            /* مساحة معاينة ثابتة وواضحة بعد الأدوات. */
            #imgeditEditorSection .imgedit-canvas-host {
                flex: none;
                width: 100%;
                height: clamp(360px, 58vh, 560px);
                min-height: 360px;
                border: 1px solid #d8dce2;
                border-radius: 10px;
                overflow: hidden;
            }
            #imgeditEditorSection #imgeditCanvasWrap.canvas-wrapper,
            #imgeditEditorSection #imgeditCropHost {
                min-height: 360px;
            }
        }

        @media (max-width: 380px) {
            #imgeditEditorSection .imgedit-toolbar {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            #imgeditEditorSection .imgedit-tool-btn {
                min-height: 64px;
            }
        }
