/* Office Templates Builder - Premium UI */

/* Variables */
:root {
    --otb-nav-bg: #0e1318;
    --otb-nav-text: #fff;
    --otb-nav-width: 72px;
    --otb-drawer-bg: #252627;
    --otb-drawer-text: #fff;
    --otb-drawer-width: 340px;
    --otb-toolbar-bg: #fff;
    --otb-canvas-bg: #f1f2f6;
    --otb-accent: #8b3dff;
    /* Canva-like purple */
    --otb-text: #0d1216;
}

/* ============================================================
   OTB PRECISION CSS ISOLATION RESET
   ============================================================ */

/* 1. Global box-model + baseline inside the plugin.
      We reset margin/padding/line-height/min-height to 0/normal
      to prevent theme "leakage" without wiping out display properties. */
#otb-app,
#otb-frontend-app,
#otb-app *:not(i):not(span):not(.dashicons):not(.lucide),
#otb-frontend-app *:not(i):not(span):not(.dashicons):not(.lucide) {
    box-sizing: border-box !important;
    line-height: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* 1.1 Special Protection for Icons */
#otb-app i,
#otb-frontend-app i,
#otb-app span.dashicons,
#otb-frontend-app span.dashicons,
#otb-app svg.lucide,
#otb-frontend-app svg.lucide {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
    line-height: 1 !important;
}

/* 2. Button & Interactive Cleans 
      We do NOT use 'all: unset' because it's too destructive.
      Instead, we surgically zero out common theme overrides. */
#otb-app input:not([type="color"]):not([type="range"]),
#otb-app select,
#otb-app textarea {
    margin: 0 !important;
    padding: 6px 10px !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    box-shadow: none !important;
    line-height: normal !important;
    font-family: inherit !important;
    font-size: 13px !important;
    color: #333 !important;
    min-height: 34px !important;
    max-height: none !important;
    min-width: 0 !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
    border-radius: 4px !important;
    transition: border-color 0.2s;
}

#otb-app input[type="color"] {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    min-height: 30px !important;
}

#otb-app button {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    line-height: normal !important;
    font-family: inherit !important;
    font-size: inherit !important;
    color: inherit !important;
    min-height: 0 !important;
    max-height: none !important;
    min-width: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    border-radius: 0 !important;
}

#otb-app button {
    cursor: pointer !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 3. Typography & Lists */
#otb-app ul,
#otb-app ol,
#otb-app li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

#otb-app h1,
#otb-app h2,
#otb-app h3,
#otb-app h4,
#otb-app h5,
#otb-app p {
    margin: 0 !important;
    padding: 0 !important;
    font-weight: normal;
    font-size: 1rem;
    line-height: normal !important;
}

#otb-app label {
    display: inline-block;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: normal !important;
}

/* ============================================================
   END OF PRECISION RESET
   ============================================================ */


#otb-app.otb-fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background-color: var(--otb-bg-light, #f8f9fa);
    margin: 0 !important;
    padding: 0 !important;
}

.otb-app-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    height: 100%;
    /* Changed from 100vh to fill parent */
    max-height: 100%;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--otb-text);
    background: var(--otb-canvas-bg);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease-in-out;
}

/* Default height when NOT in a constrained parent like the overlay */
#otb-app,
#otb-frontend-app {
    height: 90vh;
    min-height: 600px;
    width: 100%;
    position: relative;
}

.otb-app-container.collapsed .otb-sidebar-drawer {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.otb-app-container.collapsed .otb-sidebar-nav {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Fix for WP Admin Bar */
body.admin-bar .otb-app-container {
    height: calc(100vh - 32px);
    /* margin-top: 32px; */
    /* Usually WP handles the body margin, but we ensure height fits */
}

@media screen and (max-width: 782px) {
    body.admin-bar .otb-app-container {
        height: calc(100vh - 46px);
        /* margin-top: 46px; */
    }
}

/* Launch Button Styles */
.otb-launch-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

/* Style 1: Fancy (Vibrant Gradient) */
.otb-launch-btn.style-1 {
    color: #fff;
    background: linear-gradient(135deg, #8b3dff, #6c2bd9);
    box-shadow: 0 4px 15px rgba(139, 61, 255, 0.3);
}

.otb-launch-btn.style-1:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 61, 255, 0.4);
    filter: brightness(1.1);
}

/* Style 2: Plain (Clean White / Bordered) */
.otb-launch-btn.style-2 {
    color: #1d1d1f;
    background: #fff;
    border: 1px solid #d2d2d7;
}

.otb-launch-btn.style-2:hover {
    background: #f5f5f7;
    border-color: #86868b;
}

/* Style 3: Professional (Solid Dark) */
.otb-launch-btn.style-3 {
    color: #fff;
    background: #1d1d1f;
}

.otb-launch-btn.style-3:hover {
    background: #000;
}

/* Style 4: Sober (Minimalist Light Grey) */
.otb-launch-btn.style-4 {
    color: #515154;
    background: #f5f5f7;
}

.otb-launch-btn.style-4:hover {
    background: #e8e8ed;
    color: #1d1d1f;
}

/* Style 5: Decent (Modern Flat Blue) */
.otb-launch-btn.style-5 {
    color: #fff;
    background: #0071e3;
}

.otb-launch-btn.style-5:hover {
    background: #0077ed;
}

/* Button Sizes */
.otb-launch-btn.size-small {
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 6px;
}

.otb-launch-btn.size-small i {
    width: 16px !important;
    height: 16px !important;
}

.otb-launch-btn.size-medium {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: 8px;
}

.otb-launch-btn.size-large {
    padding: 18px 42px;
    font-size: 18px;
    border-radius: 12px;
}

.otb-launch-btn.size-large i {
    width: 24px !important;
    height: 24px !important;
}

.otb-launch-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Admin Hover Previews */
.otb-admin-preview-trigger {
    position: relative;
    display: inline-block;
    cursor: help;
}

.otb-admin-hover-preview {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 999999;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 8px;
    display: none;
    pointer-events: none;
    width: 250px;
}

.otb-admin-hover-preview img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.otb-admin-preview-trigger:hover .otb-admin-hover-preview {
    display: block;
}

/* Editor Overlay */
.otb-editor-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999995 !important;
    background: var(--otb-canvas-bg, #f1f2f6) !important;
    transition: all 0.3s ease;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.admin-bar .otb-editor-overlay {
    top: 32px !important;
}

/* Fix for mobile Chrome URL bar jumping */
@media screen and (max-width: 600px) {
    #otb-editor-overlay {
        height: -webkit-fill-available;
    }
}

@media screen and (max-width: 782px) {
    body.admin-bar .otb-editor-overlay {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

.otb-editor-overlay #otb-frontend-app {
    height: 100% !important;
    width: 100% !important;
    display: block !important;
}

.otb-editor-overlay .otb-app-container {
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
}

/* Minimized state - OBSOLETE */
.otb-editor-overlay.minimized {
    display: none !important;
}

.otb-editor-overlay.minimized .otb-window-controls {
    position: static;
    height: 48px;
    background: #1a1a2e;
    border-radius: 0;
    padding: 0 16px;
    box-shadow: none;
}

.otb-editor-overlay.minimized .otb-window-controls::before {
    content: '?? Template Editor';
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    margin-right: auto;
    display: flex;
    align-items: center;
}

/* Window Controls — sits inside the top toolbar area (top-right corner) */
.otb-window-controls {
    position: absolute;
    top: 14px;          /* vertically centred in the 60px toolbar */
    right: 20px;
    bottom: auto;       /* override any legacy bottom rule */
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* Ensure frontend toolbar has enough right padding so the close
   button never overlaps Help / Report buttons */
#otb-frontend-app .otb-toolbar {
    padding-right: 52px !important;
}

.otb-win-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #555;
    transition: all 0.15s ease;
    padding: 0;
}

.otb-win-btn:hover {
    background: #fee2e2;
    color: #e74c3c;
    border-color: #e74c3c;
}

.otb-win-btn .dashicons,
.otb-win-btn svg.lucide,
.otb-overlay-btn .dashicons,
.otb-overlay-btn svg.lucide {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    display: block;
}

.otb-win-close:hover {
    background: #fee2e2;
    color: #e74c3c;
    border-color: #e74c3c;
}

/* 1. Left Navigation Rail */
.otb-sidebar-nav {
    width: var(--otb-nav-width) !important;
    min-width: var(--otb-nav-width) !important;
    background: var(--otb-nav-bg) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding-top: 15px !important;
    z-index: 20;
    flex-shrink: 0 !important;
}

.otb-nav-item {
    width: 100%;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center !important;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    font-weight: 500;
}

.otb-nav-item:hover,
.otb-nav-item.otb-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.otb-nav-item.otb-active {
    position: relative;
    background: var(--otb-drawer-bg);
}

.otb-nav-item.otb-active::after {
    content: '';
    /* Remove the colored bar, match background */
}

.otb-nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
    /* Use dashicons or svg */
}

/* 2. Drawer (Content) */
.otb-sidebar-drawer {
    width: var(--otb-drawer-width) !important;
    min-width: var(--otb-drawer-width) !important;
    background: var(--otb-drawer-bg) !important;
    color: var(--otb-drawer-text) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    z-index: 10;
    position: relative;
    transition: width 0.3s ease-in-out, min-width 0.3s ease-in-out, max-width 0.3s ease-in-out, opacity 0.3s ease-in-out, padding 0.3s ease-in-out, visibility 0.3s;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0 !important;
    overflow: hidden;
    will-change: width, opacity;
}

.otb-drawer-header {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

#otb-app .otb-drawer-header h3,
#otb-app .otb-drawer-header h4 {
    margin: 0 !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 600 !important;
}

.otb-drawer-search {
    width: 100%;
    padding: 5px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    color: #fff;
    font-size: 0.9rem;
}

.otb-drawer-search:focus {
    border-color: var(--otb-accent);
    outline: none;
}

.otb-drawer-search option {
    background-color: var(--otb-drawer-bg);
    color: #fff;
}

/* ── Custom Category Picker ── */
.otb-cat-picker {
    position: relative;
    width: 100%;
}
.otb-cat-picker-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-align: left;
}
.otb-cat-picker-trigger:hover,
.otb-cat-open .otb-cat-picker-trigger {
    background: rgba(255,255,255,0.13);
    border-color: var(--otb-accent, #6c63ff);
}
.otb-cat-picker-icon { width: 14px; height: 14px; flex-shrink: 0; stroke: rgba(255,255,255,0.55); }
.otb-cat-picker-chevron { width: 14px; height: 14px; flex-shrink: 0; margin-left: auto; stroke: rgba(255,255,255,0.5); transition: transform 0.2s; }
.otb-cat-open .otb-cat-picker-chevron { transform: rotate(180deg); }
#otb-cat-picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.otb-cat-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0; right: 0;
    background: #1e1e32;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.45);
    z-index: 9999;
    overflow: hidden;
    animation: otb-cat-drop-in 0.15s ease;
}
.otb-cat-open .otb-cat-picker-dropdown { display: block; }

@keyframes otb-cat-drop-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.otb-cat-picker-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.otb-cat-picker-search-icon { width: 13px; height: 13px; flex-shrink: 0; stroke: rgba(255,255,255,0.4); }
.otb-cat-picker-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 12px;
    padding: 0;
}
.otb-cat-picker-search::placeholder { color: rgba(255,255,255,0.35); }

.otb-cat-picker-list {
    list-style: none;
    margin: 0;
    padding: 5px 0;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.otb-cat-picker-list::-webkit-scrollbar { width: 4px; }
.otb-cat-picker-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.otb-cat-picker-item {
    padding: 8px 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.82);
    cursor: pointer;
    border-radius: 6px;
    margin: 0 4px;
    transition: background 0.1s, color 0.1s;
}
.otb-cat-picker-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.otb-cat-picker-item.otb-cat-selected {
    background: rgba(108,99,255,0.22);
    color: var(--otb-accent, #6c63ff);
    font-weight: 600;
}
.otb-cat-picker-empty {
    padding: 10px 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    text-align: center;
}

.otb-drawer-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 15px 15px 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

.otb-drawer-section {
    position: absolute;
    inset: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start !important;
    overflow: hidden;
    min-height: 0;
}

.otb-drawer-section.otb-active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Sticky Header for Search */
.otb-sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--otb-drawer-bg);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

/* Ensure padding-top on the content below so it isn't hidden */
#otb-svg-library-list {
    padding-top: 5px;
}

/* Grids for assets */
/* ── Multi-stop gradient bar ──────────────────────────────────── */
#otb-grad-bar-wrap {
    position: relative;
    user-select: none;
}

#otb-grad-bar {
    width: 100%;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: crosshair;
    background: linear-gradient(to right, #6a11cb, #2575fc);
}

#otb-grad-stops-track {
    position: relative;
    width: 100%;
    height: 20px;
    margin-top: 4px;
}

.otb-grad-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    top: 2px;
    cursor: ew-resize;
    box-sizing: border-box;
    transition: border-color 0.1s, transform 0.1s;
}

.otb-grad-handle.selected {
    border-color: #2d7ff9;
    transform: scale(1.25);
    z-index: 2;
}

#otb-grad-stop-editor {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

#otb-grad-stop-color {
    width: 40px;
    height: 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

#otb-grad-stop-delete {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #ff6b6b;
    border-radius: 4px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#otb-grad-stop-delete:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ── Shape fill gradient bar (renderGradientPopover) ─────────── */
.otb-fill-grad-bar-wrap {
    position: relative;
    user-select: none;
    margin-bottom: 6px;
}

.otb-fill-grad-bar {
    width: 100%;
    height: 28px;
    border-radius: 5px;
    border: 1px solid #ddd;
    cursor: crosshair;
    background: linear-gradient(to right, #6a11cb, #2575fc);
}

.otb-fill-grad-stops-track {
    position: relative;
    width: 100%;
    height: 18px;
    margin-top: 3px;
}

.otb-fill-grad-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    top: 2px;
    cursor: ew-resize;
    box-sizing: border-box;
    transition: border-color 0.1s, transform 0.1s;
}

.otb-fill-grad-handle.selected {
    border-color: #2d7ff9;
    transform: scale(1.3);
    z-index: 2;
}

.otb-fill-grad-stop-editor {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.otb-fill-grad-stop-color {
    width: 36px;
    height: 24px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 1px;
    flex-shrink: 0;
}

.otb-fill-grad-pct {
    font-size: 10px;
    color: #888;
    min-width: 28px;
    text-align: right;
}

.otb-fill-grad-del {
    background: transparent;
    border: 1px solid #ffd0d0;
    color: #ff4d4d;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.otb-fill-grad-del:disabled {
    opacity: 0.25;
    cursor: default;
}

.otb-fill-grad-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.otb-fill-grad-preset {
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.08);
    transition: transform 0.1s, box-shadow 0.1s;
}

.otb-fill-grad-preset:hover {
    transform: scaleY(1.15);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.otb-assets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    color: #000;
}

.otb-masonry-grid {
    column-count: 2;
    column-gap: 10px;
    width: 100%;
    line-height: 0;
}

.otb-template-item {
    break-inside: avoid;
    margin-bottom: 20px !important;
    width: 100%;
    display: block !important;
}

.otb-asset-item {
    margin-bottom: 10px !important;
}




.otb-asset-item {
    background: rgba(255, 255, 255, 0.80);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    padding: 3px;
}

/* Asset Group Layout */
.otb-asset-group {
    margin-bottom: 18px;
    width: 100%;
}

.otb-asset-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 5px;
}

.otb-asset-group-title {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    display: flex;
    align-items: center;
}

.otb-asset-count {
    opacity: 0.5;
    font-weight: 400;
    font-size: 11px;
    margin-left: 5px;
}

.otb-view-all-assets,
.otb-view-all-stickers {
    background: none;
    border: none;
    font-size: 11px;
    color: #3b82f6;
    cursor: pointer;
    padding: 2px 0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.1s;
}

.otb-view-all-assets:hover,
.otb-view-all-stickers:hover {
    color: #60a5fa;
}

.otb-asset-group-preview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.otb-asset-group-expanded {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.12);
    padding: 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.otb-asset-item:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.1);
}

.otb-pattern-active {
    outline: 2px solid var(--otb-accent) !important;
    outline-offset: -2px;
}

#otb-bg-patterns-list {
    grid-template-columns: repeat(3, 1fr) !important;
}

.otb-asset-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Scrollbar styling */
.otb-drawer-content::-webkit-scrollbar {
    width: 6px;
}

.otb-drawer-content::-webkit-scrollbar-track {
    background: transparent;
}

.otb-drawer-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.otb-drawer-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Canvas Loading Overlay */
.otb-canvas-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center !important;
    z-index: 50;
    border-radius: 2px;
    backdrop-filter: blur(2px);
}

.otb-canvas-loading .otb-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: otb-spin 0.8s linear infinite;
}

.otb-canvas-loading span {
    margin-top: 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

@keyframes otb-spin {
    to {
        transform: rotate(360deg);
    }
}

.otb-nav-toggle-icon {
    transition: transform 0.3s;
}

.otb-app-container.collapsed .otb-nav-toggle-icon {
    transform: rotate(180deg);
}

@keyframes rotation {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Infinite scroll loader */
.otb-scroll-loader {
    text-align: center;
    padding: 15px 0;
}

.otb-scroll-loader .otb-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--otb-accent);
    border-radius: 50%;
    animation: otb-spin 0.8s linear infinite;
    display: inline-block;
}

/* 3. Main Workspace */
.otb-workspace-area {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    min-width: 0 !important;
    position: relative;
    background: #f4f4f4;
}

.otb-main-view {
    display: flex !important;
    flex: 1 !important;
    flex-direction: row !important;
    overflow: hidden !important;
    position: relative !important;
}

.otb-canvas-section {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    min-width: 0 !important;
}


/* Top Toolbar */
.otb-toolbar {
    height: 60px;
    background: var(--otb-toolbar-bg);
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    /* Above rulers and canvas loading */
}

.otb-toolbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.otb-toolbar-btn {
    background: transparent;
    border: none;
    padding: 9px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    min-height: 36px;
}

.otb-toolbar-btn svg.lucide {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
    flex-shrink: 0;
}

.otb-orientation-btn {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    justify-content: center !important;
}

.otb-orientation-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.otb-toolbar-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.otb-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.otb-toolbar-btn.otb-primary {
    background: var(--otb-accent);
    color: #fff;
    padding: 8px 16px;
}

.otb-toolbar-btn.otb-primary:hover {
    filter: brightness(1.1);
}

/* ===== Properties Bar (Right Inspector Panel) ===== */
.otb-properties-bar {
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: 100% !important;
    background: #fff !important;
    border-left: 1px solid #e0e0e0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px !important;
    box-sizing: border-box !important;
    z-index: 1000 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s !important;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.08) !important;
}

.otb-properties-bar:not(.otb-active) {
    transform: translateX(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* --- Icon Grid Helper for Sidebar --- */
.otb-icon-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 8px !important;
}

.otb-icon-grid .otb-icon-btn {
    width: 100% !important;
    height: 36px !important;
    justify-content: center !important;
    background: #f8f9fa !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    color: #444 !important;
}

.otb-icon-grid .otb-icon-btn:hover {
    background: #ebeeef !important;
    border-color: #d0d4d8 !important;
    color: #1a73e8 !important;
}

.otb-icon-grid .otb-icon-btn:active,
.otb-icon-grid .otb-icon-btn.active,
.otb-icon-grid .otb-icon-btn.otb-active {
    background: rgba(26, 115, 232, 0.08) !important;
    border-color: #1a73e8 !important;
    color: #1a73e8 !important;
}

.otb-properties-bar-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.otb-properties-bar-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.otb-prop-section {
    padding: 12px 14px;
    border-bottom: 1px solid #f2f2f2;
    width: 100%;
    box-sizing: border-box;
}

.otb-prop-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 8px;
    user-select: none;
}

/* ── New sidebar section wrapper ── */
.otb-sidebar-section {
    padding: 10px 14px 12px;
    border-bottom: 1px solid #f2f2f2;
    width: 100%;
    box-sizing: border-box;
}

.otb-sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #c0c0c0;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 8px;
    user-select: none;
}

/* Sidebar section separator — very light, provides rhythm without fragmenting */
.otb-prop-separator {
    height: 1px;
    width: 100%;
    background: #f2f2f2;
    margin: 2px 0;
    flex-shrink: 0;
    display: block;
    align-self: stretch;
}


