.editor-pro {
    --ep-primary: #6366f1;
    --ep-primary-dark: #4f46e5;
    --ep-accent: #10b981;
    --ep-bg: #f1f5f9;
    --ep-panel: #ffffff;
    --ep-border: #e2e8f0;
    --ep-text: #0f172a;
    --ep-muted: #64748b;
    --ep-sidebar-w: 420px;

    display: flex;
    flex-direction: column;
    width: 100%;
    height: calc(100vh - 120px);
    min-height: 640px;
    margin: 16px 0 24px;
    border: 1px solid var(--ep-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--ep-bg);
    color: var(--ep-text);
    font-family: system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
}

.editor-pro *, .editor-pro *::before, .editor-pro *::after { box-sizing: border-box; }

.editor-pro-top {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: var(--ep-panel);
    border-bottom: 1px solid var(--ep-border);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    z-index: 20;
}

.editor-pro-top h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.editor-pro-top p {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--ep-muted);
}

.editor-pro-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.editor-pro-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.editor-pro-btn:disabled { opacity: 0.65; cursor: wait; }

.editor-pro-btn-primary {
    background: var(--ep-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.editor-pro-btn-primary:hover:not(:disabled) { background: #059669; }

.editor-pro-btn-secondary {
    background: #fff;
    color: var(--ep-text);
    border: 1px solid var(--ep-border);
}

.editor-pro-btn-danger {
    background: #fff;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.editor-pro-btn-danger:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #f87171;
}

.editor-pro-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.editor-pro-sidebar {
    width: var(--ep-sidebar-w);
    min-width: var(--ep-sidebar-w);
    background: var(--ep-panel);
    border-right: 1px solid var(--ep-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.editor-pro-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 10px 0;
    border-bottom: 1px solid var(--ep-border);
    background: #f8fafc;
}

.editor-pro-tab {
    border: none;
    background: transparent;
    padding: 8px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ep-muted);
    border-radius: 6px 6px 0 0;
    cursor: pointer;
}

.editor-pro-tab.is-active {
    background: var(--ep-panel);
    color: var(--ep-primary);
    box-shadow: 0 -1px 0 var(--ep-panel);
}

.editor-pro-panels {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.editor-pro-panel { display: none; }
.editor-pro-panel.is-active { display: block; }

.editor-pro-section {
    background: #f8fafc;
    border: 1px solid var(--ep-border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.editor-pro-section h2 {
    margin: 0 0 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ep-text);
    border-bottom: 1px solid var(--ep-border);
    padding-bottom: 6px;
}

.editor-pro-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.editor-pro-field label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ep-muted);
}

.editor-pro-field input,
.editor-pro-field select,
.editor-pro-field textarea {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}

.editor-pro-field input:focus,
.editor-pro-field select:focus,
.editor-pro-field textarea:focus {
    outline: none;
    border-color: var(--ep-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.editor-pro-row {
    display: flex;
    gap: 8px;
}

.editor-pro-row > .editor-pro-field { flex: 1; }

.editor-pro-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ep-muted);
    cursor: pointer;
    margin-right: 12px;
}

.editor-pro-check input { width: auto; margin: 0; }

.editor-pro-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.editor-pro-quick-btn {
    border: 1px dashed #cbd5e1;
    background: #fff;
    border-radius: 8px;
    padding: 10px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ep-text);
    cursor: pointer;
    text-align: center;
}

.editor-pro-quick-btn:hover {
    border-color: var(--ep-primary);
    color: var(--ep-primary);
    background: #eef2ff;
}

.editor-pro-layers {
    list-style: none;
    margin: 0;
    padding: 0;
}

.editor-pro-layer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--ep-border);
    border-radius: 8px;
    margin-bottom: 6px;
    background: #fff;
    cursor: pointer;
}

.editor-pro-layer.is-selected {
    border-color: var(--ep-primary);
    background: #eef2ff;
}

.editor-pro-layer.is-hidden { opacity: 0.45; }

