/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Figtree', sans-serif; background: #fff; color: #0f1b2d; overflow: hidden; height: 100vh; }
textarea, input, button { font-family: 'Figtree', sans-serif; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6dce3; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b8c1cc; background-clip: content-box; }

/* === App Shell === */
#eb-app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* === Header === */
.eb-header {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid #eef1f4;
    background: #fff;
    z-index: 10;
}
.eb-header__left, .eb-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.eb-header__left { gap: 20px; }
.eb-back-link {
    text-decoration: none;
    color: #8a94a3;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: color .15s;
}
.eb-back-link:hover { color: #3f5e8c; }
.eb-header__divider { width: 1px; height: 22px; background: #eef1f4; }
.eb-header__logo { height: 22px; width: auto; display: block; }
.eb-header__title { font-size: 15px; font-weight: 600; color: #0f1b2d; }

/* === Badges === */
.eb-badge {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 5px 9px;
    border-radius: 999px;
}
.eb-badge--new { color: #3f5e8c; background: #eef2f8; }

/* === Buttons === */
.eb-btn {
    font-size: 12.5px;
    font-weight: 600;
    font-family: 'Figtree', sans-serif;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    border: none;
    transition: all .15s;
}
.eb-btn--outline {
    color: #0f1b2d;
    background: #fff;
    border: 1px solid #e6eaef;
}
.eb-btn--outline:hover { border-color: #3f5e8c; color: #3f5e8c; }
.eb-btn--dark {
    color: #fff;
    background: #0f1b2d;
}
.eb-btn--dark:hover { background: #1a2d47; }

/* === Workspace === */
.eb-workspace {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

/* === Resizer === */
.eb-resizer {
    flex: none;
    width: 7px;
    cursor: col-resize;
    display: flex;
    justify-content: center;
    background: #fff;
    z-index: 2;
}
.eb-resizer::after {
    content: '';
    width: 1px;
    height: 100%;
    background: #eef1f4;
    transition: background .15s;
}
.eb-resizer:hover::after { background: #3f5e8c; }

/* === Palette (left col) === */
.eb-palette {
    flex: none;
    width: 268px;
    overflow-y: auto;
    padding: 22px 18px;
    background: #fff;
}

/* Branding panel */
.eb-brand-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #eef1f4; }
.eb-brand-title { font-size: 13px; font-weight: 600; color: #0f1b2d; margin-bottom: 12px; }
.eb-logo-upload {
    display: block;
    margin-bottom: 14px;
    cursor: pointer;
}
.eb-logo-dropzone {
    border: 1.5px dashed #d6dce3;
    border-radius: 9px;
    padding: 16px 10px;
    text-align: center;
    color: #8a94a3;
    font-size: 12.5px;
    font-weight: 500;
    transition: border-color .15s;
}
.eb-logo-dropzone:hover { border-color: #3f5e8c; }
.eb-logo-preview {
    border: 1px solid #e6eaef;
    border-radius: 9px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fbfcfe;
}
.eb-logo-preview img { max-width: 100%; max-height: 44px; display: block; }

.eb-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid #e6eaef;
    border-radius: 9px;
    margin-bottom: 7px;
    cursor: pointer;
    background: #fff;
    transition: all .15s;
}
.eb-color-row:hover { border-color: #c4cbd4; }
.eb-color-row.active { border-color: #3f5e8c; background: #f7f9fc; }
.eb-color-swatch-input {
    width: 30px; height: 30px;
    border: 1px solid #e6eaef;
    border-radius: 7px;
    background: none;
    padding: 0;
    cursor: pointer;
}
.eb-color-label { font-size: 12.5px; font-weight: 600; color: #0f1b2d; margin-bottom: 2px; }
.eb-color-hex {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e6eaef;
    border-radius: 6px;
    padding: 3px 7px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #5a6675;
    outline: none;
    background: #fff;
}
.eb-color-active-tag {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: #3f5e8c;
}
.eb-swatch-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.eb-swatch-hint { font-size: 11px; color: #8a94a3; margin-bottom: 7px; }
.eb-swatch-btn {
    width: 26px; height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,.08);
    cursor: pointer;
    padding: 0;
}

/* Blocks palette */
.eb-pal-heading {
    font-size: 13px;
    font-weight: 600;
    color: #0f1b2d;
    margin-bottom: 4px;
}
.eb-pal-desc {
    font-size: 12.5px;
    color: #8a94a3;
    line-height: 1.5;
    margin-bottom: 18px;
}
.eb-pal-group-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8a94a3;
    margin-bottom: 10px;
}
.eb-pal-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e6eaef;
    border-radius: 10px;
    background: #fff;
    cursor: grab;
    margin-bottom: 7px;
    user-select: none;
    transition: all .15s;
}
.eb-pal-item:hover { border-color: #3f5e8c; background: #fbfcfe; }
.eb-pal-item:active { cursor: grabbing; }
.eb-pal-icon {
    width: 28px; height: 28px;
    flex: none;
    border-radius: 8px;
    background: #eef2f8;
    color: #3f5e8c;
    display: flex;
    align-items: center;
    justify-content: center;
}
.eb-pal-label {
    font-size: 13.5px;
    font-weight: 500;
    color: #0f1b2d;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.eb-pal-pencil, .eb-pal-delete {
    border: none;
    background: transparent;
    color: #aeb6c1;
    cursor: pointer;
    padding: 3px;
    display: flex;
    transition: color .12s;
}
.eb-pal-pencil:hover { color: #3f5e8c; }
.eb-pal-delete:hover { color: #d4504e; }

/* === Canvas (center col) === */
.eb-canvas {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    background: #ffffff;
    padding: 24px 16px;
}
.eb-canvas__inner { width: 600px; max-width: 100%; margin: 0 auto; }
.eb-canvas__inner--normal {
    width: 100%;
    max-width: none;
    margin: 0;
}
.eb-canvas--normal {
    padding: 0;
}

.eb-drop-zone {
    height: 12px;
    transition: height .12s;
    display: flex;
    align-items: center;
}
.eb-drop-zone.active {
    height: 24px;
}
.eb-drop-line {
    height: 3px;
    width: 100%;
    border-radius: 2px;
    background: #3f5e8c;
}

.eb-empty-canvas {
    border: 2px dashed #d6dce3;
    border-radius: 14px;
    padding: 60px 24px;
    text-align: center;
    color: #8a94a3;
    font-size: 14px;
}

/* Block cards */
.eb-block-card {
    position: relative;
    background: #fff;
    border: 1px solid #e6eaef;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15,27,45,.04);
    cursor: pointer;
    overflow: hidden;
    transition: all .15s;
}
.eb-block-card.selected {
    border-color: #3f5e8c;
    box-shadow: 0 8px 26px rgba(63,94,140,.13);
}
.eb-block-chrome {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-bottom: 1px solid #f2f4f7;
    background: #fcfdfe;
}
.eb-block-card.selected .eb-block-chrome { background: #f7f9fc; }
.eb-block-handle {
    cursor: grab;
    color: #c4cbd4;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    user-select: none;
}
.eb-block-handle:active { cursor: grabbing; }
.eb-block-type {
    font-family: 'Space Mono', monospace;
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8a94a3;
}
.eb-block-delete {
    border: none;
    background: transparent;
    color: #aeb6c1;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
    margin-left: auto;
    transition: color .12s;
}
.eb-block-delete:hover { color: #d4504e; }
.eb-block-summary {
    padding: 11px 14px;
    font-size: 13px;
    color: #5a6675;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.eb-block-editor {
    padding: 15px 15px 4px;
}
.eb-save-block-btn {
    width: 100%;
    margin-top: 4px;
    margin-bottom: 12px;
    padding: 9px 0;
    border: 1px solid #e6eaef;
    background: #fff;
    color: #3f5e8c;
    font-weight: 600;
    font-size: 12.5px;
    font-family: 'Figtree', sans-serif;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
}
.eb-save-block-btn:hover { border-color: #3f5e8c; background: #f7f9fc; }

/* === Form fields === */
.eb-field { display: block; margin-bottom: 12px; }
.eb-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #8a94a3;
    margin-bottom: 5px;
    letter-spacing: .02em;
}
.eb-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e6eaef;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 14px;
    color: #0f1b2d;
    outline: none;
    background: #fff;
    transition: border-color .15s;
}
.eb-input:focus { border-color: #3f5e8c; }
textarea.eb-input { resize: vertical; line-height: 1.5; }
.eb-code-input {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    tab-size: 2;
}
.eb-checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #3a4452;
    margin-bottom: 10px;
    cursor: pointer;
}
.eb-checkbox-field input { width: 15px; height: 15px; cursor: pointer; accent-color: #3f5e8c; }
.eb-code-hint {
    font-size: 11.5px;
    line-height: 1.45;
    color: #8a94a3;
    margin-bottom: 12px;
}

/* Alignment control */
.eb-align-group { display: flex; gap: 6px; margin-bottom: 14px; }
.eb-align-btn {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 7px 0;
    border: 1px solid #e6eaef;
    background: #fff;
    color: #9aa4b2;
    border-radius: 8px;
    cursor: pointer;
    transition: all .12s;
}
.eb-align-btn.active {
    border-color: #3f5e8c;
    background: #eef2f8;
    color: #3f5e8c;
}

/* Rich text editor */
.eb-rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 7px;
    align-items: center;
}
.eb-rte-btn {
    border: 1px solid #e6eaef;
    background: #fff;
    border-radius: 6px;
    min-width: 30px;
    height: 28px;
    cursor: pointer;
    font-size: 13px;
    color: #3a4452;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    transition: all .12s;
}
.eb-rte-btn:hover { border-color: #3f5e8c; color: #3f5e8c; }
.eb-rte-divider { width: 1px; height: 20px; background: #eef1f4; margin: 0 2px; }
.eb-rte-color {
    width: 22px; height: 22px;
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,.12);
    cursor: pointer;
    padding: 0;
    transition: transform .1s;
}
.eb-rte-color:hover { transform: scale(1.15); }
.eb-rte-color-custom {
    width: 22px; height: 22px;
    border-radius: 5px;
    border: 1px solid #e6eaef;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(red,#ff0,#0f0,#0ff,#00f,#f0f,red);
    position: relative;
    overflow: hidden;
}
.eb-rte-color-custom input {
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: none;
    position: absolute;
    inset: 0;
}
.eb-rte-editable {
    border: 1px solid #e6eaef;
    border-radius: 8px;
    padding: 9px 11px;
    min-height: 72px;
    font-size: 14px;
    line-height: 1.55;
    color: #0f1b2d;
    outline: none;
    background: #fff;
    overflow-wrap: anywhere;
    transition: border-color .15s;
}
.eb-rte-editable:focus { border-color: #3f5e8c; }

/* Merge field picker */
.eb-rte-merge-btn {
    width: auto;
    min-width: 0;
    padding: 0 10px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
}
.eb-rte-merge-btn.active { border-color: #3f5e8c; background: #eef2f8; color: #3f5e8c; }
.eb-merge-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
}
.eb-merge-menu {
    position: fixed;
    z-index: 201;
    width: 250px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e6eaef;
    border-radius: 10px;
    box-shadow: 0 14px 38px rgba(15,27,45,.18);
    padding: 6px;
}
.eb-merge-group {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8a94a3;
    padding: 9px 8px 5px;
}
.eb-merge-row {
    display: flex;
    align-items: stretch;
    border-radius: 7px;
}
.eb-merge-row:hover { background: #f4f6f8; }
.eb-merge-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex: 1;
    min-width: 0;
    text-align: left;
    border: none;
    background: transparent;
    border-radius: 7px;
    padding: 6px 8px;
    cursor: pointer;
}
.eb-merge-item-label {
    font-size: 13px;
    font-weight: 500;
    color: #0f1b2d;
}
.eb-merge-item-code {
    font-family: 'Space Mono', monospace;
    font-size: 10.5px;
    color: #3f5e8c;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.eb-merge-del {
    flex: none;
    border: none;
    background: transparent;
    color: #aeb6c1;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 9px;
    border-radius: 7px;
}
.eb-merge-del:hover { color: #d4504e; }
.eb-merge-add {
    width: 100%;
    margin-top: 6px;
    padding: 9px 0;
    border: 1px dashed #d6dce3;
    background: #fff;
    color: #3f5e8c;
    font-family: 'Figtree', sans-serif;
    font-weight: 600;
    font-size: 12.5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .12s;
}
.eb-merge-add:hover { border-color: #3f5e8c; background: #f7f9fc; }

/* === Output (right col) === */
.eb-output {
    flex: none;
    width: 460px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
}
.eb-output__tabs {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #eef1f4;
}
.eb-output__tab-group { display: flex; }
.eb-tab-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 14px 4px;
    margin-right: 22px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Figtree', sans-serif;
    color: #8a94a3;
    border-bottom: 2px solid transparent;
    transition: all .15s;
}
.eb-tab-btn.active { color: #0f1b2d; border-bottom-color: #3f5e8c; }
.eb-copy-btn {
    border: 1px solid #e6eaef;
    background: #fff;
    color: #0f1b2d;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    font-family: 'Figtree', sans-serif;
    padding: 7px 14px;
    border-radius: 999px;
    transition: all .15s;
}
.eb-copy-btn:hover { border-color: #3f5e8c; color: #3f5e8c; }
.eb-copy-btn.copied { border-color: #3f5e8c; background: #eef2f8; color: #3f5e8c; }

.eb-output__warning {
    flex: none;
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin: 14px 16px 0;
    padding: 11px 13px;
    background: #fdf6e3;
    border: 1px solid #f0e2bd;
    border-radius: 10px;
    font-size: 12.5px;
    line-height: 1.5;
    color: #7a6a2f;
}
.eb-output__warning strong { font-weight: 700; }

.eb-logo-note {
    font-size: 11.5px;
    line-height: 1.45;
    color: #8a94a3;
    margin: -6px 0 14px;
}

.eb-segment {
    display: flex;
    gap: 6px;
}
.eb-segment-btn {
    flex: 1;
    padding: 8px 0;
    border: 1px solid #e6eaef;
    background: #fff;
    color: #5a6675;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Figtree', sans-serif;
    font-size: 13px;
    font-weight: 600;
    transition: all .12s;
}
.eb-segment-btn:hover { border-color: #c4cbd4; }
.eb-segment-btn.active {
    border-color: #3f5e8c;
    background: #eef2f8;
    color: #3f5e8c;
}
.eb-layout-hint {
    font-size: 11.5px;
    line-height: 1.45;
    color: #8a94a3;
    margin-top: 7px;
}

.eb-preview-pane {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
    padding: 24px;
}
.eb-preview-pane--normal {
    padding: 0;
}
.eb-html-pane {
    flex: 1;
    overflow: auto;
    background: #0f1b2d;
    padding: 20px;
}
.eb-html-pane pre {
    margin: 0;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #cdd6e4;
    white-space: pre-wrap;
    word-break: break-word;
}

/* === Modal === */
.eb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,27,45,.28);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.eb-modal-overlay[hidden] { display: none; }
.eb-modal {
    width: 420px;
    max-width: 92%;
    max-height: 86%;
    overflow-y: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15,27,45,.28);
    padding: 24px;
}
.eb-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.eb-modal__title { font-size: 16px; font-weight: 700; color: #0f1b2d; }
.eb-modal__close {
    border: none;
    background: transparent;
    font-size: 20px;
    color: #aeb6c1;
    cursor: pointer;
    line-height: 1;
}
.eb-modal__desc {
    font-size: 12.5px;
    color: #8a94a3;
    margin-bottom: 18px;
    line-height: 1.5;
}
.eb-modal__actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.eb-modal__cancel, .eb-modal__save {
    flex: 1;
    padding: 11px 0;
    font-weight: 600;
    font-family: 'Figtree', sans-serif;
    font-size: 14px;
    border-radius: 9px;
    cursor: pointer;
    transition: all .15s;
}
.eb-modal__cancel {
    border: 1px solid #e6eaef;
    background: #fff;
    color: #5a6675;
}
.eb-modal__cancel:hover { border-color: #c4cbd4; }
.eb-modal__save {
    border: none;
    background: #0f1b2d;
    color: #fff;
}
.eb-modal__save:hover { background: #1a2d47; }

/* === My Blocks empty state === */
.eb-custom-empty {
    font-size: 12px;
    color: #aeb6c1;
    line-height: 1.5;
    padding: 2px 2px 0;
}