/* -- Group -- */
.otb-prop-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    padding: 4px 0 !important;
    flex-shrink: 0 !important;
}

/* -- Pill Button (Font Picker, etc.) -- */
.otb-pill-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    padding: 5px 10px !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: #333 !important;
    white-space: nowrap !important;
    transition: border-color 0.15s, background 0.15s;
    height: 34px !important;
    box-sizing: border-box !important;
}

.otb-pill-btn:hover {
    border-color: #bbb;
    background: #fafafa;
}

.otb-pill-btn .otb-pill-arrow {
    font-size: 10px;
    color: #888;
    margin-left: 2px;
}

/* -- Font Size Stepper -- */
.otb-size-stepper {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    height: 34px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: #fff !important;
}

.otb-size-stepper button {
    width: 28px;
    height: 100%;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}

.otb-size-stepper button:hover {
    background: #f0f0f0;
}

.otb-size-stepper input {
    width: 38px;
    text-align: center;
    border: none;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    font-size: 13px;
    font-family: inherit;
    color: #333;
    height: 100%;
    padding: 0;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
    box-sizing: border-box;
    background: #fff;
}

.otb-size-stepper input::-webkit-outer-spin-button,
.otb-size-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* -- Icon Button (B, I, U, etc.) -- */
.otb-icon-btn {
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    color: #555 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 !important;
    font-size: 13px !important;
    position: relative !important;
}

.otb-icon-btn:hover {
    background: #f1f3f4;
    color: #1a73e8;
}

.otb-icon-btn.otb-active {
    background: rgba(26, 115, 232, 0.1) !important;
    color: #1a73e8 !important;
}

.otb-icon-btn .dashicons,
.otb-icon-btn svg.lucide {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    display: block;
}

/* -- Property Groups (canonical definition) -- */
.otb-prop-group {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    padding: 4px 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    flex-shrink: 0 !important;
}

.otb-prop-group-right {
    border-top: 1px solid #f2f2f2;
    padding-top: 6px;
    margin-top: 0;
}


.otb-prop-label {
    font-size: 11px;
    font-weight: 600;
    color: #777;
    margin-right: 4px;
}

/* -- Color Swatch Button -- */
.otb-color-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.otb-color-btn:hover {
    background: #f0f0f0;
}

.otb-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    display: block;
}

.otb-color-btn input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
}

/* -- Inline Select (Align) -- */
.otb-inline-select {
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 12px;
    font-family: inherit;
    color: #333;
    background: #fff;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.otb-inline-select:hover {
    border-color: #bbb;
}

/* -- Font Dropdown List -- */
.otb-font-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 200px;
    overflow: visible;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 2147483647 !important;
    border-radius: 8px;
    padding: 0;
}

.otb-font-search-container {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 10px;
    border-bottom: 1px solid #eee;
    z-index: 10;
}

.otb-font-search-input {
    width: 100%;
    height: 32px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.otb-font-search-input:focus {
    border-color: var(--otb-accent, #2d7ff9);
}

.otb-font-dropdown-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.1s;
    white-space: nowrap;
}

.otb-font-dropdown-item:hover {
    background: #f5f5f5;
}

.otb-font-dropdown-item.otb-selected {
    background: #eef2ff;
    font-weight: normal;
}

/* -- Opacity Slider -- */
.otb-opacity-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
}

.otb-opacity-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #555;
    cursor: pointer;
}

/* -- Toolbar Popovers (Shadow, Formatting, Align, Export) -- */
.otb-toolbar-popover {
    display: none;
    position: absolute;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 2147483647 !important;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    user-select: none;
}

.otb-toolbar-popover-content {
    padding: 14px;
}

.otb-popover-header {
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
}

.otb-popover-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #777;
    letter-spacing: 0.5px;
}

.otb-popover-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.otb-popover-close:hover {
    background: #eee;
    color: #333;
}

.otb-toolbar-popover.right-align {
    left: auto;
    right: 0;
    transform: none;
}

.otb-toolbar-popover.otb-active {
    display: block;
}

/* -- Export Popover: fully replaced with dedicated export menu system -- */

/* ─── Export trigger button ─────────────────────────────────────────────── */
.otb-export-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.otb-export-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    border: 1px solid #e0e0e0 !important;
    background: #fff !important;
    color: #333 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background 0.15s, border-color 0.15s !important;
    line-height: 1.2 !important;
    height: 34px !important;
    box-sizing: border-box !important;
}

.otb-export-trigger:hover,
.otb-export-trigger.otb-active {
    background: #f5f5f5 !important;
    border-color: #bbb !important;
}

.otb-export-trigger-label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
}

.otb-export-chevron {
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.otb-export-trigger.otb-active .otb-export-chevron {
    transform: rotate(180deg);
}

/* ─── Export menu (dropdown) ─────────────────────────────────────────────── */
.otb-export-menu {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #e4e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    z-index: 2147483647;
    padding: 6px 0;
    min-width: 200px;
    /* No width here — set by JS */
}

.otb-export-menu.otb-export-menu--open {
    display: block;
}

.otb-export-menu-header {
    font-size: 10px;
    font-weight: 700;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 6px 14px 4px;
    user-select: none;
}

/* ─── Export menu items ──────────────────────────────────────────────────── */
.otb-export-menu .otb-export-opt {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 8px 14px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    text-align: left !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transition: background 0.12s ease !important;
    line-height: 1.3 !important;
    min-height: 0 !important;
    height: auto !important;
    float: none !important;
    position: static !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.otb-export-menu .otb-export-opt:hover {
    background: #f0f4f8 !important;
}

.otb-export-opt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #f4f6f8;
    border-radius: 6px;
    flex-shrink: 0;
    color: #555;
}

.otb-export-opt-icon svg,
.otb-export-opt-icon i[data-lucide] {
    width: 14px !important;
    height: 14px !important;
    display: block !important;
}

.otb-export-opt-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.otb-export-opt-name {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #222 !important;
    line-height: 1.3 !important;
    display: block !important;
}

.otb-export-opt-desc {
    font-size: 10px !important;
    color: #999 !important;
    line-height: 1.3 !important;
    display: block !important;
    font-weight: 400 !important;
}

/* Divider between items */
.otb-export-menu .otb-export-opt+.otb-export-opt {
    border-top: 1px solid #f2f2f2 !important;
}

.otb-toolbar-popover label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.otb-toolbar-popover input[type="number"] {
    width: 100%;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 6px;
    font-size: 12px;
    box-sizing: border-box;
    outline: none;
}

.otb-toolbar-popover input[type="range"] {
    width: 100%;
    height: 4px;
}

/* -- Actions Group (right-aligned) -- */
.otb-actions-group {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

/* -- Label Text -- */
.otb-bar-label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
}

.otb-prop-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.otb-prop-color {
    width: 28px;
    height: 28px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
}

.otb-prop-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.otb-prop-color::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.otb-prop-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.otb-prop-input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    height: 32px;
    font-size: 13px;
    color: #333;
}

.otb-toolbar-btn.otb-active {
    background: #e6e6e6;
    color: #000;
}

/* Canvas Area */
.otb-canvas-container {
    flex: 1;
    background: var(--otb-canvas-bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    position: relative;
    padding: 40px 60px;
    min-height: 0;
}

.canvas-container {
    /* FabricJS wrapper */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Bottom Bar: Pages + Zoom */
.otb-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 0 16px;
    flex-shrink: 0;
}

/* Page Tabs */
.otb-page-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    max-width: 60%;
}

.otb-page-tab {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    user-select: none;
}

.otb-page-tab:hover {
    background: #f0f0f0;
    color: #333;
}

.otb-page-tab.otb-active {
    background: var(--otb-accent, #8b3dff);
    color: #fff;
    border-color: var(--otb-accent, #8b3dff);
}

/* Page Hover Preview */
.otb-page-preview {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 160px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.otb-page-preview.otb-active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.otb-page-preview::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}

.otb-page-preview-thumb {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    background-color: #fff;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.otb-page-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.otb-page-preview-label {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-top: 6px;
}

.otb-page-add {
    width: 28px;
    height: 28px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    background: transparent;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.otb-page-add:hover {
    border-color: var(--otb-accent, #8b3dff);
    color: var(--otb-accent, #8b3dff);
    background: rgba(139, 61, 255, 0.05);
}

/* Zoom Controls (inside bottom bar) */
.otb-zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    flex-shrink: 0;
}

.otb-zoom-controls .dashicons,
.otb-zoom-controls svg.lucide {
    cursor: pointer;
    color: #666;
    transition: color 0.15s;
}

.otb-zoom-controls .dashicons:hover,
.otb-zoom-controls svg.lucide:hover {
    color: var(--otb-accent, #8b3dff);
}

.otb-zoom-input {
    width: 45px;
    height: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding: 0;
    outline: none;
    transition: all 0.2s ease;
}

.otb-zoom-input:focus {
    border-color: var(--otb-accent, #8b3dff);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(139, 61, 255, 0.1);
}

/* Loading */
.otb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
}

/* Tool Button (Text) */
.otb-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #fff;
    background: var(--otb-primary, #2d7ff9);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.otb-tool-btn:hover {
    background: var(--otb-primary-dark, #1c5fcc);
    transform: translateY(-1px);
}

.otb-tool-btn:active {
    transform: translateY(0);
}

/* Slider styling — targets .otb-range class AND all range inputs within the editor */
.otb-range,
#otb-app input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(139, 61, 255, 0.3);
    border: none;
    border-radius: 2px;
    outline: none;
    opacity: 0.9;
    transition: opacity .2s;
}

.otb-range:hover,
#otb-app input[type="range"]:hover {
    opacity: 1;
}

.otb-range::-webkit-slider-thumb,
#otb-app input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--otb-accent, #8b3dff);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform .15s ease;
}

.otb-range::-webkit-slider-thumb:hover,
#otb-app input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.otb-range::-moz-range-thumb,
#otb-app input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--otb-accent, #8b3dff);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.otb-range::-moz-range-track,
#otb-app input[type="range"]::-moz-range-track {
    height: 4px;
    background: rgba(139, 61, 255, 0.3);
    border: none;
    border-radius: 2px;
}


/* Red / Danger Button */
.otb-tool-btn.otb-btn-danger,
.otb-tool-btn.otb-btn-danger:hover {
    color: #f44336;
    border-color: #ffcdd2;
}

/* --- Template Library --- */
.otb-toolbar-btn.otb-primary {
    background: var(--otb-accent, #8b3dff);
    color: #fff !important;
    border: none;
    padding: 16px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.otb-toolbar-btn.otb-primary:hover {
    background: #7a2df2;
    color: #fff !important;
    transform: scale(1.05);
}

.otb-template-overlay-title {
    color: #fff;
    font-size: 11px;
    margin-top: 10px;
    text-align: center;
    padding: 0 10px;
    line-height: 1.3;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* --- Custom Modal System --- */
.otb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.otb-modal-overlay.otb-active {
    opacity: 1;
}

.otb-modal-box {
    background: #fff;
    width: 400px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 24px;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.otb-modal-overlay.otb-active .otb-modal-box {
    transform: translateY(0);
}

.otb-modal-icon {
    font-size: 40px;
    color: var(--otb-accent, #8b3dff);
    margin-bottom: 16px;
    display: block;
}

.otb-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin-bottom: 12px;
}

.otb-modal-msg {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 24px;
}

.otb-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.otb-modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
}

.otb-modal-btn:hover {
    background: #f5f5f5;
}

.otb-modal-btn.otb-primary {
    background: var(--otb-accent, #8b3dff);
    color: #fff;
    border: none;
}

.otb-modal-btn.otb-primary:hover {
    background: #7a2df2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 61, 255, 0.25);
}

.otb-modal-btn.otb-primary:active {
    transform: translateY(0);
}

button[style*="d63031"] {
    /* Fallback/Support for inline styles */
    background: #d63031 !important;
    color: #fff !important;
}

/* Skeleton Loader */
@keyframes otb-skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.otb-skeleton-loading {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #252540;
    background-image: linear-gradient(90deg, #252540 25%, #32325a 50%, #252540 75%);
    background-size: 200% 100%;
    animation: otb-skeleton-shimmer 1.4s infinite linear;
    border-radius: inherit;
    z-index: 1;
}

/* SEO Powered By Link */
.otb-powered-by {
    font-size: 11px;
    color: #888;
    text-align: center;
    padding: 15px 10px;
    margin-top: auto;
    border-top: 1px solid #ebebeb;
}

.otb-powered-by a {
    color: var(--otb-accent, #8b3dff);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.otb-powered-by a:hover {
    color: #6a1bcf;
    text-decoration: underline;
}

.otb-popover-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.otb-popover-row:last-child {
    margin-bottom: 0;
}

.otb-popover-label {
    font-size: 11px;
    color: #777;
    margin-bottom: 4px;
    display: block;
    text-align: left;
}

/* Align Dropdown Specific */
.otb-align-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.otb-align-grid .otb-icon-btn {
    width: 32px;
    height: 32px;
}

button[style*="d63031"] {
    /* Fallback/Support for inline styles */
    background: #d63031 !important;
    color: #fff !important;
    border: none;
    box-shadow: 0 4px 6px rgba(214, 48, 49, 0.2);
}

.otb-tool-btn.otb-btn-danger:hover {
    background: #c0392b !important;
    box-shadow: 0 6px 12px rgba(214, 48, 49, 0.3);
}

/* Text Presets */
/* Text Presets */
.otb-text-preset:not(.custom-style) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 12px 10px !important;
    margin-bottom: 15px !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
    min-height: 44px !important;
}

.otb-text-preset.custom-style {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 15px !important;
    background: #fff;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    overflow: hidden !important;
    padding: 0 !important;
}

.otb-text-preset.custom-style.otb-checkerboard {
    background-color: #fff;
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px 4px, 4px 0;
}

.otb-text-preset:hover {
    border-color: var(--otb-accent, #8b3dff);
    background: #f9f9f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.otb-text-preset h1,
.otb-text-preset h2,
.otb-text-preset p {
    margin: 0;
    line-height: 1.2;
    color: var(--otb-text);
}

.otb-text-preset.heading h1 {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #000 !important;
}

.otb-text-preset.subheading h2 {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #333 !important;
}

.otb-text-preset.subheading h2:after {
    content: none !important;
    display: none !important;
    border: none !important;
}

.otb-text-preset.body p {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #555 !important;
}

/* Barcode and QR Code Styles */
.otb-code-tab {
    animation: fadeIn 0.3s ease;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
}

.otb-code-tab.otb-active {
    display: flex !important;
}

.otb-input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff !important;
    /* Force white text */
    margin-bottom: 12px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s;
}

.otb-input:focus {
    outline: none;
    border-color: var(--otb-accent);
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    /* Ensure text remains white on focus */
    box-shadow: 0 0 0 2px rgba(139, 61, 255, 0.2);
}

.otb-input option {
    background: #333;
    color: #fff;
}

.otb-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    margin: 15px 0;
    font-weight: 600;
}

#otb-qr-dynamic-form {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

/* Drawing Controls */
.otb-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.otb-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.otb-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    transition: .4s;
    border-radius: 20px;
}

.otb-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.otb-slider {
    background-color: var(--otb-accent);
}

input:checked+.otb-slider:before {
    transform: translateX(20px);
}

.otb-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    margin: 0;
}

.otb-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

.otb-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Full-width opacity slider row */
.otb-opacity-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 2px 0 !important;
}

.otb-opacity-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 !important;
    min-width: 0 !important;
    height: 4px !important;
    background: #e0e0e0 !important;
    border-radius: 2px !important;
    outline: none !important;
    border: none !important;
    min-height: 0 !important;
    padding: 0 !important;
}

.otb-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--otb-accent, #8b3dff);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.otb-opacity-val {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #666 !important;
    width: 32px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
}

/* Specific range style for properties bar */
.otb-prop-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 40px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    border: none !important;
    min-height: 0 !important;
    padding: 0 !important;
}

.otb-align-grid {
    display: flex;
    align-items: center;
    gap: 2px;
}

.otb-prop-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #555;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Object Overlay Buttons */
.otb-overlay-btn {
    background: transparent;
    border: none;
    color: #fff !important;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    padding: 0;
}

.otb-overlay-btn i,
.otb-overlay-btn svg {
    color: #fff !important;
    stroke: #fff !important;
}

.otb-overlay-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.otb-overlay-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.otb-overlay-btn.otb-danger {
    color: #d63031;
}

.otb-overlay-btn.otb-danger:hover {
    background: rgba(214, 48, 49, 0.15);
}

/* -- Crop UI -- */
.otb-crop-toolbar {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #ddd;
    color: #333;
    padding: 6px 12px;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: all;
    max-height: 42px;
}

.otb-crop-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #333;
    padding: 6px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.otb-crop-btn:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.otb-crop-btn.otb-confirm {
    background: var(--otb-accent, #1a73e8);
    color: #fff;
}

.otb-crop-btn.otb-confirm:hover {
    filter: brightness(1.05);
}

.otb-crop-btn.otb-cancel:hover {
    background: #fff0f0;
    color: #d93025;
    border-color: #f8d7da;
}

.otb-global-tpl-info {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #111;
    color: #eee;
    padding: 15px;
    border-radius: 8px;
    width: 220px;
    z-index: 2147483647;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.otb-coords-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    display: none;
    z-index: 2147483647;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}




/* Rulers */
.otb-ruler-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--otb-canvas-bg);
}

.otb-ruler {
    position: absolute;
    background: #fff;
    z-index: 10;
    display: block;
    /* Visible by default */
    overflow: hidden;
}

.otb-ruler-h {
    top: 0;
    left: 20px;
    right: 0;
    height: 20px;
    border-bottom: 1px solid #ddd;
}

.otb-ruler-v {
    top: 20px;
    left: 0;
    bottom: 0;
    width: 20px;
    border-right: 1px solid #ddd;
}

.otb-ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: #fff;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    z-index: 11;
    display: flex;
    /* Visible by default */
    align-items: center;
    justify-content: center;
}

#otb-ruler-unit-select {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 8px;
    color: #444;
    cursor: pointer;
    padding: 0;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
    font-weight: 600;
}

#otb-ruler-unit-select:focus {
    outline: none;
}

.otb-ruler-h canvas,
.otb-ruler-v canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* Grid is handled via Fabric background pattern */

/* -- Editor Loading Overlay -- */
.otb-app-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.otb-app-loading .otb-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 61, 255, 0.1);
    border-top: 4px solid #8b3dff;
    border-radius: 50%;
    animation: otb-spin 1s linear infinite;
    margin-bottom: 20px;
}

.otb-app-loading .otb-loading-text {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #1d1d1f;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
}

.otb-loading-bar-track {
    width: 220px;
    height: 5px;
    background: rgba(139, 61, 255, 0.15);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
}

.otb-loading-bar-fill {
    height: 100%;
    background: #8b3dff;
    border-radius: 99px;
    transition: width 0.35s ease;
}

.otb-loading-pct {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #8b3dff;
    letter-spacing: 0.02em;
}

@keyframes otb-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* -- Transparency Support -- */
.otb-color-btn {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 2px;
    cursor: pointer;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.otb-color-swatch {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    display: block;
    position: relative;
    overflow: hidden;
}

/* Base Checkerboard for Swatches */
.otb-checkerboard {
    background-color: #fff;
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px 4px, 4px 0;
}

.otb-color-swatch.is-transparent {
    background: none !important;
}

.otb-color-swatch.is-transparent::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 6px 6px;
    background-position: 0 0, 0 3px, 3px 3px, 3px 0;
}

.otb-color-swatch.is-transparent::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 1px;
    background: #e74c3c;
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 1;
}

.otb-icon-btn.is-transparent {
    color: #e74c3c !important;
    border-color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.1) !important;
}

/* --- Product Tour UI --- */
.otb-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.otb-tour-overlay.otb-active {
    opacity: 1;
}

.otb-tour-highlight {
    position: relative;
    z-index: 999999 !important;
    box-shadow: 0 0 0 4px rgba(139, 61, 255, 0.5), 0 0 20px rgba(139, 61, 255, 0.4);
    pointer-events: none;
    /* Let clicks pass through if we want them to click it, but tour blocks clicks anyway */
    border-radius: 4px;
    background-color: #2b2b36 !important;
    transition: box-shadow 0.3s ease;
}