.editor-pro-layer-name {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-pro-layer-actions {
    display: flex;
    gap: 2px;
}

.editor-pro-layer-actions button {
    border: none;
    background: transparent;
    color: var(--ep-muted);
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

.editor-pro-layer-actions button:hover { background: #f1f5f9; color: var(--ep-text); }

.editor-pro-preview {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #e2e8f0;
}

.editor-pro-viewport-toolbar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--ep-panel);
    border-bottom: 1px solid var(--ep-border);
}

.editor-pro-viewport-toolbar span {
    font-size: 0.72rem;
    color: var(--ep-muted);
    margin-right: 4px;
}

.editor-pro-view-btn {
    border: 1px solid var(--ep-border);
    background: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ep-text);
    cursor: pointer;
}

.editor-pro-view-btn:hover { background: #f8fafc; border-color: #cbd5e1; }

.editor-pro-view-btn.is-active {
    background: #eef2ff;
    border-color: var(--ep-primary);
    color: var(--ep-primary);
}

.editor-pro-canvas-wrap {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
    cursor: grab;
    touch-action: none;
}

.editor-pro-canvas-wrap.is-panning { cursor: grabbing; }

.editor-pro-canvas-wrap.is-dragging { cursor: move; }

.editor-pro-canvas-pan {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
    padding: 48px;
}

.editor-pro-canvas-pan svg {
    display: block;
    border-radius: 4px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    background: transparent;
}

.ep-draggable { cursor: move; }

.ep-draggable--selected .ep-drag-hit {
    fill: rgba(99, 102, 241, 0.08);
    stroke: #6366f1;
    stroke-width: 0.2;
    stroke-dasharray: 1.5 1;
}

.ep-draggable--logo:hover .ep-drag-hit--logo,
.ep-draggable--logo.is-dragging .ep-drag-hit--logo {
    stroke: #6366f1;
    stroke-width: 0.25;
    stroke-dasharray: 1.5 1;
}

.editor-pro-zoom-label {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ep-muted);
    min-width: 3.5rem;
    text-align: right;
}

.editor-pro-modal[hidden] { display: none !important; }

.editor-pro-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.editor-pro-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.editor-pro-modal-panel {
    position: relative;
    width: min(520px, 100%);
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-pro-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ep-border);
}

.editor-pro-modal-head h2 {
    margin: 0;
    font-size: 1rem;
}

.editor-pro-modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ep-muted);
}

.editor-pro-modal-body {
    overflow-y: auto;
    padding: 12px 16px 16px;
}

.editor-pro-load-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--ep-border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
}

.editor-pro-load-item strong {
    display: block;
    font-size: 0.88rem;
}

.editor-pro-load-item span {
    font-size: 0.72rem;
    color: var(--ep-muted);
}

.editor-pro-element-editor {
    border-top: 2px solid var(--ep-primary);
    margin-top: 8px;
    padding-top: 12px;
}

.editor-pro-hint {
    font-size: 0.72rem;
    color: var(--ep-muted);
    margin: 0 0 8px;
}

.editor-pro-empty {
    text-align: center;
    padding: 20px;
    color: var(--ep-muted);
    font-size: 0.82rem;
}

@media (max-width: 960px) {
    .editor-pro {
        height: auto;
        min-height: 0;
        margin: 8px 0 16px;
    }
    .editor-pro-body {
        flex-direction: column;
    }
    .editor-pro-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 55vh;
        border-right: none;
        border-bottom: 1px solid var(--ep-border);
    }
    .editor-pro-preview {
        min-height: 360px;
    }
    .editor-pro-top {
        flex-direction: column;
        align-items: stretch;
    }
    .editor-pro-actions .editor-pro-btn { flex: 1; justify-content: center; min-width: 0; font-size: 0.8rem; padding: 8px 10px; }
    .editor-pro-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .editor-pro-tabs::-webkit-scrollbar { display: none; }
    .editor-pro-tab { flex-shrink: 0; white-space: nowrap; }
}

@media (max-width: 480px) {
    .editor-pro {
        margin: 8px 0 16px;
        border-radius: 8px;
    }
    .editor-pro-actions .editor-pro-btn {
        flex: 1 1 100%;
    }
    .editor-pro-preview {
        min-height: 280px;
    }
    .editor-pro-sidebar {
        max-height: 50vh;
    }
}