.otb-tour-popover {
    position: fixed;
    z-index: 999999 !important;
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    width: 280px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
}

.otb-tour-popover.otb-active {
    opacity: 1;
    transform: translateY(0);
}

.otb-tour-popover::after {
    content: '';
    position: absolute;
    border: 8px solid transparent;
}

.otb-tour-popover.place-bottom::after {
    top: -16px;
    left: 20px;
    border-bottom-color: #fff;
}

.otb-tour-popover.place-top::after {
    bottom: -16px;
    left: 20px;
    border-top-color: #fff;
}

.otb-tour-popover.place-right::after {
    left: -16px;
    top: 20px;
    border-right-color: #fff;
}

.otb-tour-popover.place-left::after {
    right: -16px;
    top: 20px;
    border-left-color: #fff;
}

.otb-tour-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    margin: 0 0 6px 0;
}

.otb-tour-text {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    margin: 0 0 15px 0;
}

.otb-tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.otb-tour-progress {
    font-size: 11px;
    color: #888;
    font-weight: 500;
}

.otb-tour-actions {
    display: flex;
    gap: 8px;
}

.otb-tour-btn {
    background: #f0f0f0;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.otb-tour-btn:hover {
    background: #e4e4e4;
}

.otb-tour-btn-primary {
    background: var(--otb-accent, #8b3dff);
    color: #fff;
}

.otb-tour-btn-primary:hover {
    background: #7a32e0;
}

/* --- Help Center Modal --- */
.otb-help-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.otb-help-modal-overlay.otb-active {
    opacity: 1;
}

.otb-help-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: 800px;
    max-width: 90vw;
    height: 600px;
    max-height: 85vh;
    background: #1e1e24;
    /* Darker than editor base */
    border-radius: 12px;
    z-index: 1000001;
    display: none;
    opacity: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    flex-direction: column;
}

.otb-help-modal.otb-active {
    opacity: 1;
    transform: translate(-50%, -50%);
    display: flex !important;
}

.otb-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.otb-help-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.otb-help-close-btn {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
    width: 20px;
    height: 20px;
}

.otb-help-close-btn:hover {
    color: #fff;
}

.otb-help-body-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.otb-help-sidebar {
    width: 260px;
    background: rgba(0, 0, 0, 0.15);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}

.otb-help-search-box {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

#otb-help-search {
    width: 100%;
    padding: 10px 10px 10px 34px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s;
}

#otb-help-search:focus {
    outline: none;
    border-color: var(--otb-accent);
}

.otb-help-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.otb-help-nav::-webkit-scrollbar,
.otb-help-content-area::-webkit-scrollbar {
    width: 6px;
}

.otb-help-nav::-webkit-scrollbar-track,
.otb-help-content-area::-webkit-scrollbar-track {
    background: transparent;
}

.otb-help-nav::-webkit-scrollbar-thumb,
.otb-help-content-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.otb-help-nav-category {
    padding: 16px 16px 6px 16px;
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.otb-help-nav-item {
    padding: 10px 16px;
    margin: 2px 10px;
    border-radius: 6px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.otb-help-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.otb-help-nav-item.otb-active {
    background: var(--otb-accent);
    color: #fff;
    font-weight: 500;
}

.otb-help-content-area {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    background: #1e1e24;
}

.otb-help-article-full h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--otb-accent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 16px;
}

.otb-help-article-body {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
}

.otb-help-article-body p {
    margin: 0 0 16px 0;
}

.otb-help-article-body ul {
    margin: 0 0 16px 0;
    padding-left: 20px;
}

.otb-help-article-body li {
    margin-bottom: 8px;
}

.otb-help-article-body strong {
    color: #fff;
    font-weight: 600;
}

.otb-help-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 12px 12px;
}

.otb-drawer-header h3 {
    margin-bottom: 0px;
    font-size: 1.1rem;
}

.otb-bg-sub-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

.otb-bg-sub-section h4 {
    font-size: 1.1rem;
}

/* Sidebar Specificity Fixes for Live Server */
.otb-nav-items {
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    line-height: 0;
}

.otb-nav-item {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    line-height: 1;
}

.otb-drawer-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}


/* =============================================================
   GLOBAL THEME CONFLICT OVERRIDE BLOCK
   All rules below use !important to override theme CSS that 
   applies justify-content:space-between/around to flex containers,
   causing unwanted spacing in all plugin UI elements.
   This block is a self-contained safety net - safe to update.
   ============================================================= */

/* --- Utility class: apply to any flex-column container --- */
.otb-flexfix {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 0 !important;
}

/* --- Primary layout containers --- */
#otb-app .otb-app-container {
    justify-content: flex-start !important;
}

#otb-app .otb-sidebar-nav {
    justify-content: flex-start !important;
    align-items: center !important;
}

#otb-app .otb-nav-items {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

#otb-app .otb-nav-item {
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    list-style: none !important;
}

#otb-app .otb-sidebar-drawer {
    justify-content: flex-start !important;
}

#otb-app .otb-drawer-header {
    justify-content: flex-start !important;
}

#otb-app .otb-drawer-content {
    justify-content: flex-start !important;
    align-items: stretch !important;
}

#otb-app .otb-workspace-area {
    justify-content: flex-start !important;
}

/* --- Drawer sections --- */
#otb-app .otb-drawer-section {
    justify-content: flex-start !important;
}

#otb-app .otb-bg-sub-section {
    justify-content: flex-start !important;
}

#otb-app .otb-code-tab {
    justify-content: flex-start !important;
}

/* --- ALL toolbar popovers (covers shadow-popover, align-popover, etc.) ---
   When a popover becomes active (.otb-active), it switches to flex-column so
   the theme can never override justify-content to space-between/around. */
#otb-app .otb-toolbar-popover.otb-active {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 0 !important;
}

/* Rows INSIDE a popover that intentionally use justify-content:space-between
   (e.g. label + value pairs) keep their own inline style since they 
   are not flex-column, they are flex-row. No override needed. */

/* --- Properties bar groups --- */
#otb-app .otb-prop-group {
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 4px 0 !important;
    margin: 0 !important;
}

/* Groups inside sidebar sections inherit padding from the section */
.otb-sidebar-section .otb-prop-group,
.otb-prop-section .otb-prop-group {
    padding: 2px 0 !important;
}

/* --- Specific popover resets --- */

#otb-app #shadow-popover.otb-active {
    gap: 8px !important;
    /* shadow popover rows need breathing room */
}

/* --- Prevent theme from adding list-style or spacing to nav items --- */
#otb-app .otb-nav-items *,
#otb-app .otb-nav-items *::before,
#otb-app .otb-nav-items *::after {
    list-style: none !important;
    list-style-type: none !important;
}


/* Floating "Disable Drawing" Button */
.otb-floating-btn {
    position: absolute !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(20px) !important;
    background: linear-gradient(135deg, #ff4757, #ff6b81) !important;
    color: #fff !important;
    padding: 12px 24px !important;
    border-radius: 40px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: none !important;
    /* Managed by JS (otb-active class) */
    align-items: center !important;
    gap: 10px !important;
    box-shadow: 0 10px 25px rgba(255, 71, 87, 0.4) !important;
    z-index: 2000 !important;
    opacity: 0 !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
}

.otb-floating-btn.otb-active {
    display: flex !important;
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0) !important;
}

.otb-floating-btn:hover {
    box-shadow: 0 15px 30px rgba(255, 71, 87, 0.5) !important;
    transform: translateX(-50%) translateY(-3px) !important;
    background: linear-gradient(135deg, #ff6b81, #ff4757) !important;
}

.otb-floating-btn:active {
    transform: translateX(-50%) translateY(0) !important;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3) !important;
}

/* ============================================================
   MOBILE RESPONSIVENESS (HIGH SPECIFICITY)
   ============================================================ */
@media screen and (max-width: 768px) {

    /* Main Layout: Stack vertically, nav at bottom */
    html body #otb-app .otb-app-container,
    html body #otb-editor-overlay .otb-app-container,
    html body .otb-app-container {
        flex-direction: column-reverse !important;
    }

    /* Bottom Navigation Bar */
    html body #otb-app .otb-sidebar-nav,
    html body #otb-editor-overlay .otb-sidebar-nav,
    html body .otb-sidebar-nav {
        width: 100vw !important;
        min-width: 100vw !important;
        height: 65px !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        padding: 0 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-right: none !important;
        z-index: 2100 !important;   /* above mobile-sheet (1595), mobile-strip (1600), backdrop (1590) */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
    }

    html body #otb-editor-overlay .otb-nav-items,
    html body .otb-nav-items {
        flex-direction: row !important;
        width: 100% !important;
        justify-content: space-around !important;
        align-items: center !important;
    }

    html body #otb-editor-overlay .otb-nav-item,
    html body .otb-nav-item {
        height: 65px !important;
        width: auto !important;
        flex: 1 !important;
        padding: 5px 0 !important;
        margin: 0 !important;
    }

    html body #otb-editor-overlay .otb-nav-item .otb-nav-icon,
    html body .otb-nav-item .otb-nav-icon {
        font-size: 24px !important;
        margin-bottom: 0 !important;
    }

    html body #otb-editor-overlay .otb-nav-item span,
    html body .otb-nav-item span {
        display: none !important;
    }

    /* Hide the collapse chevron button on mobile entirely */
    html body #otb-editor-overlay #otb-nav-collapse,
    html body #otb-nav-collapse {
        display: none !important;
    }

    /* Drawer: Full width overlay above the bottom nav */
    html body #otb-editor-overlay .otb-sidebar-drawer,
    html body .otb-sidebar-drawer {
        position: fixed !important;
        bottom: 65px !important;
        left: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: calc(100vh - 65px - 60px) !important;
        /* Total viewport minus bottom nav minus topbar */
        max-height: calc(100vh - 65px - 60px) !important;
        z-index: 2000 !important;
        border-radius: 12px 12px 0 0 !important;
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Active drawer on mobile */
    html body #otb-editor-overlay .otb-app-container:not(.collapsed) .otb-sidebar-drawer,
    html body .otb-app-container:not(.collapsed) .otb-sidebar-drawer {
        transform: translateY(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    html body #otb-editor-overlay .otb-app-container.collapsed .otb-sidebar-drawer,
    html body .otb-app-container.collapsed .otb-sidebar-drawer {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Add a close button for the drawer on mobile */
    html body #otb-editor-overlay .otb-mobile-drawer-close,
    html body .otb-mobile-drawer-close {
        display: flex !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: none !important;
        color: #fff !important;
        font-size: 20px !important;
        cursor: pointer !important;
        padding: 5px !important;
        border-radius: 50% !important;
        margin-left: auto !important;
        width: 32px !important;
        height: 32px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Light background Overwrite (Right Properties Bar) */
    html body .otb-properties-bar .otb-mobile-drawer-close {
        color: #333 !important;
        background: #f1f1f1 !important;
        border: 1px solid #ddd !important;
    }

    html body #otb-editor-overlay .otb-drawer-header,
    html body .otb-drawer-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 15px !important;
    }

    /* Top Toolbar horizontally scrollable */
    html body #otb-editor-overlay .otb-toolbar,
    html body .otb-toolbar {
        position: relative !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        flex-wrap: nowrap !important;
        padding: 0 10px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        /* Firefox */
    }

    html body #otb-editor-overlay .otb-toolbar::-webkit-scrollbar,
    html body .otb-toolbar::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    /* ================================================================
   PATCH: Mobile Properties Panel - Bottom Sheet UX
   File: public/css/otb-editor.css
   Lines to Replace: 3457-3522
   ================================================================ */

    /* REPLACE THIS SECTION (Lines 3457-3522) WITH THE CODE BELOW: */

    /* Properties bar: BOTTOM SHEET on mobile for better canvas visibility */
    html body #otb-editor-overlay .otb-properties-bar,
    html body .otb-properties-bar {
        position: fixed !important;
        bottom: 65px !important;
        /* Above bottom navigation */
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 45vh !important;
        /* Takes ~45% of screen height */
        max-height: 500px !important;
        /* Cap maximum height */
        min-height: 0 !important;
        top: auto !important;
        border-top: 1px solid #e0e0e0 !important;
        border-left: none !important;
        border-radius: 16px 16px 0 0 !important;
        /* Rounded top corners */
        background: #fff !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        white-space: normal !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        padding: 0 !important;
        z-index: 1500 !important;
        transform: translateY(calc(100% + 65px)) !important;
        /* Hidden below viewport */
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), height 0.25s ease !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
        scrollbar-width: thin !important;
    }

    /* Visible state: slides up from bottom */
    html body #otb-editor-overlay .otb-properties-bar.otb-visible,
    html body .otb-properties-bar.otb-visible {
        transform: translateY(0) !important;
    }

    /* Collapsed state: shows only header bar with controls */
    html body #otb-editor-overlay .otb-properties-bar.otb-collapsed,
    html body .otb-properties-bar.otb-collapsed {
        height: 80px !important;
        overflow: hidden !important;
    }

    /* Drag handle visual affordance at top of sheet */
    html body .otb-properties-bar::before {
        content: '' !important;
        display: block !important;
        width: 40px !important;
        height: 4px !important;
        background: #d0d0d0 !important;
        border-radius: 2px !important;
        margin: 8px auto 12px !important;
        flex-shrink: 0 !important;
    }

    /* Adjust close button position for bottom sheet layout */
    html body .otb-properties-bar .otb-mobile-drawer-close {
        position: absolute !important;
        top: 8px !important;
        right: 12px !important;
        z-index: 10 !important;
    }

    /* Collapse/expand toggle button (will be added by JS) */
    html body .otb-properties-bar .otb-sheet-toggle {
        position: absolute !important;
        top: 8px !important;
        left: 12px !important;
        background: rgba(0, 0, 0, 0.05) !important;
        border: none !important;
        border-radius: 50% !important;
        width: 28px !important;
        height: 28px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        color: #555 !important;
        font-size: 16px !important;
        z-index: 10 !important;
        padding: 0 !important;
    }

    /* Content padding for bottom sheet */
    html body .otb-properties-bar>*:not(.otb-mobile-drawer-close):not(.otb-sheet-toggle) {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Ensure first content section has proper top spacing */
    html body .otb-properties-bar>.otb-prop-group:first-of-type,
    html body .otb-properties-bar>.otb-prop-section:first-of-type,
    html body .otb-properties-bar>.otb-sidebar-section:first-of-type {
        padding-top: 48px !important;
        /* Space for handle + buttons */
    }

    html body #otb-editor-overlay .otb-properties-bar::-webkit-scrollbar,
    html body .otb-properties-bar::-webkit-scrollbar {
        width: 3px !important;
    }

    html body .otb-properties-bar::-webkit-scrollbar-thumb {
        background: #ddd !important;
        border-radius: 2px !important;
    }

    html body #otb-editor-overlay .otb-prop-group,
    html body .otb-prop-group {
        flex-wrap: wrap !important;
        flex-shrink: 0 !important;
        width: 100% !important;
    }

    html body #otb-editor-overlay .otb-actions-group,
    html body .otb-actions-group {
        margin-left: 0 !important;
        flex-shrink: 0 !important;
    }

    /* Properties bar backdrop: tap outside to close */
    html body .otb-props-backdrop {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        z-index: 1490 !important;
        background: transparent !important;
    }

    html body .otb-props-backdrop.otb-visible {
        display: block !important;
        background: rgba(0, 0, 0, 0.15) !important;
        /* Slightly darker for bottom sheet */
    }

    /* Landscape orientation: use more vertical space */
    @media screen and (max-width: 768px) and (orientation: landscape) {

        html body #otb-editor-overlay .otb-properties-bar,
        html body .otb-properties-bar {
            height: 60vh !important;
            max-height: 400px !important;
        }
    }

    /* Very small screens: adjust height */
    @media screen and (max-width: 375px) {

        html body #otb-editor-overlay .otb-properties-bar,
        html body .otb-properties-bar {
            height: 50vh !important;
        }
    }

    /* Support for dynamic viewport units (avoids keyboard overlap) */
    @supports (height: 100dvh) {

        html body #otb-editor-overlay .otb-properties-bar,
        html body .otb-properties-bar {
            height: 45dvh !important;
            max-height: calc(45dvh - env(safe-area-inset-bottom, 0px)) !important;
        }

        @media screen and (max-width: 768px) and (orientation: landscape) {

            html body #otb-editor-overlay .otb-properties-bar,
            html body .otb-properties-bar {
                height: 60dvh !important;
            }
        }

        @media screen and (max-width: 375px) {

            html body #otb-editor-overlay .otb-properties-bar,
            html body .otb-properties-bar {
                height: 50dvh !important;
            }
        }
    }

    /* END OF REPLACEMENT SECTION */


    /* Canvas area: sits between the toolbar (60px) and bottom nav+bar (64px+44px=109px) */
    html body #otb-editor-overlay .otb-canvas-container,
    html body .otb-canvas-container {
        padding: 24px 12px 20px 12px !important;
        height: calc(100dvh - 60px - 109px) !important;
        /* dvh avoids mobile URL-bar issues */
        /* fallback for browsers without dvh */
        height: calc(100vh - 60px - 109px) !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    @supports (height: 100dvh) {

        html body #otb-editor-overlay .otb-canvas-container,
        html body .otb-canvas-container {
            height: calc(100dvh - 60px - 109px) !important;
        }
    }

    html body #otb-editor-overlay .otb-workspace-area,
    html body .otb-workspace-area {
        height: calc(100dvh - 65px) !important;
        height: calc(100vh - 65px) !important;
        /* fallback */
        overflow: hidden !important;
    }

    @supports (height: 100dvh) {

        html body #otb-editor-overlay .otb-workspace-area,
        html body .otb-workspace-area {
            height: calc(100dvh - 65px) !important;
        }
    }

    /* Hide rulers on mobile — recovers the 20px offset and simplifies layout */
    html body .otb-ruler,
    html body .otb-ruler-corner {
        display: none !important;
    }

    /* Ruler wrapper: no ruler offset needed */
    html body .otb-ruler-wrapper {
        padding-top: 0 !important;
        padding-left: 0 !important;
    }

    /* Toolbar buttons: enforce 44×44px min tap target (WCAG) */
    html body .otb-toolbar-btn {
        min-width: 40px !important;
        min-height: 40px !important;
    }

    /* Icon buttons in properties bar: minimum 36px tap target */
    html body .otb-icon-btn {
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* Prevent browser native pan/zoom interfering with Fabric.js touch events */
    html body .canvas-container canvas {
        touch-action: none !important;
    }

    /* Toolbar Popovers */
    html body #otb-editor-overlay .otb-toolbar-popover,
    html body .otb-toolbar-popover,
    html body .otb-font-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 320px !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
        z-index: 100000 !important;
    }

    /* Crop Toolbar */
    html body #otb-editor-overlay .otb-crop-toolbar,
    html body .otb-crop-toolbar {
        bottom: 80px !important;
        width: 90% !important;
        justify-content: center !important;
    }

    /* Pages / Bottom bar is now above the nav on mobile */
    html body #otb-editor-overlay .otb-bottom-bar,
    html body .otb-bottom-bar {
        position: fixed !important;
        bottom: 65px !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 2050 !important;   /* above mobile-sheet (1595), mobile-strip (1600), backdrop (1590); below nav (2100) */
    }

    /* Relocate Close control to top-right corner, inside toolbar area */
    html body #otb-editor-overlay .otb-window-controls,
    html body .otb-window-controls {
        top: 14px !important;
        bottom: auto !important;
        left: auto !important;
        right: 10px !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    html body #otb-editor-overlay .otb-win-btn,
    html body .otb-win-btn {
        width: 32px !important;
        height: 32px !important;
        margin: 0 !important;
        background: #fff !important;
        color: #555 !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 6px !important;
    }

    html body #otb-editor-overlay .otb-win-btn svg.lucide,
    html body .otb-win-btn svg.lucide {
        width: 15px !important;
        height: 15px !important;
    }

    /* Horizontal Scroll Hint Animation */
    @keyframes otb-swipe-hint {
        0% {
            transform: translateX(0);
            opacity: 0.8;
        }

        50% {
            transform: translateX(-8px);
            opacity: 1;
        }

        100% {
            transform: translateX(0);
            opacity: 0.8;
        }
    }

    @keyframes otb-fade-out {
        0% {
            opacity: 1;
            visibility: visible;
        }

        80% {
            opacity: 1;
            visibility: visible;
        }

        100% {
            opacity: 0;
            visibility: hidden;
        }
    }

    html body #otb-editor-overlay .otb-mobile-scroll-hint,
    html body .otb-mobile-scroll-hint {
        position: sticky !important;
        right: 0 !important;
        top: 0 !important;
        height: 100% !important;
        width: 40px !important;
        background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 50%, rgba(255, 255, 255, 1) 100%) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        padding-right: 10px !important;
        color: var(--otb-accent) !important;
        pointer-events: none !important;
        z-index: 100 !important;
        flex-shrink: 0 !important;
        transition: opacity 0.3s ease-out !important;
    }

    /* Target the SVG icon inside the hint to do the sliding animation */
    html body #otb-editor-overlay .otb-mobile-scroll-hint i,
    html body .otb-mobile-scroll-hint i {
        animation: otb-swipe-hint 1.2s infinite ease-in-out !important;
    }

    /* Floating draw-mode button: lift above bottom nav */
    html body .otb-floating-btn {
        bottom: 120px !important;
        font-size: 12px !important;
        padding: 10px 18px !important;
    }

    /* Help modal: full-screen on mobile */
    html body .otb-help-modal {
        width: 100vw !important;
        height: 100dvh !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
    }

    html body .otb-help-modal.otb-active {
        transform: none !important;
    }

    /* Modal box: full width */
    html body .otb-modal-box {
        width: 90vw !important;
        max-width: 90vw !important;
    }

    /* ── Suppress the old 45vh bottom-sheet on mobile now that the new system handles it ── */
    html body .otb-properties-bar {
        display: none !important;
    }

    /* ─────────────────────────────────────────────────────────────
       MOBILE ACTION STRIP
       Fixed thin bar just above the bottom nav.
       Visible only when an object is selected.
    ───────────────────────────────────────────────────────────── */
    html body .otb-mobile-strip {
        position: fixed !important;
        bottom: 109px !important;           /* 65px nav + 44px .otb-bottom-bar */
        left: 0 !important;
        right: 0 !important;
        height: 52px !important;
        background: #fff !important;
        border-top: 1px solid #e8e8e8 !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 10px !important;
        gap: 2px !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        z-index: 1600 !important;           /* above sheet backdrop (1590) */
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08) !important;
    }
    html body .otb-mobile-strip[aria-hidden="true"] {
        display: none !important;
    }
    html body .otb-mobile-strip::-webkit-scrollbar { display: none !important; }

    /* Strip buttons — reuse same class patterns as desktop .otb-strip-btn */
    html body .otb-mstrip-btn {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        min-width: 44px !important;
        height: 44px !important;
        border-radius: 6px !important;
        border: none !important;
        background: transparent !important;
        color: #333 !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
        padding: 0 4px !important;
        transition: background 0.12s, color 0.12s !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    html body .otb-mstrip-btn svg {
        width: 18px !important;
        height: 18px !important;
        flex-shrink: 0 !important;
    }
    html body .otb-mstrip-label {
        font-size: 9px !important;
        font-weight: 500 !important;
        line-height: 1 !important;
        max-width: 44px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    html body .otb-mstrip-btn:active,
    html body .otb-mstrip-btn.active {
        background: rgba(139,61,255,0.1) !important;
        color: var(--otb-accent) !important;
    }
    html body .otb-mstrip-btn.active-panel {
        background: rgba(139,61,255,0.1) !important;
        color: var(--otb-accent) !important;
        outline: 1px solid rgba(139,61,255,0.3) !important;
        border-radius: 6px !important;
    }
    html body .otb-mstrip-btn.otb-mstrip-action {
        font-size: 12px !important;
        font-weight: 600 !important;
        min-width: 52px !important;
        flex-direction: row !important;
        gap: 4px !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 6px !important;
        padding: 0 10px !important;
    }
    html body .otb-mstrip-btn.otb-mstrip-icon {
        min-width: 40px !important;
    }
    html body .otb-mstrip-div {
        width: 1px !important;
        height: 24px !important;
        background: #e8e8e8 !important;
        flex-shrink: 0 !important;
        align-self: center !important;
        margin: 0 3px !important;
    }
    html body .otb-mstrip-stepper {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0 !important;
        flex-shrink: 0 !important;
        background: rgba(0,0,0,0.04) !important;
        border-radius: 6px !important;
        overflow: hidden !important;
    }
    html body .otb-mstrip-step-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 30px !important;
        height: 36px !important;
        font-size: 16px !important;
        font-weight: 500 !important;
        background: none !important;
        border: none !important;
        color: #333 !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
        flex-shrink: 0 !important;
    }
    html body .otb-mstrip-step-btn:active {
        background: rgba(139,61,255,0.12) !important;
        color: var(--otb-accent) !important;
    }
    html body .otb-mstrip-step-val {
        min-width: 28px !important;
        text-align: center !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        color: #333 !important;
        pointer-events: none !important;
    }
    html body .otb-mstrip-info {
        font-size: 12px !important;
        color: #888 !important;
        padding: 0 6px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* ─────────────────────────────────────────────────────────────
       MOBILE HALF-SHEET
       Slides up from below the strip to show panel details.
       Default height ~220px (compact). Scrollable inside.
    ───────────────────────────────────────────────────────────── */
    html body .otb-mobile-sheet {
        position: fixed !important;
        bottom: 161px !important;           /* 65px nav + 44px bottom-bar + 52px strip */
        left: 0 !important;
        right: 0 !important;
        height: 230px !important;           /* JS overrides this inline during drag */
        min-height: 250px !important;
        max-height: 80vh !important;
        background: #fff !important;
        border-top: 1px solid #e0e0e0 !important;
        border-radius: 16px 16px 0 0 !important;
        z-index: 1595 !important;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.12) !important;
        transform: translateY(100%) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    html body .otb-mobile-sheet.otb-sheet-open {
        transform: translateY(0) !important;
    }
    html body .otb-mobile-sheet[aria-hidden="true"]:not(.otb-sheet-open) {
        pointer-events: none !important;
    }

    /* Drag handle pill — pointer-events off; parent header handles touch */
    html body .otb-mobile-sheet-handle {
        width: 36px !important;
        height: 4px !important;
        background: #d0d0d0 !important;
        border-radius: 2px !important;
        margin: 8px auto 4px !important;
        flex-shrink: 0 !important;
        pointer-events: none !important;
    }

    /* Full-width tap / drag zone above the sheet body */
    html body .otb-sheet-drag-header {
        width: 100% !important;
        padding: 4px 0 2px 0 !important;
        flex-shrink: 0 !important;
        display: flex !important;
        justify-content: center !important;
        cursor: ns-resize !important;
        touch-action: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
    }

    /* While dragging: disable the slide-in transition so height tracks the finger */
    html body .otb-mobile-sheet.otb-sheet-dragging {
        transition: none !important;
    }

    /* Scrollable body */
    html body .otb-mobile-sheet-body {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 0 16px !important;   /* bottom breathing room so last item is never clipped */
        scrollbar-width: thin !important;
    }
    html body .otb-mobile-sheet-body::-webkit-scrollbar {
        width: 3px !important;
    }
    html body .otb-mobile-sheet-body::-webkit-scrollbar-thumb {
        background: #ddd !important;
        border-radius: 2px !important;
    }

    /* Sheet title row */
    html body .otb-msheet-title {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 14px 6px !important;
        border-bottom: 1px solid #f0f0f0 !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #333 !important;
        flex-shrink: 0 !important;
    }
    html body .otb-msheet-close {
        width: 24px !important;
        height: 24px !important;
        border: none !important;
        background: #f0f0f0 !important;
        border-radius: 50% !important;
        color: #666 !important;
        font-size: 13px !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    /* All panel content inside the sheet: padding + touch-friendly row sizes */
    html body .otb-mobile-sheet-body .otb-panel-rows {
        padding: 10px 14px !important;
        gap: 12px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-row {
        min-height: 36px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-row-label {
        min-width: 80px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-fill-wrap,
    html body .otb-mobile-sheet-body .otb-panel-font-list,
    html body .otb-mobile-sheet-body .otb-panel-icon-grid {
        padding: 10px 14px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-font-item {
        padding: 10px 12px !important;
        font-size: 15px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-icon-btn {
        min-height: 44px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-icon-btn-sm {
        width: 40px !important;
        height: 40px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-action-btn {
        min-height: 40px !important;
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-slider {
        height: 6px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-color-swatch {
        width: 38px !important;
        height: 30px !important;
    }

    /* renderColorProp gradient toggle and solid swatch — larger touch targets */
    html body .otb-mobile-sheet-body .otb-icon-btn {
        min-width: 40px !important;
        min-height: 40px !important;
    }
    html body .otb-mobile-sheet-body .otb-color-btn {
        width: 36px !important;
        height: 36px !important;
    }

    /* ── Sheet backdrop ── */
    html body .otb-mobile-sheet-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 109px !important;   /* stop at nav(65) + bar(44) — don't cover those */
        background: transparent !important;
        z-index: 1590 !important;
        pointer-events: none !important;
        transition: background 0.2s !important;
    }
    html body .otb-mobile-sheet-backdrop.otb-sheet-open {
        pointer-events: auto !important;
        background: rgba(0,0,0,0.12) !important;
    }

    /* ── Canvas extra bottom padding when strip is visible ──
       Prevents the fixed strip from covering the bottom of the canvas.
       Strip bottom = 109px (nav 65 + bottom-bar 44), strip height = 52px,
       so the strip's top edge is at 109 + 52 = 161px from the screen bottom.
       The canvas already accounts for nav (65px) + bottom-bar (44px) = 109px
       in its height calc, so we only need extra padding for the strip's 52px. */
    html body .otb-canvas-container {
        padding-bottom: 64px !important;
    }

    /* Font search in the mobile sheet — full width, large enough to type */
    html body .otb-mobile-sheet-body .otb-panel-search {
        font-size: 16px !important;  /* prevents iOS auto-zoom on focus */
    }

}

/* ── Base rules (desktop hides mobile elements) ── */
.otb-mobile-strip,
.otb-mobile-sheet,
.otb-mobile-sheet-backdrop {
    display: none !important;
}
/* Arrow pad: hidden on desktop always; on mobile shown only when JS adds .otb-ap-visible */
@media screen and (min-width: 769px) {
    .otb-arrow-pad { display: none !important; }
}
@media screen and (max-width: 768px) {
    .otb-mobile-strip  { display: flex !important; }
    .otb-mobile-sheet  { display: flex !important; }
    .otb-mobile-sheet-backdrop { display: block !important; }
}

/* ── Mobile Arrow Pad ── */
.otb-arrow-pad {
    position: fixed;
    bottom: 120px;
    right: 16px;
    z-index: 9999;
    user-select: none;
    touch-action: none;
}
.otb-arrow-pad-inner {
    display: grid;
    grid-template-columns: 48px 48px 48px;
    grid-template-rows: 48px 48px 48px;
    gap: 4px;
}
.otb-ap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1.5px solid rgba(255,255,255,0.25);
    background: rgba(30,30,40,0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, transform 0.08s;
}
.otb-ap-btn:active { background: rgba(80,100,220,0.85); transform: scale(0.92); }
.otb-ap-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* Grid placement: row 1 up, row 2 left/center/right, row 3 down */
.otb-ap-up     { grid-column: 2; grid-row: 1; }
.otb-ap-left   { grid-column: 1; grid-row: 2; }
.otb-ap-center { grid-column: 2; grid-row: 2; cursor: grab; background: rgba(50,50,70,0.88); }
.otb-ap-center:active { cursor: grabbing; }
.otb-ap-right  { grid-column: 3; grid-row: 2; }
.otb-ap-down   { grid-column: 2; grid-row: 3; }

/* --- [otb_templates_list] Shortcode --- */
.otb-templates-masonry {
    column-count: var(--otb-columns, 3);
    column-gap: 20px;
    width: 100%;
    margin: 20px 0;
}

.otb-template-item {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin-bottom: 25px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
}

.otb-template-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.otb-template-thumb-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #fdfdfd;
}

.otb-template-thumb {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.3s ease;
}

.otb-template-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    text-align: center;
}

.otb-template-item:hover .otb-template-overlay {
    opacity: 1;
}

.otb-template-item:hover .otb-template-thumb {
    filter: blur(2px) brightness(0.8);
}

.otb-template-title-rollover {
    color: #fff;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.otb-template-footer {
    padding: 12px;
    background: #fff;
}

.otb-template-title-below {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 700;
    color: #222;
    text-align: center;
    line-height: 1.3;
}

/* Responsive Masonry Overrides — never override the modal grid (it uses --otb-columns explicitly) */
@media (max-width: 1000px) {
    .otb-templates-masonry:not(.otb-category-modal-grid) {
        column-count: 3 !important;
    }
}

@media (max-width: 700px) {
    .otb-templates-masonry:not(.otb-category-modal-grid) {
        column-count: 2 !important;
    }
}

@media (max-width: 450px) {
    .otb-templates-masonry:not(.otb-category-modal-grid) {
        column-count: 1 !important;
    }
}

/* Modal grid: graceful column reduction at very narrow viewports */
@media (max-width: 600px) {
    .otb-category-modal-grid {
        column-count: 2 !important;
    }
}

@media (max-width: 400px) {
    .otb-category-modal-grid {
        column-count: 1 !important;
    }
}

/* ─── Grouped-Category View ([otb_templates_list] with no category/ids) ─── */
.otb-grouped-categories {
    width: 100%;
}

.otb-category-section {
    margin-bottom: 48px;
}

.otb-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.otb-category-heading {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.otb-category-count {
    font-size: 14px;
    font-weight: 400;
    color: #888;
    margin-left: 4px;
}

.otb-category-description {
    margin: 0 0 14px;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.otb-view-all-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    padding: 6px 16px;
    border: 2px solid #1a1a2e;
    border-radius: 6px;
    background: transparent;
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.otb-view-all-btn:hover {
    background: #1a1a2e;
    color: #fff;
}

/* ─── Category Modal ─── */
.otb-category-modal {
    position: fixed;
    inset: 0;
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
}

.otb-category-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.otb-category-modal-dialog {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 12px;
    width: min(92vw, 1100px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.otb-category-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.otb-category-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.otb-category-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.otb-category-modal-close:hover {
    background: #f0f0f0;
    color: #111;
}

.otb-category-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 24px;
    -webkit-overflow-scrolling: touch;
}

.otb-category-modal-body .otb-templates-masonry {
    margin: 0;
}

.otb-category-modal-loader {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
}

@media (max-width: 600px) {
    .otb-category-modal-dialog {
        width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }

    .otb-category-modal-body {
        padding: 14px 16px;
    }

    .otb-category-heading {
        font-size: 16px;
    }
}

/* ─── Format Popover (Text options, body-fixed, never clipped by sidebar) ─── */
.otb-format-popover {
    /* Displayed block with fixed positioning set by JS.
       Override the base .otb-toolbar-popover overflow:hidden so inner
       content can scroll vertically when the popover is taller than viewport. */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 14px !important;
    border-radius: 10px !important;
    line-height: 1.4 !important;
    /* Limit height so it never exceeds the viewport */
    max-height: min(480px, 80vh) !important;
}

.otb-format-popover .otb-popover-label {
    font-size: 10px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 6px 0;
    display: block;
}

.otb-format-popover .otb-popover-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

/* Subtle scrollbar inside the popover */
.otb-format-popover::-webkit-scrollbar {
    width: 4px;
}

.otb-format-popover::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* ─── Image Actions Row (Crop + Tint side-by-side) ──────────────────────── */
.otb-image-actions-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 2px 0 !important;
    flex-wrap: nowrap !important;
}

/* ─── Image prop rows (Radius + Mask inside Shape section) ──────────────── */
.otb-image-prop-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 3px 0 !important;
    flex-wrap: nowrap !important;
}

.otb-image-prop-label {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 36px;
}

/* Stepper widget (replaces the old ad-hoc styled buttons) */
.otb-stepper {
    display: flex !important;
    align-items: center !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    height: 28px !important;
    background: #fff !important;
    flex-shrink: 0 !important;
}

.otb-stepper-btn {
    width: 26px !important;
    height: 100% !important;
    border: none !important;
    background: #f8f9fa !important;
    cursor: pointer !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #555 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: background 0.15s !important;
    flex-shrink: 0 !important;
}

.otb-stepper-btn:hover {
    background: #eef1f4 !important;
    color: #1a73e8 !important;
}

.otb-stepper-input {
    width: 44px !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid #eee !important;
    border-right: 1px solid #eee !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #333 !important;
    height: 100% !important;
    padding: 0 !important;
    outline: none !important;
    background: #fff !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
    min-height: 0 !important;
}

.otb-stepper-input::-webkit-outer-spin-button,
.otb-stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Shape mask select inside the image section */
.otb-image-shape-select {
    flex: 1 !important;
    height: 28px !important;
    font-size: 11px !important;
    padding: 0 6px !important;
}

/* ─── Tint Overlay Popover ───────────────────────────────────────────────── */
.otb-tint-popover {
    width: 260px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    line-height: 1.4 !important;
}

.otb-tint-header {
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    padding: 9px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.otb-tint-title {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Each control row inside the popover */
.otb-tint-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border-bottom: 1px solid #f5f5f5;
}

.otb-tint-row:last-child {
    border-bottom: none;
}

.otb-tint-row-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    min-width: 46px;
    flex-shrink: 0;
}

/* Color row */
.otb-tint-color-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.otb-tint-swatch-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.otb-tint-swatch-btn input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.otb-tint-swatch {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.otb-tint-hex-val {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* Slider row */
.otb-tint-slider-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.otb-tint-range {
    flex: 1 !important;
    min-width: 0 !important;
}

.otb-tint-pct-val {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* Mode select */
.otb-tint-mode-row {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
}

.otb-tint-mode-select {
    flex: 1 !important;
    height: 28px !important;
    font-size: 11px !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    padding: 0 6px !important;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer !important;
    outline: none !important;
}

.otb-tint-mode-select:hover {
    border-color: #bbb !important;
}

/* Hint row */
.otb-tint-hint {
    padding: 7px 13px 9px;
    font-size: 10px;
    color: #aaa;
    line-height: 1.4;
    font-style: italic;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
}

/* ─── Sidebar polish: section headers, spacing, visual hierarchy ─────────── */

/* Top breathing room — the first section gets a touch of extra top padding
   so controls never feel attached to the sidebar's top edge. */
.otb-properties-bar>.otb-sidebar-section:first-child,
.otb-properties-bar>.otb-prop-group:first-child,
.otb-properties-bar>.otb-prop-section:first-child {
    padding-top: 14px !important;
}

/* The icon-grid (used in action grids) respects section padding */
.otb-sidebar-section .otb-icon-grid,
.otb-prop-section .otb-icon-grid {
    padding: 0 !important;
    margin-top: 2px !important;
    gap: 5px !important;
}

/* renderColorProp returns an otb-prop-group wrapping another otb-prop-group.
   Zero out the outer wrapper's own padding so it doesn't double-space. */
.otb-sidebar-section>.otb-prop-group>.otb-prop-group {
    padding: 0 !important;
}

/* Layer label inline prefix inside a prop-group */
.otb-layer-prefix {
    font-size: 10px;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 2px;
}

/* Scrollbar for the properties bar */
.otb-properties-bar::-webkit-scrollbar {
    width: 4px !important;
}

.otb-properties-bar::-webkit-scrollbar-thumb {
    background: #e0e0e0 !important;
    border-radius: 2px !important;
}

.otb-properties-bar::-webkit-scrollbar-track {
    background: transparent !important;
}

/* ─── Multi-select header ────────────────────────────────────────────────── */
.otb-multi-header-section {
    padding-bottom: 8px !important;
}

.otb-multi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.otb-multi-header-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.otb-multi-header-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Group / Ungroup shared button style ────────────────────────────────── */
.otb-group-btn,
.otb-ungroup-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border: none !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
    line-height: 1 !important;
}

.otb-group-btn {
    background: rgba(139, 61, 255, 0.10) !important;
    color: #8b3dff !important;
}

.otb-group-btn:hover {
    background: rgba(139, 61, 255, 0.18) !important;
}

.otb-ungroup-btn {
    background: #f3f4f6 !important;
    color: #555 !important;
}

.otb-ungroup-btn:hover {
    background: #e8eaed !important;
    color: #333 !important;
}

/* ─── Group banner (single-object group view) ────────────────────────────── */
.otb-group-banner-section {
    padding-bottom: 10px !important;
}

.otb-group-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.otb-group-banner-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.otb-group-banner-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

/* ─── Group child color swatches ─────────────────────────────────────────── */
.otb-group-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.otb-group-color-swatch {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.otb-group-swatch-label {
    display: block;
    cursor: pointer;
    line-height: 0;
}

.otb-group-swatch-preview {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s, box-shadow 0.15s;
}

.otb-group-color-swatch:hover .otb-group-swatch-preview,
.otb-group-grad-swatch:hover .otb-group-swatch-preview {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.otb-group-color-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
}

.otb-group-swatch-count {
    font-size: 9px;
    font-weight: 700;
    color: #aaa;
    line-height: 1;
    text-align: center;
}

.otb-group-grad-swatch {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}

/* ─── Shadow Popover — slider-based layout ───────────────────────────────── */
.otb-shadow-popover {
    width: 240px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    line-height: 1.4 !important;
}

.otb-shadow-pop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 13px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.otb-shadow-pop-title {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.otb-shadow-color-btn {
    width: 26px !important;
    height: 26px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    position: relative !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    padding: 2px !important;
    background: #fff !important;
}

/* Each slider row */
.otb-shadow-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border-bottom: 1px solid #f5f5f5;
}

.otb-shadow-slider-row:last-child {
    border-bottom: none;
}

.otb-shadow-slider-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    min-width: 54px;
    flex-shrink: 0;
}

.otb-shadow-range {
    flex: 1 !important;
    min-width: 0 !important;
    height: 4px !important;
}

.otb-shadow-slider-val {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ─── Text Tools Row (T + bg + align in one row) ─────────────────────────── */
.otb-text-tools-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    padding: 4px 0 !important;
}

/* Slightly larger hit target for text tool buttons for usability */
.otb-text-tool-btn {
    flex-shrink: 0 !important;
}

/* ============================================================
   TABLET BREAKPOINT (769px – 1024px)
   Narrows sidebar + drawer so canvas gets more room,
   but keeps the full desktop column layout.
   ============================================================ */
@media screen and (min-width: 769px) and (max-width: 1024px) {

    /* Shrink the drawer from 340px → 260px */
    html body .otb-sidebar-drawer {
        width: 260px !important;
        min-width: 260px !important;
        --otb-drawer-width: 260px !important;
    }

    /* Shrink the properties bar from 280px → 230px */
    html body .otb-properties-bar {
        width: 230px !important;
        min-width: 230px !important;
    }

    /* Smaller canvas padding gives more room */
    html body .otb-canvas-container {
        padding: 24px 24px !important;
    }

    /* Tighten drawer content padding */
    html body .otb-drawer-content {
        padding: 10px 12px !important;
    }
}

/* ============================================================
   GLOBAL VIEWPORT HEIGHT — Mobile Browser URL Bar Fix
   Use svh (smallest viewport height) when supported so the
   editor container never overflows behind the mobile browser's
   dynamic URL/tab bar.
   ============================================================ */
@supports (height: 100svh) {

    #otb-app,
    #otb-frontend-app {
        height: 100svh !important;
        max-height: 100svh !important;
    }
}

/* Touch-action: none on the Fabric.js canvas wrapper so the browser
   doesn't intercept two-finger pinch/pan before Fabric sees them */
.canvas-container {
    touch-action: none;
}

/* ============================================================
   CONTEXT STRIP — Contextual sub-toolbar (Stage 1 / 2)
   ============================================================ */

/* Outer wrapper — holds the strip + scroll arrows as a single bar */
.otb-context-strip-outer {
    position: relative !important;
    display: flex !important;
    align-items: stretch !important;
    flex-shrink: 0 !important;
    background: #fff !important;
    border-bottom: 1px solid #e8e8e8 !important;
    z-index: 990 !important;
    overflow: hidden !important;
    padding: 0 30px !important;
}

/* Scroll arrow buttons — sit at left/right edges of the outer wrapper */
.otb-strip-scroll-btn {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 26px !important;
    height: 26px !important;
    z-index: 5 !important;
    border: 1px solid #d0d0d0 !important;
    border-radius: 50% !important;
    background: #fff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    line-height: 1 !important;
    color: #444 !important;
    padding: 0 !important;
    transition: background 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s !important;
    flex-shrink: 0 !important;
}
.otb-strip-scroll-btn:hover {
    background: #8b3dff !important;
    color: #fff !important;
    border-color: #8b3dff !important;
    box-shadow: 0 2px 8px rgba(139,61,255,0.35) !important;
}
.otb-strip-scroll-left  { left: 6px !important; }
.otb-strip-scroll-right { right: 6px !important; }

/* Dynamic padding: only applied when the corresponding arrow is visible,
   so content never hides behind an active scroll arrow */
.otb-context-strip-outer.otb-strip-has-left-arrow  .otb-context-strip { padding-left:  40px !important; }
.otb-context-strip-outer.otb-strip-has-right-arrow .otb-context-strip { padding-right: 40px !important; }

.otb-context-strip {
    height: 48px !important;
    background: transparent !important;
    border-bottom: none !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 10px !important;
    gap: 3px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    z-index: 1 !important;
    scrollbar-width: none !important;
    position: relative !important;
}
.otb-context-strip::-webkit-scrollbar { display: none !important; }

/* Dividers */
.otb-strip-divider {
    width: 1px !important;
    height: 20px !important;
    background: #e0e0e0 !important;
    margin: 0 4px !important;
    flex-shrink: 0 !important;
    align-self: center !important;
}

/* Strip buttons */
.otb-strip-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 0 8px !important;
    height: 32px !important;
    border-radius: 5px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #333 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    transition: background 0.12s, color 0.12s !important;
    line-height: 1 !important;
}

/* Inline SVG icons in the strip — base size 16px, never smaller than 14px */
.otb-strip-btn svg {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
}
.otb-strip-btn:hover {
    background: #f0f0f0 !important;
}
.otb-strip-btn.otb-active {
    background: rgba(139, 61, 255, 0.1) !important;
    color: var(--otb-accent) !important;
}
.otb-strip-btn.otb-panel-open {
    background: rgba(139, 61, 255, 0.08) !important;
    color: var(--otb-accent) !important;
    outline: 1px solid rgba(139, 61, 255, 0.25) !important;
}
.otb-strip-btn.otb-strip-icon-only {
    padding: 0 !important;
    width: 32px !important;
    justify-content: center !important;
}
.otb-strip-btn.otb-strip-action-btn {
    font-weight: 600 !important;
    padding: 0 10px !important;
    border: 1px solid #e0e0e0 !important;
}
.otb-strip-btn .otb-strip-btn-label {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.otb-strip-info {
    font-size: 12px !important;
    color: #888 !important;
    padding: 0 6px !important;
    white-space: nowrap !important;
}

/* Disabled state for strip & mobile-strip buttons (e.g. while Remove BG runs) */
.otb-strip-btn:disabled,
.otb-mstrip-btn:disabled {
    opacity: 0.55 !important;
    cursor: wait !important;
    pointer-events: none !important;
}

/* Spinning icon used inside buttons during async operations */
@keyframes otb-btn-spin {
    to { transform: rotate(360deg); }
}
.otb-btn-spinner {
    display: inline-block !important;
    flex-shrink: 0 !important;
    animation: otb-btn-spin 0.75s linear infinite !important;
}

/* ── Background Removal progress overlay ──────────────────────── */
.otb-bg-rm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    transition: background 0.25s ease;
    pointer-events: all;
}
.otb-bg-rm-overlay--visible {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
}
.otb-bg-rm-card {
    background: #fff;
    border-radius: 18px;
    padding: 32px 40px;
    min-width: 280px;
    max-width: 360px;
    width: 90vw;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.otb-bg-rm-overlay--visible .otb-bg-rm-card {
    transform: translateY(0);
    opacity: 1;
}
/* Large spinner at top of card */
.otb-bg-rm-spinner {
    width: 36px !important;
    height: 36px !important;
    color: var(--otb-accent, #8b3dff);
    animation: otb-btn-spin 0.9s linear infinite;
    flex-shrink: 0;
}
.otb-bg-rm-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}
.otb-bg-rm-status {
    font-size: 12px;
    color: #666;
    min-height: 16px;
    line-height: 1.4;
}
/* Progress bar */
.otb-bg-rm-bar-track {
    width: 100%;
    height: 8px;
    background: #ece8f5;
    border-radius: 99px;
    overflow: hidden;
}
.otb-bg-rm-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b3dff, #c084fc);
    border-radius: 99px;
    transition: width 0.35s ease;
}
/* Percentage + ETA row */
.otb-bg-rm-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 18px;
}
.otb-bg-rm-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--otb-accent, #8b3dff);
}
.otb-bg-rm-eta {
    font-size: 11px;
    color: #999;
}
.otb-bg-rm-cancel {
    margin-top: 4px;
    padding: 7px 22px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.otb-bg-rm-cancel:hover {
    background: #fee2e2;
    border-color: #e74c3c;
    color: #e74c3c;
}

/* ── BG Tools panel (3 tabs) ───────────────────────────────────── */
.otb-bg-tools-panel {
    min-width: 220px;
    padding: 2px 0;
}
.otb-bg-tools-desc {
    font-size: 11px;
    color: #888;
    margin: 4px 0 10px;
    line-height: 1.5;
}

/* ── Primary action button used inside float panels / sheets ────── */
/* Applies to: Remove Background, Apply (Replace), Apply Blur       */
.otb-apply-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 8px 16px !important;
    border-radius: 7px !important;
    border: none !important;
    background: var(--otb-accent, #8b3dff) !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.15s, opacity 0.15s, transform 0.1s !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    box-shadow: 0 2px 6px rgba(139, 61, 255, 0.30) !important;
}
.otb-apply-btn:hover {
    background: #7b2ff7 !important;
    box-shadow: 0 3px 10px rgba(139, 61, 255, 0.40) !important;
}
.otb-apply-btn:active {
    transform: scale(0.97) !important;
    opacity: 0.92 !important;
}
.otb-apply-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}
/* Dark-mode variant */
body.otb-dm .otb-apply-btn,
#otb-app.otb-dark-mode .otb-apply-btn,
#otb-frontend-app.otb-dark-mode .otb-apply-btn {
    background: #9d55ff !important;
    box-shadow: 0 2px 8px rgba(157, 85, 255, 0.35) !important;
}
body.otb-dm .otb-apply-btn:hover,
#otb-app.otb-dark-mode .otb-apply-btn:hover,
#otb-frontend-app.otb-dark-mode .otb-apply-btn:hover {
    background: #ae6fff !important;
}

/* ── Replace BG color-picker panel ────────────────────────────── */
.otb-replace-bg-panel {
    padding: 4px 2px 2px;
    min-width: 210px;
}
.otb-replace-bg-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.otb-replace-bg-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.otb-replace-bg-swatch:hover {
    transform: scale(1.12);
}
.otb-replace-bg-swatch.selected {
    border-color: var(--otb-accent, #8b3dff);
    transform: scale(1.1);
}
.otb-replace-bg-custom-color {
    width: 36px !important;
    height: 28px !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    padding: 2px !important;
    background: transparent !important;
}

/* Inline font-size stepper */
.otb-strip-size-stepper {
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    height: 28px !important;
}
.otb-strip-size-btn {
    width: 22px !important;
    height: 28px !important;
    border: none !important;
    background: #f8f8f8 !important;
    color: #444 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    transition: background 0.1s !important;
}
.otb-strip-size-btn:hover { background: #e8e8e8 !important; }
.otb-strip-size-input {
    width: 38px !important;
    height: 28px !important;
    border: none !important;
    border-left: 1px solid #ddd !important;
    border-right: 1px solid #ddd !important;
    text-align: center !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #333 !important;
    background: #fff !important;
    padding: 0 !important;
    border-radius: 0 !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}
.otb-strip-size-input::-webkit-outer-spin-button,
.otb-strip-size-input::-webkit-inner-spin-button { -webkit-appearance: none !important; margin: 0 !important; }

/* Reduce strip to icon-only on smaller viewports */
@media (max-width: 1200px) {
    /* Hide labels — only change is removing text */
    .otb-strip-btn .otb-strip-btn-label { display: none !important; }

    /* Icon-only button: use a square with enough room to tap comfortably.
       Width/height both 36px gives a 36×36px hit area.
       Remove the fixed 30px that was squishing icon + chevron together. */
    .otb-strip-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        justify-content: center !important;
        gap: 3px !important;
    }

    /* Grow inline SVG icons inside the strip so they stay readable at 36px button.
       The SVG elements have width/height attributes of 13px set in JS — CSS wins here. */
    .otb-strip-btn svg {
        width: 16px !important;
        height: 16px !important;
        flex-shrink: 0 !important;
    }

    /* Shrink the chevron (▾) slightly relative to icon to keep balance */
    .otb-strip-btn svg:last-child {
        width: 10px !important;
        height: 10px !important;
    }

    /* Action buttons (Ungroup / Group / etc.) keep their text label but get taller */
    .otb-strip-btn.otb-strip-action-btn {
        width: auto !important;
        height: 36px !important;
        padding: 0 10px !important;
    }
    .otb-strip-btn.otb-strip-action-btn .otb-strip-btn-label { display: inline !important; }

    /* Raise strip height to match the taller buttons */
    .otb-context-strip-outer,
    .otb-context-strip {
        height: 50px !important;
    }
    .otb-context-strip {
        padding: 0 8px !important;
        gap: 3px !important;
    }

    /* Size stepper matches new height */
    .otb-strip-size-stepper {
        height: 32px !important;
    }
    .otb-strip-size-btn {
        width: 26px !important;
        height: 32px !important;
    }
    .otb-strip-size-input {
        height: 32px !important;
    }
}

/* Hide strip entirely on mobile — mobile uses existing bottom sheet */
@media (max-width: 768px) {
    .otb-context-strip-outer { display: none !important; }
}

/* ============================================================
   FLOAT PANEL — Draggable anchored panel
   ============================================================ */

.otb-float-panel {
    position: fixed !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.14) !important;
    z-index: 9999000 !important;
    min-width: 240px !important;
    max-width: 360px !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    font-size: 13px !important;
    color: #333 !important;
}

/* Panels whose content always fits — no scrollbar needed */
.otb-float-panel.otb-panel-fit {
    max-height: none !important;
}
.otb-float-panel.otb-panel-fit .otb-float-panel-body {
    overflow-y: visible !important;
}

.otb-float-panel-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 12px !important;
    background: #f8f8f8 !important;
    border-bottom: 1px solid #efefef !important;
    border-radius: 10px 10px 0 0 !important;
    user-select: none !important;
    flex-shrink: 0 !important;
}
.otb-float-panel-title {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #888 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}
.otb-float-panel-close {
    width: 20px !important;
    height: 20px !important;
    border: none !important;
    background: transparent !important;
    color: #aaa !important;
    cursor: pointer !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: color 0.1s, background 0.1s !important;
}
.otb-float-panel-close:hover { background: #eee !important; color: #555 !important; }

.otb-float-panel-body {
    overflow-y: auto !important;
    padding: 12px !important;
    flex: 1 !important;
    scrollbar-width: thin !important;
}

/* ── Panel internal components ── */

/* Rows */
.otb-panel-rows { display: flex !important; flex-direction: column !important; gap: 10px !important; }

.otb-panel-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 28px !important;
}
.otb-panel-row-label {
    font-size: 11px !important;
    color: #666 !important;
    font-weight: 500 !important;
    flex-shrink: 0 !important;
    min-width: 72px !important;
}
.otb-panel-row-val {
    font-size: 11px !important;
    color: #888 !important;
    min-width: 32px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
}
.otb-panel-btn-row {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}
.otb-panel-sub {
    padding-left: 8px !important;
    border-left: 2px solid #f0f0f0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 4px !important;
}

/* Slider */
.otb-panel-slider {
    flex: 1 !important;
    height: 4px !important;
    border-radius: 4px !important;
    accent-color: var(--otb-accent) !important;
    cursor: pointer !important;
    min-width: 0 !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* Color swatch */
.otb-panel-color-swatch {
    width: 32px !important;
    height: 24px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    padding: 0 !important;
    cursor: pointer !important;
    background: transparent !important;
    flex-shrink: 0 !important;
}

/* Select */
.otb-panel-select {
    flex: 1 !important;
    font-size: 12px !important;
    border-radius: 5px !important;
    border: 1px solid #ddd !important;
    padding: 4px 6px !important;
    background: #fff !important;
    color: #333 !important;
    min-height: 28px !important;
    max-height: 28px !important;
}

/* Search input */
.otb-panel-search {
    width: 100% !important;
    font-size: 12px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    margin-bottom: 6px !important;
    background: #fff !important;
    color: #333 !important;
    min-height: 30px !important;
}
.otb-panel-search:focus { outline: 2px solid rgba(139,61,255,0.3) !important; border-color: var(--otb-accent) !important; }

/* Font panel */
.otb-panel-cat-row {
    display: flex !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 6px !important;
    margin-bottom: 4px !important;
    scrollbar-width: none !important;
}
.otb-panel-cat-row::-webkit-scrollbar { display: none !important; }
.otb-panel-cat-btn {
    padding: 3px 9px !important;
    border-radius: 10px !important;
    border: 1px solid #e0e0e0 !important;
    background: #fff !important;
    font-size: 11px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    color: #555 !important;
    transition: all 0.1s !important;
    flex-shrink: 0 !important;
}
.otb-panel-cat-btn.active { background: #ede8ff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }
.otb-panel-add-row { display: flex !important; gap: 6px !important; margin-bottom: 6px !important; }
.otb-panel-add-btn { padding: 0 10px !important; background: #f0f0f0 !important; border-radius: 5px !important; font-size: 12px !important; border: 1px solid #ddd !important; cursor: pointer !important; white-space: nowrap !important; height: 30px !important; color: #333 !important; }
.otb-panel-add-btn:hover { background: #e0e0e0 !important; }
.otb-panel-font-list { max-height: 240px !important; overflow-y: auto !important; border: 1px solid #eee !important; border-radius: 6px !important; }
.otb-panel-font-item { padding: 8px 10px !important; font-size: 14px !important; cursor: pointer !important; border-bottom: 1px solid #f5f5f5 !important; color: #333 !important; transition: background 0.1s !important; }
.otb-panel-font-item:hover { background: #f5f0ff !important; }
.otb-panel-font-item.selected { background: #ede8ff !important; color: var(--otb-accent) !important; font-weight: 600 !important; }
.otb-panel-font-more { padding: 8px 10px !important; font-size: 11px !important; color: #aaa !important; text-align: center !important; }

/* Icon grid (align, etc.) */
.otb-panel-icon-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
}
.otb-panel-icon-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    border: 1px solid #e8e8e8 !important;
    background: #fafafa !important;
    cursor: pointer !important;
    font-size: 12px !important;
    color: #444 !important;
    transition: all 0.12s !important;
}
.otb-panel-icon-btn:hover { background: #f0ecff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }
.otb-panel-icon-btn.active { background: #ede8ff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }

/* Small icon buttons for arrange */
.otb-panel-icon-btn-sm {
    width: 32px !important;
    height: 32px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    background: #fafafa !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #444 !important;
    transition: all 0.12s !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}
.otb-panel-icon-btn-sm:hover { background: #f0ecff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }

/* Numeric inputs for position/size */
.otb-panel-num-label { display: flex !important; align-items: center !important; gap: 4px !important; font-size: 11px !important; color: #888 !important; }

.otb-aspect-lock-btn {
    width: 26px !important;
    height: 26px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: flex-end !important;
    margin-bottom: 1px !important;
    border-radius: 5px !important;
    border: 1px solid #ddd !important;
    background: #f5f5f5 !important;
    color: #999 !important;
    cursor: pointer !important;
    transition: background 0.15s, color 0.15s, border-color 0.15s !important;
}
.otb-aspect-lock-btn.otb-active {
    background: #ede8ff !important;
    border-color: #8b3dff !important;
    color: #8b3dff !important;
}
.otb-aspect-lock-btn i { width: 12px !important; height: 12px !important; }

.otb-panel-num-input {
    width: 52px !important;
    height: 28px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    text-align: center !important;
    font-size: 12px !important;
    color: #333 !important;
    background: #fff !important;
    padding: 0 4px !important;
}

/* Action list (More panel) */
.otb-panel-action-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    font-size: 13px !important;
    color: #333 !important;
    text-align: left !important;
    transition: background 0.1s !important;
}
.otb-panel-action-btn:hover { background: #f5f5f5 !important; }
.otb-panel-action-btn.danger { color: #d63031 !important; }
.otb-panel-action-btn.danger:hover { background: #fff5f5 !important; }

/* Toggle switch */
.otb-panel-toggle-label {
    display: inline-flex !important;
    align-items: center !important;
    cursor: pointer !important;
    gap: 0 !important;
    position: relative !important;
}
.otb-panel-toggle-label input[type="checkbox"] { display: none !important; }
.otb-panel-toggle-track {
    width: 34px !important;
    height: 18px !important;
    background: #ddd !important;
    border-radius: 20px !important;
    position: relative !important;
    transition: background 0.2s !important;
    display: block !important;
}
.otb-panel-toggle-track::after {
    content: '' !important;
    position: absolute !important;
    width: 14px !important;
    height: 14px !important;
    background: #fff !important;
    border-radius: 50% !important;
    top: 2px !important;
    left: 2px !important;
    transition: left 0.2s !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}
.otb-panel-toggle-label input:checked + .otb-panel-toggle-track { background: var(--otb-accent) !important; }
.otb-panel-toggle-label input:checked + .otb-panel-toggle-track::after { left: 18px !important; }

/* Fill panel */
.otb-panel-fill-wrap { display: flex !important; flex-direction: column !important; gap: 10px !important; }

/* ─── Curve Panel ─── */
.otb-curve-panel { min-width: 220px !important; }
.otb-curve-header { justify-content: center !important; }
.otb-curve-tabs { gap: 4px !important; flex-wrap: wrap !important; }
.otb-curve-flip-row { justify-content: space-between !important; }

.otb-btn-sm {
    font-size: 11px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
    color: #333 !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
}
.otb-btn-sm:hover { background: #e8e8e8 !important; }
.otb-btn-sm.active { background: var(--otb-accent) !important; color: #fff !important; border-color: var(--otb-accent) !important; }

.otb-tab-btn {
    font-size: 11px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
    color: #555 !important;
    flex: 1 !important;
    text-align: center !important;
}
.otb-tab-btn:hover { background: #e8e8e8 !important; }
.otb-tab-btn.active { background: var(--otb-accent) !important; color: #fff !important; border-color: var(--otb-accent) !important; font-weight: 600 !important; }

/* ── Search result card for otb_template posts ─────────────────────────────── */
.otb-search-card {
    margin: 12px 0 0;
}
.otb-search-card__thumb-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    line-height: 0;
    text-decoration: none !important;
}
.otb-search-card__thumb {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    transition: opacity 0.2s ease;
}
.otb-search-card__thumb-link:hover .otb-search-card__thumb {
    opacity: 0.85;
}
.otb-search-card__new-tab-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 12px;
    line-height: 1.3;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 0 0 6px 6px;
}
.otb-search-card__thumb-link:hover .otb-search-card__new-tab-hint {
    opacity: 1;
}
.otb-search-card__customize-btn {
    width: 100% !important;
    justify-content: center !important;
    margin-top: 8px !important;
}

/* ============================================================
   MODERN UI REFRESH — Visual polish layer (appended block).
   All changes are cosmetic only: color, shadow, border,
   border-radius, transition. Zero layout/position/size/z-index.
   Appended at end so cascade wins without touching base rules.
   ============================================================ */

/* ── Supplementary design tokens ────────────────────────────── */
:root {
    --otb-border:        #e5e7eb;
    --otb-border-strong: #d1d5db;
    --otb-surface:       #f9fafb;
    --otb-surface-2:     #f3f4f6;
    --otb-txt-1:         #111827;
    --otb-txt-2:         #4b5563;
    --otb-txt-3:         #9ca3af;
    --otb-accent-dim:    rgba(139,61,255,0.08);
    --otb-accent-mid:    rgba(139,61,255,0.16);
    --otb-shadow-xs:     0 1px 2px rgba(0,0,0,0.05);
    --otb-shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --otb-shadow-md:     0 4px 14px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.05);
    --otb-shadow-lg:     0 10px 36px rgba(0,0,0,0.13), 0 4px 10px rgba(0,0,0,0.06);
    --otb-shadow-xl:     0 24px 64px rgba(0,0,0,0.16), 0 8px 18px rgba(0,0,0,0.08);
    --otb-ease:          cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Nav rail ───────────────────────────────────────────────── */
#otb-app .otb-sidebar-nav,
#otb-frontend-app .otb-sidebar-nav {
    border-right: 1px solid rgba(255,255,255,0.05) !important;
}

#otb-app .otb-nav-item,
#otb-frontend-app .otb-nav-item {
    position: relative !important;
    transition: background 0.14s var(--otb-ease), color 0.14s !important;
    border-radius: 0 !important;
}

#otb-app .otb-nav-item:hover,
#otb-frontend-app .otb-nav-item:hover {
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
}

/* Left-bar active indicator */
#otb-app .otb-nav-item.otb-active::before,
#otb-frontend-app .otb-nav-item.otb-active::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 3px !important;
    height: 22px !important;
    background: var(--otb-accent) !important;
    border-radius: 0 3px 3px 0 !important;
    pointer-events: none !important;
}

/* ── Toolbar ────────────────────────────────────────────────── */
#otb-app .otb-toolbar,
#otb-frontend-app .otb-toolbar {
    box-shadow: 0 1px 0 var(--otb-border), 0 2px 8px rgba(0,0,0,0.03) !important;
    border-bottom-color: var(--otb-border) !important;
}

#otb-app .otb-toolbar-btn,
#otb-frontend-app .otb-toolbar-btn {
    border-radius: 6px !important;
    transition: background 0.13s var(--otb-ease), color 0.13s, box-shadow 0.13s !important;
    color: #444 !important;
}

#otb-app .otb-toolbar-btn:hover:not(:disabled),
#otb-frontend-app .otb-toolbar-btn:hover:not(:disabled) {
    background: var(--otb-surface-2) !important;
    color: var(--otb-txt-1) !important;
}

#otb-app .otb-toolbar-btn.otb-active,
#otb-frontend-app .otb-toolbar-btn.otb-active {
    background: var(--otb-accent-dim) !important;
    color: var(--otb-accent) !important;
}

/* Primary save/publish button — gradient + lift */
#otb-app .otb-toolbar-btn.otb-primary,
#otb-frontend-app .otb-toolbar-btn.otb-primary {
    background: linear-gradient(135deg, var(--otb-accent) 0%, #6c2bd9 100%) !important;
    box-shadow: 0 2px 8px rgba(139,61,255,0.28) !important;
    border-radius: 7px !important;
    color: #fff !important;
}

#otb-app .otb-toolbar-btn.otb-primary:hover,
#otb-frontend-app .otb-toolbar-btn.otb-primary:hover {
    filter: brightness(1.07) !important;
    box-shadow: 0 4px 16px rgba(139,61,255,0.38) !important;
    transform: translateY(-1px) !important;
}

#otb-app .otb-toolbar-btn.otb-primary:active,
#otb-frontend-app .otb-toolbar-btn.otb-primary:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 5px rgba(139,61,255,0.22) !important;
    filter: none !important;
}

/* Export trigger */
#otb-app .otb-export-trigger,
#otb-frontend-app .otb-export-trigger {
    border-color: var(--otb-border) !important;
    border-radius: 7px !important;
    transition: background 0.13s, border-color 0.13s, box-shadow 0.13s !important;
}

#otb-app .otb-export-trigger:hover,
#otb-frontend-app .otb-export-trigger:hover {
    background: var(--otb-surface) !important;
    border-color: var(--otb-border-strong) !important;
    box-shadow: var(--otb-shadow-xs) !important;
}

/* ── Canvas ─────────────────────────────────────────────────── */
#otb-app .canvas-container,
#otb-frontend-app .canvas-container {
    box-shadow: 0 2px 20px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04) !important;
}

/* ── Properties bar ─────────────────────────────────────────── */
#otb-app .otb-properties-bar,
#otb-frontend-app .otb-properties-bar {
    border-left-color: var(--otb-border) !important;
    box-shadow: -2px 0 20px rgba(0,0,0,0.05) !important;
}

#otb-app .otb-properties-bar-header,
#otb-frontend-app .otb-properties-bar-header {
    background: var(--otb-surface) !important;
    border-bottom-color: var(--otb-border) !important;
}

#otb-app .otb-properties-bar-header h3 {
    color: var(--otb-txt-1) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 0.2px !important;
}

#otb-app .otb-prop-section,
#otb-frontend-app .otb-prop-section {
    border-bottom-color: #f0f2f4 !important;
}

#otb-app .otb-prop-section-title,
#otb-app .otb-sidebar-section-label,
#otb-frontend-app .otb-prop-section-title,
#otb-frontend-app .otb-sidebar-section-label {
    color: var(--otb-txt-3) !important;
    letter-spacing: 0.8px !important;
}

/* ── Icon buttons ───────────────────────────────────────────── */
#otb-app .otb-icon-btn,
#otb-frontend-app .otb-icon-btn {
    border-radius: 7px !important;
    transition: background 0.12s var(--otb-ease), color 0.12s !important;
}

#otb-app .otb-icon-btn:hover,
#otb-frontend-app .otb-icon-btn:hover {
    background: var(--otb-surface-2) !important;
    color: var(--otb-txt-1) !important;
}

#otb-app .otb-icon-btn.otb-active,
#otb-frontend-app .otb-icon-btn.otb-active {
    background: var(--otb-accent-dim) !important;
    color: var(--otb-accent) !important;
}

/* ── Form controls — focus rings ────────────────────────────── */
#otb-app input:not([type="color"]):not([type="range"]):focus,
#otb-frontend-app input:not([type="color"]):not([type="range"]):focus,
#otb-app select:focus,
#otb-frontend-app select:focus,
#otb-app textarea:focus,
#otb-frontend-app textarea:focus {
    border-color: var(--otb-accent) !important;
    outline: none !important;
    box-shadow: 0 0 0 2.5px rgba(139,61,255,0.14) !important;
}

/* Pill button */
#otb-app .otb-pill-btn,
#otb-frontend-app .otb-pill-btn {
    border-color: var(--otb-border) !important;
    border-radius: 7px !important;
    transition: border-color 0.13s, background 0.13s, box-shadow 0.13s !important;
}

#otb-app .otb-pill-btn:hover,
#otb-frontend-app .otb-pill-btn:hover {
    border-color: var(--otb-border-strong) !important;
    background: var(--otb-surface) !important;
    box-shadow: var(--otb-shadow-xs) !important;
}

/* Size stepper */
#otb-app .otb-size-stepper,
#otb-frontend-app .otb-size-stepper {
    border-color: var(--otb-border) !important;
    border-radius: 7px !important;
}

#otb-app .otb-size-stepper button:hover,
#otb-frontend-app .otb-size-stepper button:hover {
    background: var(--otb-surface-2) !important;
}

/* Inline select */
#otb-app .otb-inline-select,
#otb-frontend-app .otb-inline-select {
    border-color: var(--otb-border) !important;
    border-radius: 7px !important;
}

/* ── Drawer search ──────────────────────────────────────────── */
#otb-app .otb-drawer-search,
#otb-frontend-app .otb-drawer-search {
    border-radius: 7px !important;
    background: rgba(255,255,255,0.07) !important;
    border-color: rgba(255,255,255,0.10) !important;
    transition: background 0.14s, border-color 0.14s, box-shadow 0.14s !important;
}

#otb-app .otb-drawer-search:focus,
#otb-frontend-app .otb-drawer-search:focus {
    background: rgba(255,255,255,0.11) !important;
    border-color: var(--otb-accent) !important;
    box-shadow: 0 0 0 2px rgba(139,61,255,0.20) !important;
}

/* ── Asset items ────────────────────────────────────────────── */
#otb-app .otb-asset-item,
#otb-frontend-app .otb-asset-item {
    border-radius: 6px !important;
    transition: transform 0.13s var(--otb-ease), background 0.13s, box-shadow 0.13s !important;
}

#otb-app .otb-asset-item:hover,
#otb-frontend-app .otb-asset-item:hover {
    background: rgba(255,255,255,0.15) !important;
    transform: scale(1.04) !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.28) !important;
}

/* ── Context strip ──────────────────────────────────────────── */
#otb-app .otb-context-strip-outer,
#otb-frontend-app .otb-context-strip-outer {
    border-bottom-color: var(--otb-border) !important;
    box-shadow: 0 1px 0 var(--otb-border) !important;
}

#otb-app .otb-strip-btn,
#otb-frontend-app .otb-strip-btn {
    border-radius: 6px !important;
    transition: background 0.12s var(--otb-ease), color 0.12s !important;
}

#otb-app .otb-strip-btn:hover,
#otb-frontend-app .otb-strip-btn:hover {
    background: var(--otb-surface-2) !important;
    color: var(--otb-txt-1) !important;
}

#otb-app .otb-strip-btn.otb-active,
#otb-frontend-app .otb-strip-btn.otb-active {
    background: var(--otb-accent-dim) !important;
    color: var(--otb-accent) !important;
}

#otb-app .otb-strip-btn.otb-panel-open,
#otb-frontend-app .otb-strip-btn.otb-panel-open {
    background: var(--otb-accent-dim) !important;
    color: var(--otb-accent) !important;
    outline: 1px solid var(--otb-accent-mid) !important;
}

/* ── Popovers ───────────────────────────────────────────────── */
.otb-toolbar-popover {
    border-color: var(--otb-border) !important;
    box-shadow: var(--otb-shadow-lg) !important;
    border-radius: 12px !important;
}

.otb-popover-header {
    background: var(--otb-surface) !important;
    border-bottom-color: var(--otb-border) !important;
}

.otb-popover-close:hover {
    background: var(--otb-surface-2) !important;
    color: var(--otb-txt-1) !important;
}

/* Shadow / tint popover chrome */
.otb-shadow-pop-header,
.otb-tint-header {
    background: var(--otb-surface) !important;
    border-bottom-color: var(--otb-border) !important;
}

.otb-shadow-slider-row,
.otb-tint-row {
    border-bottom-color: #f3f4f6 !important;
}

/* Export menu */
.otb-export-menu {
    border-color: var(--otb-border) !important;
    box-shadow: var(--otb-shadow-lg) !important;
    border-radius: 12px !important;
}

.otb-export-menu .otb-export-opt:hover {
    background: var(--otb-surface-2) !important;
}

.otb-export-opt-icon {
    background: var(--otb-surface-2) !important;
    border-radius: 7px !important;
}

/* ── Float panels ───────────────────────────────────────────── */
.otb-float-panel {
    border-color: var(--otb-border) !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px var(--otb-border) !important;
    border-radius: 12px !important;
}

.otb-float-panel-header {
    background: var(--otb-surface) !important;
    border-bottom-color: var(--otb-border) !important;
    border-radius: 12px 12px 0 0 !important;
}

.otb-float-panel-close:hover {
    background: var(--otb-surface-2) !important;
    color: var(--otb-txt-2) !important;
}

/* ── Modals ─────────────────────────────────────────────────── */
.otb-modal-box {
    border-radius: 16px !important;
    box-shadow: 0 24px 72px rgba(0,0,0,0.18), 0 8px 18px rgba(0,0,0,0.08) !important;
}

.otb-modal-btn {
    border-radius: 8px !important;
    transition: all 0.13s var(--otb-ease) !important;
}

.otb-modal-btn:hover {
    background: var(--otb-surface-2) !important;
    border-color: var(--otb-border-strong) !important;
}

.otb-modal-btn.otb-primary {
    background: linear-gradient(135deg, var(--otb-accent) 0%, #6c2bd9 100%) !important;
    box-shadow: 0 2px 8px rgba(139,61,255,0.28) !important;
}

.otb-modal-btn.otb-primary:hover {
    filter: brightness(1.07) !important;
    box-shadow: 0 4px 16px rgba(139,61,255,0.38) !important;
    transform: translateY(-1px) !important;
}

/* ── Bottom bar + page tabs ─────────────────────────────────── */
#otb-app .otb-bottom-bar,
#otb-frontend-app .otb-bottom-bar {
    border-top-color: var(--otb-border) !important;
}

#otb-app .otb-page-tab,
#otb-frontend-app .otb-page-tab {
    border-radius: 6px !important;
    transition: all 0.12s var(--otb-ease) !important;
}

#otb-app .otb-page-tab:hover,
#otb-frontend-app .otb-page-tab:hover {
    background: var(--otb-surface-2) !important;
    color: var(--otb-txt-1) !important;
}

#otb-app .otb-page-tab.otb-active,
#otb-frontend-app .otb-page-tab.otb-active {
    box-shadow: 0 2px 6px rgba(139,61,255,0.24) !important;
}

#otb-app .otb-page-add,
#otb-frontend-app .otb-page-add {
    border-color: var(--otb-border) !important;
    border-radius: 7px !important;
    transition: border-color 0.13s, color 0.13s, background 0.13s !important;
}

/* ── Panel components ───────────────────────────────────────── */
.otb-panel-icon-btn {
    border-radius: 7px !important;
    transition: background 0.12s, border-color 0.12s, color 0.12s !important;
}

.otb-panel-icon-btn-sm {
    border-radius: 7px !important;
    transition: background 0.12s, border-color 0.12s !important;
}

.otb-panel-action-btn {
    border-radius: 7px !important;
    transition: background 0.12s !important;
}

.otb-btn-sm,
.otb-tab-btn {
    border-radius: 6px !important;
    transition: background 0.12s, color 0.12s, border-color 0.12s !important;
}

.otb-group-btn,
.otb-ungroup-btn {
    border-radius: 7px !important;
    transition: background 0.13s, color 0.13s !important;
}

/* ── Window controls (close button — now in toolbar area, not floating pill) ── */
.otb-window-controls {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.otb-win-btn {
    border-radius: 6px !important;
    transition: background 0.13s, color 0.13s, border-color 0.13s !important;
}

/* ── Loading overlay ────────────────────────────────────────── */
.otb-app-loading {
    background: rgba(255,255,255,0.90) !important;
    backdrop-filter: blur(14px) saturate(1.5) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.5) !important;
}

/* ── Unified thin scrollbars inside the editor ──────────────── */
#otb-app ::-webkit-scrollbar,
#otb-frontend-app ::-webkit-scrollbar {
    width: 5px !important;
    height: 5px !important;
}

#otb-app ::-webkit-scrollbar-track,
#otb-frontend-app ::-webkit-scrollbar-track {
    background: transparent !important;
}

#otb-app ::-webkit-scrollbar-thumb,
#otb-frontend-app ::-webkit-scrollbar-thumb {
    border-radius: 10px !important;
}

/* Light surfaces */
#otb-app .otb-properties-bar ::-webkit-scrollbar-thumb,
#otb-app .otb-workspace-area ::-webkit-scrollbar-thumb,
#otb-frontend-app .otb-properties-bar ::-webkit-scrollbar-thumb,
#otb-frontend-app .otb-workspace-area ::-webkit-scrollbar-thumb {
    background: #d1d5db !important;
}

/* Dark surfaces */
#otb-app .otb-sidebar-drawer ::-webkit-scrollbar-thumb,
#otb-frontend-app .otb-sidebar-drawer ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.20) !important;
}

/* ── Crop toolbar ───────────────────────────────────────────── */
.otb-crop-toolbar {
    border-color: var(--otb-border) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.14) !important;
    border-radius: 10px !important;
}

.otb-crop-btn {
    border-radius: 6px !important;
    transition: background 0.12s, border-color 0.12s !important;
}

/* ── Skeleton loader — dark shimmer matching template list background ── */
.otb-skeleton-loading {
    background: #252540 !important;
    background-image: linear-gradient(90deg, #252540 25%, #32325a 50%, #252540 75%) !important;
}

/* END MODERN UI REFRESH */

/* ============================================================
   DARK MODE
   Activated by: #otb-app.otb-dark-mode  (in-app elements)
                 body.otb-dm             (modals / panels appended to <body>)
   Toggled via the moon/sun button in the toolbar.
   Preference persisted in localStorage key "otb_theme".
   ============================================================ */

/* ── Dark palette tokens ────────────────────────────────────── */
#otb-app.otb-dark-mode,
#otb-frontend-app.otb-dark-mode {
    --otb-toolbar-bg:    #1e2229;
    --otb-canvas-bg:     #13161a;
    --otb-text:          #e8eaf0;
    --otb-border:        #363c4a;
    --otb-border-strong: #475060;
    --otb-surface:       #23272f;
    --otb-surface-2:     #2c3140;
    --otb-txt-1:         #f0f2f6;
    --otb-txt-2:         #b2bcd0;
    --otb-txt-3:         #6b7890;
    --otb-accent-dim:    rgba(139,61,255,0.18);
    --otb-accent-mid:    rgba(139,61,255,0.28);
    --otb-shadow-xs:     0 1px 2px rgba(0,0,0,0.30);
    --otb-shadow-sm:     0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.22);
    --otb-shadow-md:     0 4px 14px rgba(0,0,0,0.42), 0 2px 4px rgba(0,0,0,0.24);
    --otb-shadow-lg:     0 10px 36px rgba(0,0,0,0.50), 0 4px 10px rgba(0,0,0,0.28);
    --otb-shadow-xl:     0 24px 64px rgba(0,0,0,0.58), 0 8px 18px rgba(0,0,0,0.34);
}

/* ── App container ──────────────────────────────────────────── */
#otb-app.otb-dark-mode .otb-app-container,
#otb-frontend-app.otb-dark-mode .otb-app-container {
    background: var(--otb-canvas-bg) !important;
    color: var(--otb-txt-1) !important;
}

/* ── Workspace / canvas area ────────────────────────────────── */
#otb-app.otb-dark-mode .otb-workspace-area,
#otb-frontend-app.otb-dark-mode .otb-workspace-area {
    background: #13161a !important;
}

/* ── Toolbar ────────────────────────────────────────────────── */
#otb-app.otb-dark-mode .otb-toolbar,
#otb-frontend-app.otb-dark-mode .otb-toolbar {
    background: #1e2229 !important;
    border-bottom-color: #363c4a !important;
    box-shadow: 0 1px 0 #363c4a, 0 2px 8px rgba(0,0,0,0.18) !important;
}

/* Separator spans inside toolbar groups */
#otb-app.otb-dark-mode .otb-toolbar-group > span,
#otb-frontend-app.otb-dark-mode .otb-toolbar-group > span {
    background: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-toolbar-btn,
#otb-frontend-app.otb-dark-mode .otb-toolbar-btn {
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-toolbar-btn:hover:not(:disabled),
#otb-frontend-app.otb-dark-mode .otb-toolbar-btn:hover:not(:disabled) {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-toolbar-btn.otb-active,
#otb-frontend-app.otb-dark-mode .otb-toolbar-btn.otb-active,
#otb-app.otb-dark-mode .otb-toolbar-btn.active,
#otb-frontend-app.otb-dark-mode .otb-toolbar-btn.active {
    background: var(--otb-accent-dim) !important;
    color: var(--otb-accent) !important;
}

/* Export trigger button */
#otb-app.otb-dark-mode .otb-export-trigger,
#otb-frontend-app.otb-dark-mode .otb-export-trigger {
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-export-trigger:hover,
#otb-frontend-app.otb-dark-mode .otb-export-trigger:hover {
    background: #23272f !important;
    border-color: #475060 !important;
    color: #f0f2f6 !important;
}

/* Paper size select in toolbar */
#otb-app.otb-dark-mode #otb-paper-size-select,
#otb-frontend-app.otb-dark-mode #otb-paper-size-select {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

/* ── Context strip ──────────────────────────────────────────── */
#otb-app.otb-dark-mode .otb-context-strip-outer,
#otb-frontend-app.otb-dark-mode .otb-context-strip-outer {
    background: #1a1d23 !important;
    border-bottom-color: #363c4a !important;
}
#otb-app.otb-dark-mode .otb-strip-scroll-btn,
#otb-frontend-app.otb-dark-mode .otb-strip-scroll-btn {
    background: #2c3140 !important;
    border-color: #3d4557 !important;
    color: #b2bcd0 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4) !important;
}

#otb-app.otb-dark-mode .otb-strip-btn,
#otb-frontend-app.otb-dark-mode .otb-strip-btn {
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-strip-btn:hover,
#otb-frontend-app.otb-dark-mode .otb-strip-btn:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-strip-btn.otb-active,
#otb-frontend-app.otb-dark-mode .otb-strip-btn.otb-active,
#otb-app.otb-dark-mode .otb-strip-btn.otb-panel-open,
#otb-frontend-app.otb-dark-mode .otb-strip-btn.otb-panel-open {
    background: var(--otb-accent-dim) !important;
    color: var(--otb-accent) !important;
    outline-color: var(--otb-accent-mid) !important;
}

#otb-app.otb-dark-mode .otb-strip-divider,
#otb-frontend-app.otb-dark-mode .otb-strip-divider {
    background: #363c4a !important;
}

/* ── Properties bar ─────────────────────────────────────────── */
#otb-app.otb-dark-mode .otb-properties-bar,
#otb-frontend-app.otb-dark-mode .otb-properties-bar {
    background: #1a1d23 !important;
    border-left-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-properties-bar-header,
#otb-frontend-app.otb-dark-mode .otb-properties-bar-header {
    background: #23272f !important;
    border-bottom-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-properties-bar-header h3,
#otb-frontend-app.otb-dark-mode .otb-properties-bar-header h3 {
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-prop-section,
#otb-frontend-app.otb-dark-mode .otb-prop-section {
    border-bottom-color: #23272f !important;
}

#otb-app.otb-dark-mode .otb-sidebar-section,
#otb-frontend-app.otb-dark-mode .otb-sidebar-section {
    border-bottom-color: #23272f !important;
}

/* ── Form controls ──────────────────────────────────────────── */
#otb-app.otb-dark-mode input:not([type="color"]):not([type="range"]),
#otb-frontend-app.otb-dark-mode input:not([type="color"]):not([type="range"]),
#otb-app.otb-dark-mode select,
#otb-frontend-app.otb-dark-mode select,
#otb-app.otb-dark-mode textarea,
#otb-frontend-app.otb-dark-mode textarea {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

#otb-app.otb-dark-mode input:not([type="color"]):not([type="range"]):focus,
#otb-frontend-app.otb-dark-mode input:not([type="color"]):not([type="range"]):focus,
#otb-app.otb-dark-mode select:focus,
#otb-frontend-app.otb-dark-mode select:focus,
#otb-app.otb-dark-mode textarea:focus,
#otb-frontend-app.otb-dark-mode textarea:focus {
    border-color: var(--otb-accent) !important;
    background: #2c3140 !important;
}

/* ── Icon buttons (properties bar) ─────────────────────────── */
#otb-app.otb-dark-mode .otb-icon-btn,
#otb-frontend-app.otb-dark-mode .otb-icon-btn {
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-icon-btn:hover,
#otb-frontend-app.otb-dark-mode .otb-icon-btn:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-icon-grid .otb-icon-btn,
#otb-frontend-app.otb-dark-mode .otb-icon-grid .otb-icon-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-icon-grid .otb-icon-btn:hover,
#otb-frontend-app.otb-dark-mode .otb-icon-grid .otb-icon-btn:hover {
    background: #2c3140 !important;
    border-color: #475060 !important;
    color: #f0f2f6 !important;
}

/* ── Panel / pill buttons ───────────────────────────────────── */
#otb-app.otb-dark-mode .otb-pill-btn,
#otb-frontend-app.otb-dark-mode .otb-pill-btn,
#otb-app.otb-dark-mode .otb-panel-icon-btn,
#otb-frontend-app.otb-dark-mode .otb-panel-icon-btn,
#otb-app.otb-dark-mode .otb-panel-icon-btn-sm,
#otb-frontend-app.otb-dark-mode .otb-panel-icon-btn-sm,
#otb-app.otb-dark-mode .otb-panel-action-btn,
#otb-frontend-app.otb-dark-mode .otb-panel-action-btn,
#otb-app.otb-dark-mode .otb-btn-sm,
#otb-frontend-app.otb-dark-mode .otb-btn-sm,
#otb-app.otb-dark-mode .otb-tab-btn,
#otb-frontend-app.otb-dark-mode .otb-tab-btn {
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-size-stepper,
#otb-frontend-app.otb-dark-mode .otb-size-stepper {
    border-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-size-stepper button:hover,
#otb-frontend-app.otb-dark-mode .otb-size-stepper button:hover,
#otb-app.otb-dark-mode .otb-pill-btn:hover,
#otb-frontend-app.otb-dark-mode .otb-pill-btn:hover {
    background: #2c3140 !important;
    border-color: #475060 !important;
    color: #f0f2f6 !important;
}

/* ── Bottom bar + page tabs ─────────────────────────────────── */
#otb-app.otb-dark-mode .otb-bottom-bar,
#otb-frontend-app.otb-dark-mode .otb-bottom-bar {
    background: #1e2229 !important;
    border-top-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-page-tab,
#otb-frontend-app.otb-dark-mode .otb-page-tab {
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-page-tab:hover,
#otb-frontend-app.otb-dark-mode .otb-page-tab:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-page-add,
#otb-frontend-app.otb-dark-mode .otb-page-add {
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

/* Zoom controls in bottom bar */
#otb-app.otb-dark-mode .otb-zoom-control,
#otb-frontend-app.otb-dark-mode .otb-zoom-control {
    color: #b2bcd0 !important;
}

/* ── Inline toolbar popover (inside #otb-app) ───────────────── */
#otb-app.otb-dark-mode .otb-toolbar-popover,
#otb-frontend-app.otb-dark-mode .otb-toolbar-popover {
    background: #1e2229 !important;
    border-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-popover-header,
#otb-frontend-app.otb-dark-mode .otb-popover-header {
    background: #23272f !important;
    border-bottom-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-popover-title,
#otb-frontend-app.otb-dark-mode .otb-popover-title {
    color: #6b7890 !important;
}

#otb-app.otb-dark-mode .otb-popover-close,
#otb-frontend-app.otb-dark-mode .otb-popover-close {
    color: #6b7890 !important;
}

#otb-app.otb-dark-mode .otb-popover-close:hover,
#otb-frontend-app.otb-dark-mode .otb-popover-close:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

/* Popover labels and inputs */
#otb-app.otb-dark-mode .otb-toolbar-popover label,
#otb-frontend-app.otb-dark-mode .otb-toolbar-popover label {
    color: #b2bcd0 !important;
}

/* ── Export menu: JS-stamped dark class (most reliable) ─────── */
/* .otb-dm-menu is added by JS at open-time when dark mode is on,
   so this works regardless of position:fixed cascade edge-cases. */
.otb-dm-menu.otb-export-menu {
    background: #1e2229 !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}
.otb-dm-menu .otb-export-menu-header {
    color: #6b7890 !important;
}
.otb-dm-menu .otb-export-opt {
    color: #e8eaf0 !important;
}
.otb-dm-menu .otb-export-opt:hover {
    background: #2c3140 !important;
}
.otb-dm-menu .otb-export-opt + .otb-export-opt {
    border-top-color: #2c3140 !important;
}
.otb-dm-menu .otb-export-opt-icon {
    background: #23272f !important;
    color: #b2bcd0 !important;
}
.otb-dm-menu .otb-export-opt-name {
    color: #f0f2f6 !important;
}
.otb-dm-menu .otb-export-opt-desc {
    color: #6b7890 !important;
}

/* ── Export menu (inside toolbar, not body-appended) ────────── */
#otb-app.otb-dark-mode .otb-export-menu,
#otb-frontend-app.otb-dark-mode .otb-export-menu,
body.otb-dm #otb-export-popover {
    background: #1e2229 !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

#otb-app.otb-dark-mode .otb-export-menu-header,
#otb-frontend-app.otb-dark-mode .otb-export-menu-header,
body.otb-dm #otb-export-popover .otb-export-menu-header {
    color: #6b7890 !important;
}

#otb-app.otb-dark-mode .otb-export-menu .otb-export-opt,
#otb-frontend-app.otb-dark-mode .otb-export-menu .otb-export-opt,
body.otb-dm #otb-export-popover .otb-export-opt {
    color: #e8eaf0 !important;
    border-top-color: #2c3140 !important;
}

#otb-app.otb-dark-mode .otb-export-menu .otb-export-opt:hover,
#otb-frontend-app.otb-dark-mode .otb-export-menu .otb-export-opt:hover,
body.otb-dm #otb-export-popover .otb-export-opt:hover {
    background: #2c3140 !important;
}

#otb-app.otb-dark-mode .otb-export-menu .otb-export-opt + .otb-export-opt,
#otb-frontend-app.otb-dark-mode .otb-export-menu .otb-export-opt + .otb-export-opt,
body.otb-dm #otb-export-popover .otb-export-opt + .otb-export-opt {
    border-top-color: #2c3140 !important;
}

#otb-app.otb-dark-mode .otb-export-opt-icon,
#otb-frontend-app.otb-dark-mode .otb-export-opt-icon,
body.otb-dm #otb-export-popover .otb-export-opt-icon {
    background: #23272f !important;
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-export-opt-name,
#otb-frontend-app.otb-dark-mode .otb-export-opt-name,
body.otb-dm #otb-export-popover .otb-export-opt-name {
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-export-opt-desc,
#otb-frontend-app.otb-dark-mode .otb-export-opt-desc,
body.otb-dm #otb-export-popover .otb-export-opt-desc {
    color: #6b7890 !important;
}

/* ── Drawer search ──────────────────────────────────────────── */
#otb-app.otb-dark-mode .otb-drawer-search,
#otb-frontend-app.otb-dark-mode .otb-drawer-search {
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.08) !important;
}

/* ── Body-appended elements: float panels, modals, popovers ─── */

/* Float panels */
body.otb-dm .otb-float-panel {
    background: #1e2229 !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.50), 0 2px 8px rgba(0,0,0,0.30), 0 0 0 1px #363c4a !important;
}

body.otb-dm .otb-float-panel-header {
    background: #23272f !important;
    border-bottom-color: #363c4a !important;
}

body.otb-dm .otb-float-panel-title {
    color: #6b7890 !important;
}

body.otb-dm .otb-float-panel-close {
    color: #6b7890 !important;
}

body.otb-dm .otb-float-panel-close:hover {
    background: #2c3140 !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-float-panel input:not([type="color"]):not([type="range"]),
body.otb-dm .otb-float-panel select,
body.otb-dm .otb-float-panel textarea {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-float-panel label {
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-icon-btn,
body.otb-dm .otb-float-panel .otb-panel-icon-btn-sm,
body.otb-dm .otb-float-panel .otb-panel-action-btn,
body.otb-dm .otb-float-panel .otb-icon-btn {
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-icon-btn:hover,
body.otb-dm .otb-float-panel .otb-panel-icon-btn-sm:hover,
body.otb-dm .otb-float-panel .otb-icon-btn:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

/* Body-appended toolbar popovers (gradient editor, etc.) */
body.otb-dm .otb-toolbar-popover {
    background: #1e2229 !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-toolbar-popover label {
    color: #b2bcd0 !important;
}

body.otb-dm .otb-toolbar-popover input:not([type="color"]):not([type="range"]),
body.otb-dm .otb-toolbar-popover select {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-popover-header {
    background: #23272f !important;
    border-bottom-color: #363c4a !important;
}

body.otb-dm .otb-popover-title {
    color: #6b7890 !important;
}

body.otb-dm .otb-popover-close {
    color: #6b7890 !important;
}

body.otb-dm .otb-popover-close:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

/* Shadow / tint popovers */
body.otb-dm .otb-shadow-pop-header,
body.otb-dm .otb-tint-header {
    background: #23272f !important;
    border-bottom-color: #363c4a !important;
}

body.otb-dm .otb-shadow-slider-row,
body.otb-dm .otb-tint-row {
    border-bottom-color: #2c3140 !important;
}

/* Export menu (body-appended / fixed-positioned variant) */
body.otb-dm .otb-export-menu {
    background: #1e2229 !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-export-menu-header {
    color: #6b7890 !important;
}

body.otb-dm .otb-export-menu .otb-export-opt {
    color: #e8eaf0 !important;
}

body.otb-dm .otb-export-menu .otb-export-opt:hover {
    background: #2c3140 !important;
}

body.otb-dm .otb-export-menu .otb-export-opt + .otb-export-opt {
    border-top-color: #2c3140 !important;
}

body.otb-dm .otb-export-opt-icon {
    background: #23272f !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-export-opt-name {
    color: #f0f2f6 !important;
}

body.otb-dm .otb-export-opt-desc {
    color: #6b7890 !important;
}

/* Font dropdown */
body.otb-dm .otb-font-dropdown {
    background: #1e2229 !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-font-dropdown input {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-font-item:hover {
    background: #2c3140 !important;
}

/* Modals */
body.otb-dm .otb-modal-overlay {
    background: rgba(0,0,0,0.65) !important;
}

body.otb-dm .otb-modal-box {
    background: #1e2229 !important;
    color: #e8eaf0 !important;
    box-shadow: 0 24px 72px rgba(0,0,0,0.55), 0 8px 18px rgba(0,0,0,0.30) !important;
}

body.otb-dm .otb-modal-title {
    color: #f0f2f6 !important;
}

body.otb-dm .otb-modal-msg {
    color: #b2bcd0 !important;
}

body.otb-dm .otb-modal-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-modal-btn:hover {
    background: #2c3140 !important;
    border-color: #475060 !important;
    color: #f0f2f6 !important;
}

/* Crop toolbar */
body.otb-dm .otb-crop-toolbar {
    background: #1e2229 !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-crop-btn {
    color: #b2bcd0 !important;
}

body.otb-dm .otb-crop-btn:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

/* Loading overlay — keep frosted but darken the bg */
body.otb-dm .otb-app-loading {
    background: rgba(13,15,19,0.92) !important;
    color: #f0f2f6 !important;
}

body.otb-dm .otb-app-loading .otb-loading-text {
    color: #e8eaf0 !important;
}

body.otb-dm .otb-loading-bar-track {
    background: rgba(139, 61, 255, 0.2) !important;
}

body.otb-dm .otb-loading-pct {
    color: #a97fff !important;
}

/* ── Dark-mode scrollbars (light surfaces now dark) ─────────── */
#otb-app.otb-dark-mode .otb-properties-bar ::-webkit-scrollbar-thumb,
#otb-app.otb-dark-mode .otb-workspace-area ::-webkit-scrollbar-thumb,
#otb-frontend-app.otb-dark-mode .otb-properties-bar ::-webkit-scrollbar-thumb,
#otb-frontend-app.otb-dark-mode .otb-workspace-area ::-webkit-scrollbar-thumb {
    background: #363c4a !important;
}

/* ── Rulers ─────────────────────────────────────────────────── */
#otb-app.otb-dark-mode .otb-ruler,
#otb-frontend-app.otb-dark-mode .otb-ruler,
#otb-app.otb-dark-mode .otb-ruler-corner,
#otb-frontend-app.otb-dark-mode .otb-ruler-corner {
    background: #1e2229 !important;
    border-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-ruler-h,
#otb-frontend-app.otb-dark-mode .otb-ruler-h {
    border-bottom-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-ruler-v,
#otb-frontend-app.otb-dark-mode .otb-ruler-v {
    border-right-color: #363c4a !important;
}

#otb-app.otb-dark-mode #otb-ruler-unit-select,
#otb-frontend-app.otb-dark-mode #otb-ruler-unit-select {
    color: #b2bcd0 !important;
}

/* ── Properties-bar size stepper (+/−) ─────────────────────── */
#otb-app.otb-dark-mode .otb-size-stepper,
#otb-frontend-app.otb-dark-mode .otb-size-stepper {
    background: #23272f !important;
    border-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-size-stepper button,
#otb-frontend-app.otb-dark-mode .otb-size-stepper button {
    background: #23272f !important;
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-size-stepper button:hover,
#otb-frontend-app.otb-dark-mode .otb-size-stepper button:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-size-stepper input,
#otb-frontend-app.otb-dark-mode .otb-size-stepper input {
    background: #23272f !important;
    color: #e8eaf0 !important;
    border-left-color: #363c4a !important;
    border-right-color: #363c4a !important;
}

/* ── Context-strip font-size stepper (+/−) ──────────────────── */
#otb-app.otb-dark-mode .otb-strip-size-stepper,
#otb-frontend-app.otb-dark-mode .otb-strip-size-stepper {
    border-color: #363c4a !important;
}

#otb-app.otb-dark-mode .otb-strip-size-btn,
#otb-frontend-app.otb-dark-mode .otb-strip-size-btn {
    background: #23272f !important;
    color: #b2bcd0 !important;
}

#otb-app.otb-dark-mode .otb-strip-size-btn:hover,
#otb-frontend-app.otb-dark-mode .otb-strip-size-btn:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

#otb-app.otb-dark-mode .otb-strip-size-input,
#otb-frontend-app.otb-dark-mode .otb-strip-size-input {
    background: #1e2229 !important;
    color: #e8eaf0 !important;
    border-left-color: #363c4a !important;
    border-right-color: #363c4a !important;
}

/* ── Float panel: row labels, values, sub-sections ─────────── */
body.otb-dm .otb-float-panel .otb-panel-row-label,
body.otb-dm .otb-float-panel .otb-panel-num-label {
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-aspect-lock-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #6b7890 !important;
}

body.otb-dm .otb-float-panel .otb-aspect-lock-btn.otb-active {
    background: #2d1f4a !important;
    border-color: #8b3dff !important;
    color: #a97fff !important;
}

body.otb-dm .otb-float-panel .otb-panel-row-val {
    color: #6b7890 !important;
}

body.otb-dm .otb-float-panel .otb-panel-sub {
    border-left-color: #363c4a !important;
}

/* ── Float panel: icon grid buttons (fix missing background) ── */
body.otb-dm .otb-float-panel .otb-panel-icon-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-icon-btn:hover {
    background: #2c3140 !important;
    border-color: var(--otb-accent) !important;
    color: var(--otb-accent) !important;
}

body.otb-dm .otb-float-panel .otb-panel-icon-btn.active {
    background: var(--otb-accent-dim) !important;
    border-color: var(--otb-accent) !important;
    color: var(--otb-accent) !important;
}

body.otb-dm .otb-float-panel .otb-panel-icon-btn-sm {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-icon-btn-sm:hover {
    background: #2c3140 !important;
    border-color: var(--otb-accent) !important;
    color: var(--otb-accent) !important;
}

/* ── Float panel: action buttons ────────────────────────────── */
body.otb-dm .otb-float-panel .otb-panel-action-btn {
    color: #e8eaf0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-action-btn:hover {
    background: #2c3140 !important;
}

body.otb-dm .otb-float-panel .otb-panel-action-btn.danger {
    color: #ff6b6b !important;
}

body.otb-dm .otb-float-panel .otb-panel-action-btn.danger:hover {
    background: rgba(255,107,107,0.12) !important;
}

/* ── Float panel: btn-sm (Apply Curve / general small btns) ─── */
body.otb-dm .otb-float-panel .otb-btn-sm {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-btn-sm:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

body.otb-dm .otb-float-panel .otb-btn-sm.active {
    background: var(--otb-accent-dim) !important;
    border-color: var(--otb-accent) !important;
    color: var(--otb-accent) !important;
}

/* ── Float panel: tab buttons (Color / Gradient / Pattern) ─── */
body.otb-dm .otb-float-panel .otb-tab-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-tab-btn:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

body.otb-dm .otb-float-panel .otb-tab-btn.active {
    background: var(--otb-accent) !important;
    border-color: var(--otb-accent) !important;
    color: #fff !important;
}

/* ── Float panel: toggle track (on/off switch) ──────────────── */
body.otb-dm .otb-float-panel .otb-panel-toggle-track {
    background: #475060 !important;
}

/* ── Float panel: select, search, num-input ─────────────────── */
body.otb-dm .otb-float-panel .otb-panel-select,
body.otb-dm .otb-float-panel .otb-panel-search,
body.otb-dm .otb-float-panel .otb-panel-num-input {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #e8eaf0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-search:focus {
    border-color: var(--otb-accent) !important;
    background: #2c3140 !important;
}

/* ── Float panel: color swatch borders ──────────────────────── */
body.otb-dm .otb-float-panel .otb-panel-color-swatch {
    border-color: #475060 !important;
}

/* ── Float panel: category pill buttons ─────────────────────── */
body.otb-dm .otb-float-panel .otb-panel-cat-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-cat-btn.active {
    background: var(--otb-accent-dim) !important;
    border-color: var(--otb-accent) !important;
    color: var(--otb-accent) !important;
}

/* ── Float panel: add-row buttons ───────────────────────────── */
body.otb-dm .otb-float-panel .otb-panel-add-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-panel-add-btn:hover {
    background: #2c3140 !important;
}

/* ── Float panel: font list + items (text style dropdown) ───── */
body.otb-dm .otb-float-panel .otb-panel-font-list {
    border-color: #363c4a !important;
    background: #1e2229 !important;
}

body.otb-dm .otb-float-panel .otb-panel-font-item {
    color: #e8eaf0 !important;
    border-bottom-color: #23272f !important;
}

body.otb-dm .otb-float-panel .otb-panel-font-item:hover {
    background: #2c3140 !important;
}

body.otb-dm .otb-float-panel .otb-panel-font-item.selected {
    background: var(--otb-accent-dim) !important;
    color: var(--otb-accent) !important;
}

body.otb-dm .otb-float-panel .otb-panel-font-more {
    color: #6b7890 !important;
}

/* ── Float panel: inline padding input wrappers ─────────────── */
/* These are created with inline style background:#f5f5f5 —
   override the inline background via the parent container */
body.otb-dm .otb-float-panel [style*="background:#f5f5f5"],
body.otb-dm .otb-float-panel [style*="background: #f5f5f5"] {
    background: #23272f !important;
    border-color: #363c4a !important;
}

/* Clear/small inline buttons with border:#ddd */
body.otb-dm .otb-float-panel [style*="border:1px solid #ddd"],
body.otb-dm .otb-float-panel [style*="border: 1px solid #ddd"] {
    border-color: #363c4a !important;
}

body.otb-dm .otb-float-panel [style*="background:#fff"],
body.otb-dm .otb-float-panel [style*="background: #fff"] {
    background: #23272f !important;
    color: #e8eaf0 !important;
}

/* Inline text overrides for color values like #888, #555, #666 in labels */
body.otb-dm .otb-float-panel [style*="color:#888"],
body.otb-dm .otb-float-panel [style*="color: #888"],
body.otb-dm .otb-float-panel [style*="color:#555"],
body.otb-dm .otb-float-panel [style*="color: #555"],
body.otb-dm .otb-float-panel [style*="color:#666"],
body.otb-dm .otb-float-panel [style*="color: #666"],
body.otb-dm .otb-float-panel [style*="color:#777"],
body.otb-dm .otb-float-panel [style*="color: #777"],
body.otb-dm .otb-float-panel [style*="color:#333"],
body.otb-dm .otb-float-panel [style*="color: #333"] {
    color: #b2bcd0 !important;
}

/* ── Group/ungroup buttons in arrange panel ─────────────────── */
body.otb-dm .otb-float-panel .otb-group-btn,
body.otb-dm .otb-float-panel .otb-ungroup-btn {
    background: #23272f !important;
    border-color: #363c4a !important;
    color: #b2bcd0 !important;
}

body.otb-dm .otb-float-panel .otb-group-btn:hover,
body.otb-dm .otb-float-panel .otb-ungroup-btn:hover {
    background: #2c3140 !important;
    color: #f0f2f6 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SINGLE TEMPLATE PAGE  (single-otb_template.php)
   ═══════════════════════════════════════════════════════════════════════════ */

.otb-single-wrap {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 24px 80px;
    font-family: inherit;
    color: inherit;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.otb-breadcrumb {
    margin-bottom: 20px;
    font-size: 0.82rem;
}
.otb-breadcrumb__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.otb-breadcrumb__list li {
    display: flex;
    align-items: center;
    color: #999;
}
.otb-breadcrumb__list li:not(:last-child)::after {
    content: '/';
    margin-left: 4px;
    color: #ccc;
}
.otb-breadcrumb__list a {
    color: #666;
    text-decoration: none;
}
.otb-breadcrumb__list a:hover { color: #4f46e5; }
.otb-breadcrumb__list .current { color: #333; font-weight: 500; }

/* ── Hero two-column ─────────────────────────────────────────────────────── */
.otb-single-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,.07);
    margin-bottom: 40px;
}

/* ── Left: preview ───────────────────────────────────────────────────────── */
.otb-single-preview {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.otb-single-figure {
    margin: 0;
    background: #f8f9fb;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #eee;
}
.otb-single-thumb {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Format badges row */
.otb-format-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.otb-format-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.otb-badge-pdf  { background: #fff0f0; color: #d63939; border: 1px solid #fecaca; }
.otb-badge-png  { background: #f0f7ff; color: #1d6fa4; border: 1px solid #bfdbfe; }
.otb-badge-jpg  { background: #fff7ed; color: #c2660a; border: 1px solid #fed7aa; }
.otb-badge-free { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ── Right: info panel ───────────────────────────────────────────────────── */
.otb-single-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.otb-single-title {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
    color: #111827;
}
.otb-single-desc {
    font-size: 0.97rem;
    line-height: 1.7;
    color: #4b5563;
    margin: 0;
}

/* Metadata table */
.otb-meta-table {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.otb-meta-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.88rem;
}
.otb-meta-row:last-child { border-bottom: none; }
.otb-meta-row:nth-child(even) { background: #fafafa; }
.otb-meta-row dt {
    font-weight: 600;
    color: #6b7280;
    min-width: 110px;
    flex-shrink: 0;
}
.otb-meta-row dd {
    margin: 0;
    color: #111827;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Category badges */
.otb-cat-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: #ede9fe;
    color: #4f46e5;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.otb-cat-badge:hover { background: #ddd6fe; }

/* CTA button */
.otb-single-cta {
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    font-size: 1rem;
}
.otb-single-cta-note {
    font-size: 0.78rem;
    color: #9ca3af;
    margin: -12px 0 0;
}

/* ── Post content section ────────────────────────────────────────────────── */
.otb-single-content {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 36px 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
    margin-bottom: 40px;
    font-size: 0.97rem;
    line-height: 1.75;
    color: #374151;
}
.otb-single-content h2, .otb-single-content h3 {
    color: #111827;
    margin-top: 1.5em;
}
.otb-single-content p { margin: 0 0 1em; }
.otb-single-content ul, .otb-single-content ol {
    padding-left: 1.5em;
    margin: 0 0 1em;
}

/* ── Section titles (FAQ, Related) ───────────────────────────────────────── */
.otb-single-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 20px;
    padding-bottom: 10px;
}

/* ── FAQ ─────────────────────────────────────────────────────────────────── */
.otb-single-faq {
    margin-bottom: 48px;
}
.otb-faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}
.otb-faq-item {
    padding: 18px 24px;
    border-bottom: 1px solid #f0f0f0;
}
.otb-faq-item:last-child { border-bottom: none; }
.otb-faq-item:nth-child(even) { background: #fafafa; }
.otb-faq-q {
    font-weight: 700;
    font-size: 0.97rem;
    color: #111827;
    margin-bottom: 6px;
}
.otb-faq-a {
    margin: 0;
    font-size: 0.92rem;
    color: #4b5563;
    line-height: 1.6;
}

/* ── Related templates ───────────────────────────────────────────────────── */
.otb-single-related { margin-bottom: 48px; }

.otb-single-related .otb-template-title-below,
.otb-single-related .otb-template-title-below a {
    font-size: 0.85rem;
    color: #374151;
    text-decoration: none;
}
.otb-single-related .otb-template-title-below a:hover { color: #4f46e5; }

/* ── Other categories (Explore More) ────────────────────────────────────── */
.otb-single-other-cats { margin-bottom: 48px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .otb-single-hero {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px;
    }
}
@media (max-width: 560px) {
    .otb-single-wrap { padding: 0 16px 60px; margin-top: 16px; }
    .otb-single-title { font-size: 1.35rem; }
    .otb-single-hero { padding: 16px; }
    .otb-single-content { padding: 24px 20px; }
    .otb-single-related-grid { --otb-columns: 2 !important; }
    .otb-meta-row dt { min-width: 90px; }
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
body.otb-dm .otb-single-hero,
body.otb-dm .otb-single-content,
body.otb-dm .otb-meta-table,
body.otb-dm .otb-faq-list {
    background: #1e2230;
    border-color: #2c3140;
}
body.otb-dm .otb-single-title,
body.otb-dm .otb-single-section-title,
body.otb-dm .otb-faq-q,
body.otb-dm .otb-meta-row dd { color: #f0f2f6; }
body.otb-dm .otb-single-desc,
body.otb-dm .otb-faq-a,
body.otb-dm .otb-single-content { color: #b2bcd0; }
body.otb-dm .otb-meta-row { border-bottom-color: #2c3140; }
body.otb-dm .otb-meta-row:nth-child(even),
body.otb-dm .otb-faq-item:nth-child(even) { background: #23272f; }
body.otb-dm .otb-meta-row dt { color: #8892a8; }
body.otb-dm .otb-single-figure { background: #14172b; border-color: #2c3140; }
body.otb-dm .otb-cat-badge { background: #2a2d4a; color: #a8b4ff; }
body.otb-dm .otb-cat-badge:hover { background: #363a5c; }
body.otb-dm .otb-breadcrumb__list a { color: #8892a8; }
body.otb-dm .otb-breadcrumb__list a:hover { color: #a8b4ff; }
body.otb-dm .otb-breadcrumb__list .current { color: #c4cad8; }
body.otb-dm .otb-single-section-title { border-bottom-color: #2c3140; }
body.otb-dm .otb-faq-item { border-bottom-color: #2c3140; }
.otb-template-footer h3{
    border-left: none !important;
    padding-left: none !important;
}
/* ============================================================
   RESIZE POPOVER
   ============================================================ */

#otb-resize-popover {
    position: fixed;
    z-index: 999999;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
    width: 290px;
    overflow: hidden;
    animation: otb-pop-in 0.12s ease;
}
@keyframes otb-pop-in {
    from { opacity:0; transform:translateY(-6px) scale(0.97); }
    to   { opacity:1; transform:translateY(0)    scale(1);    }
}
.otb-rp-inner { padding: 16px; }
.otb-rp-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #222 !important;
    margin-bottom: 14px !important;
    line-height: 1.3 !important;
}
.otb-rp-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #999 !important;
    margin-bottom: 8px !important;
}
.otb-rp-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.otb-rp-field {
    position: relative;
    flex: 1;
}
.otb-rp-field-lbl {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 800;
    color: #bbb;
    pointer-events: none;
    line-height: 1;
}
.otb-rp-num {
    width: 100%;
    padding: 8px 6px 8px 20px !important;
    border: 1px solid #ddd !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    background: #fafafa !important;
    color: #333 !important;
    transition: border-color 0.15s;
}
.otb-rp-num:focus {
    outline: none !important;
    border-color: var(--otb-accent) !important;
    background: #fff !important;
}
.otb-rp-unit {
    padding: 8px 5px !important;
    border: 1px solid #ddd !important;
    border-radius: 7px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    background: #fafafa !important;
    color: #333 !important;
    cursor: pointer;
    min-width: 48px;
    transition: border-color 0.15s;
}
.otb-rp-unit:focus { outline: none; border-color: var(--otb-accent); }
.otb-rp-apply {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    padding: 6px 7px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.otb-rp-apply:hover { color: var(--otb-accent); background: rgba(139,61,255,0.08); }
.otb-rp-sep {
    height: 1px;
    background: #f0f0f0;
    margin: 14px -16px;
}
.otb-rp-presets-list {
    max-height: 230px;
    overflow-y: auto;
    margin: 0 -16px;
    padding: 0 8px;
}
.otb-rp-preset {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}
.otb-rp-preset:hover   { background: #f5f0ff; }
.otb-rp-preset.is-active { background: #ede5ff; }
.otb-rp-preset-icon {
    flex-shrink: 0;
    color: #bbb;
    display: flex;
    align-items: center;
}
.otb-rp-preset.is-active .otb-rp-preset-icon { color: var(--otb-accent); }
.otb-rp-preset-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}
.otb-rp-preset.is-active .otb-rp-preset-name { color: var(--otb-accent); font-weight: 600; }
.otb-rp-preset-dims {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

/* Resize trigger button */
#otb-resize-btn {
    display: flex !important;
    align-items: center;
    gap: 5px;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    border-radius: 7px !important;
    border: 1px solid #e0e0e0 !important;
    letter-spacing: 0.2px;
}
#otb-resize-btn:hover { border-color: #ccc !important; background: #f8f8f8 !important; }
#otb-resize-btn.is-open { border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; background: rgba(139,61,255,0.05) !important; }

/* Dark mode */
body.otb-dm #otb-resize-popover {
    background: #1e2229;
    border-color: #363c4a;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    color: #e8eaf0;
}
body.otb-dm .otb-rp-title  { color: #e8eaf0; }
body.otb-dm .otb-rp-label  { color: #6b7890; }
body.otb-dm .otb-rp-num, body.otb-dm .otb-rp-unit {
    background: #23272f; border-color: #363c4a; color: #e8eaf0;
}
body.otb-dm .otb-rp-field-lbl { color: #4e5872; }
body.otb-dm .otb-rp-sep   { background: #2c3140; }
body.otb-dm .otb-rp-preset-name  { color: #d0d8e8; }
body.otb-dm .otb-rp-preset-dims  { color: #4e5872; }
body.otb-dm .otb-rp-preset:hover { background: #252a35; }
body.otb-dm .otb-rp-preset.is-active { background: #2d1f4a; }
body.otb-dm .otb-rp-apply { color: #4e5872; }
body.otb-dm #otb-resize-btn {
    border-color: #363c4a !important;
    color: #d0d8e8 !important;
}
body.otb-dm #otb-resize-btn:hover { background: #23272f !important; }
body.otb-dm #otb-resize-btn.is-open {
    border-color: var(--otb-accent) !important;
    color: var(--otb-accent) !important;
    background: rgba(139,61,255,0.1) !important;
}

/* ── Search History Panel ──────────────────────────────────────────── */
.otb-search-history-panel {
    display: none;
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    right: 0 !important;
    background: #1e2330 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 8px !important;
    padding: 8px !important;
    z-index: 999999 !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.45) !important;
    font-family: inherit !important;
}

.otb-sh-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 7px !important;
    padding-bottom: 6px !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}

.otb-sh-title {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: rgba(255,255,255,0.45) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
}

.otb-sh-clear-all {
    background: none !important;
    border: none !important;
    color: rgba(255,255,255,0.35) !important;
    font-size: 11px !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
    text-decoration: underline !important;
}
.otb-sh-clear-all:hover { color: rgba(255,255,255,0.7) !important; }

.otb-sh-chips {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
}

.otb-sh-chip {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 20px !important;
    padding: 3px 8px 3px 10px !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
}
.otb-sh-chip:hover { background: rgba(255,255,255,0.15) !important; }

.otb-sh-ct {
    font-size: 12px !important;
    color: rgba(255,255,255,0.75) !important;
    max-width: 160px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    line-height: 1.4 !important;
}

.otb-sh-rm {
    font-size: 12px !important;
    color: rgba(255,255,255,0.35) !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    transition: color 0.15s !important;
}
.otb-sh-rm:hover { color: rgba(255,255,255,0.8) !important; }

/* Light theme overrides (admin editor which may not have dark class) */
body:not(.otb-dm) .otb-search-history-panel {
    background: #ffffff !important;
    border-color: rgba(0,0,0,0.12) !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15) !important;
}
body:not(.otb-dm) .otb-sh-title   { color: rgba(0,0,0,0.45) !important; }
body:not(.otb-dm) .otb-sh-clear-all { color: rgba(0,0,0,0.35) !important; }
body:not(.otb-dm) .otb-sh-clear-all:hover { color: rgba(0,0,0,0.7) !important; }
body:not(.otb-dm) .otb-sh-header  { border-bottom-color: rgba(0,0,0,0.08) !important; }
body:not(.otb-dm) .otb-sh-chip    { background: rgba(0,0,0,0.05) !important; border-color: rgba(0,0,0,0.1) !important; }
body:not(.otb-dm) .otb-sh-chip:hover { background: rgba(0,0,0,0.1) !important; }
body:not(.otb-dm) .otb-sh-ct      { color: rgba(0,0,0,0.75) !important; }
body:not(.otb-dm) .otb-sh-rm      { color: rgba(0,0,0,0.35) !important; }
body:not(.otb-dm) .otb-sh-rm:hover { color: rgba(0,0,0,0.8) !important; }
