#emailDesigner {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
}
#emailDesigner, #emailDesigner * { box-sizing: border-box; }
#emailDesigner button, #emailDesigner input, #emailDesigner textarea, #emailDesigner select { font: inherit; }
#emailDesigner button { cursor: pointer; }
.bted-app {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 300px;
    min-height: 100vh;
    background: #eef1f5;
}
.bted-sidebar {
    min-width: 0;
    background: #fff;
    border-color: #dfe3e8;
    border-style: solid;
    border-width: 0;
    padding: 16px;
}
.bted-left { border-right-width: 1px; }
.bted-right { border-left-width: 1px; }
.bted-panel-title { font-weight: 700; margin-bottom: 14px; }
.bted-block-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}
.bted-palette-item {
    width: 100%;
    min-width: 0;
    min-height: 72px;
    border: 1px solid #d7dce2;
    background: #fff;
    border-radius: 8px;
    padding: 14px 6px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
}
.bted-palette-item:hover { background: #f6f8fa; }
.bted-main { min-width: 0; }
.bted-toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #fff; border-bottom: 1px solid #dfe3e8; position: sticky; top: 0; z-index: 5; }
.bted-toolbar-group { display: flex; gap: 6px; }
.bted-email-size { display:flex; align-items:center; justify-content:center; min-width:190px; padding:7px 12px; border:1px solid #bbf7d0; border-radius:7px; background:#f0fdf4; color:#166534; font-size:12px; font-weight:700; line-height:1.25; white-space:nowrap; }
.bted-email-size.is-near { border-color:#fde68a; background:#fffbeb; color:#92400e; }
.bted-email-size.is-exceeded { border-color:#fecaca; background:#fef2f2; color:#b91c1c; }
.bted-toolbar button { border: 1px solid #d7dce2; background: #fff; border-radius: 6px; padding: 7px 10px; }
.bted-toolbar button.is-active { background: #1f2937; color: #fff; border-color: #1f2937; }

@media (max-width: 900px) {
    .bted-toolbar { flex-wrap: wrap; }
    .bted-email-size { order: 3; width: 100%; justify-content: space-between; box-sizing: border-box; }
}
.bted-stage-wrap { padding: 28px; overflow: auto; }
.bted-stage { margin: 0 auto; padding: 26px; min-height: calc(100vh - 90px); transition: max-width .2s ease; }
.bted-stage.is-mobile { max-width: 390px; }
.bted-email { margin: 0 auto; min-height: 500px; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.bted-empty { padding: 80px 30px; text-align: center; color: #77808c; }
.bted-block { position: relative; outline: 1px solid transparent; background: #fff; }
.bted-block:hover { outline-color: #8bb8ff; }
.bted-block.is-selected { outline: 2px solid #0d6efd; z-index: 1; }
.bted-block.is-dragging { opacity: .45; }
.bted-block-tools { display: none; position: absolute; right: 6px; top: 6px; z-index: 3; gap: 4px; }
.bted-block:hover .bted-block-tools, .bted-block.is-selected .bted-block-tools { display: flex; }
.bted-block-tools button { border: 0; background: rgba(17,24,39,.88); color: white; border-radius: 4px; width: 28px; height: 28px; }
.bted-demo-button { display: inline-block; padding: 12px 20px; border-radius: 5px; }
.bted-properties { display: grid; gap: 14px; }
.bted-field { display: grid; gap: 6px; font-size: 13px; }
.bted-field span { color: #4b5563; }
.bted-field input, .bted-field textarea, .bted-field select { width: 100%; border: 1px solid #cfd5dc; border-radius: 6px; padding: 8px; background: #fff; }
.bted-field input[type="color"] { padding: 2px; height: 38px; }
.bted-empty-properties { color: #7a8490; font-size: 14px; }
.bted-dialog { width: min(900px, 90vw); border: 0; border-radius: 10px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.bted-dialog::backdrop { background: rgba(0,0,0,.35); }
.bted-dialog-content { display: grid; grid-template-rows: auto 1fr auto; min-height: 70vh; }
.bted-dialog-head, .bted-dialog-actions { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #e2e5e9; }
.bted-dialog-actions { border-top: 1px solid #e2e5e9; border-bottom: 0; justify-content: flex-end; }
.bted-dialog-head button, .bted-dialog-actions button { border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 7px 11px; }
.bted-dialog textarea { width: 100%; min-height: 60vh; resize: vertical; border: 0; padding: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.bted-about-dialog { width: min(560px, 90vw); }
.bted-about-dialog .bted-dialog-content { min-height: 0; }
.bted-about-content { padding: 28px; color: #374151; font-size: 15px; line-height: 1.55; }
.bted-about-content h2 { margin: 0; color: #111827; font-size: 24px; }
.bted-about-content p { margin: 12px 0; }
.bted-about-content ul { margin: 14px 0; padding-left: 22px; }
.bted-about-content a { color: #0d6efd; overflow-wrap: anywhere; }
.bted-about-version { color: #6b7280; font-size: 13px; }
.bted-about-credits { margin: 22px 0; padding: 14px 16px; border-left: 3px solid #0d6efd; background: #f8fafc; }
.bted-about-credits p { margin: 3px 0; }
.bted-toolbar .bted-about-button { display: inline-grid; place-items: center; padding: 4px; }
.bted-about-button img { display: block; width: 24px; height: 24px; }
@media (max-width: 1100px) {
    .bted-app {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .bted-right {
        grid-column: 1 / -1;
        border-left-width: 0;
        border-top: 1px solid #dfe3e8;
    }
}

@media (max-width: 760px) {
    .bted-app {
        display: block;
    }

    .bted-left,
    .bted-right {
        border-width: 0 0 1px 0;
    }

    .bted-block-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bted-stage-wrap {
        padding: 14px;
    }

    .bted-stage {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .bted-block-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* V1.2 - ergonomie inspirée des éditeurs email simples */
.bted-palette-item { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; }
.bted-palette-icon { display:block; font-size:25px; line-height:1; font-weight:500; color:#111827; }
.bted-insert { position:relative; height:18px; display:flex; justify-content:center; align-items:center; z-index:4; }
.bted-insert::before { content:""; position:absolute; left:12px; right:12px; top:50%; border-top:1px dashed transparent; }
.bted-email:hover .bted-insert::before { border-color:#d9e2ef; }
.bted-insert-plus { position:relative; z-index:2; width:26px; height:26px; padding:0; border:0; border-radius:5px; background:#0d6efd; color:#fff; font-size:20px; line-height:24px; opacity:0; transform:scale(.85); transition:.12s ease; box-shadow:0 2px 5px rgba(13,110,253,.25); }
.bted-insert:hover .bted-insert-plus, .bted-insert-plus:focus, .bted-insert-menu.is-open ~ .bted-insert-plus { opacity:1; transform:scale(1); }
.bted-email:hover .bted-insert-plus { opacity:.72; }
.bted-insert-plus:hover, .bted-insert-plus:focus { opacity:1!important; }
.bted-insert-menu { display:none; position:absolute; top:28px; left:50%; transform:translateX(-50%); width:220px; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; padding:8px; background:#fff; border:1px solid #d7dce2; border-radius:8px; box-shadow:0 10px 30px rgba(0,0,0,.14); z-index:20; }
.bted-insert-menu.is-open { display:grid; }
.bted-insert-menu button { border:1px solid #e1e5ea; background:#fff; border-radius:5px; padding:8px 6px; font-size:12px; }
.bted-insert-menu button:hover { background:#f2f6ff; border-color:#9ec2ff; }
.bted-block-tools { top:-32px; right:0; background:#0d6efd; border-radius:5px 5px 0 0; gap:0; overflow:hidden; }
.bted-block-tools button { background:#0d6efd; border-radius:0; border-right:1px solid rgba(255,255,255,.2); }
.bted-block-tools button:last-child { border-right:0; }
.bted-block-tools button:hover { background:#0759cc; }
.bted-block-tools button:disabled { opacity:.35; cursor:default; }
.bted-block.is-selected { z-index:5; }

/* V1.3 - édition directe */
[data-inline-edit] {
    outline: none;
    cursor: text;
}

[data-inline-edit]:focus {
    outline: 1px dashed #78aefc;
    outline-offset: 3px;
    border-radius: 3px;
}

.bted-block.is-editing {
    cursor: text;
}

.bted-block.is-editing .bted-block-tools {
    opacity: .35;
}

.bted-inline-hint {
    padding: 9px 10px;
    border-radius: 6px;
    background: #f3f7fd;
    color: #45627f;
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid #dbe8f8;
}

.bted-block[draggable="true"] [data-inline-edit] {
    user-select: text;
}

/* V1.4 - barre de mise en forme contextuelle */
.bted-stage-wrap {
    position: relative;
}

.bted-inline-toolbar {
    position: absolute;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: #111827;
    border-radius: 7px;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: opacity .1s ease;
}

.bted-inline-toolbar.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.bted-inline-toolbar button {
    min-width: 30px;
    height: 30px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #fff;
    padding: 0 7px;
}

.bted-inline-toolbar button:hover {
    background: rgba(255,255,255,.14);
}

.bted-inline-toolbar strong,
.bted-inline-toolbar em,
.bted-inline-toolbar u {
    color: inherit;
}

/* V1.4.1 - sélection native du texte */
[data-inline-edit] {
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text !important;
}

.bted-block.is-editing {
    user-select: text !important;
    -webkit-user-select: text !important;
}

.bted-block.is-editing [data-inline-edit] {
    pointer-events: auto;
}

.bted-block.is-editing::selection,
.bted-block.is-editing [data-inline-edit]::selection {
    background: Highlight;
    color: HighlightText;
}

/* V1.5 - gestion des images */
.bted-image-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.bted-image-actions button {
    min-width: 0;
    border: 1px solid #0d6efd;
    background: #0d6efd;
    color: #fff;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
}

.bted-image-actions button:hover {
    background: #0b5ed7;
    border-color: #0a58ca;
}

.bted-image-preview {
    padding: 8px;
    border: 1px solid #e0e5ea;
    background: #f8fafc;
    border-radius: 7px;
    text-align: center;
}

.bted-image-preview img {
    display: block;
    max-width: 100%;
    max-height: 150px;
    margin: 0 auto;
    object-fit: contain;
}

/* V1.5.1 - images exclusivement via la médiathèque */
.bted-image-actions {
    grid-template-columns: minmax(0, 1fr);
}

/* V1.6 - structures en colonnes */
.bted-columns {
    display: flex;
    width: 100%;
    min-width: 0;
}

.bted-columns-one {
    display: block;
}

.bted-columns-two {
    align-items: stretch;
}

.bted-column {
    min-width: 0;
    min-height: 80px;
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 5px;
    background: rgba(255,255,255,.72);
    outline: none;
    cursor: text;
}

.bted-column:hover {
    border-color: #8db9f8;
}

.bted-column:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13,110,253,.08);
}

.bted-column p:first-child {
    margin-top: 0;
}

.bted-column p:last-child {
    margin-bottom: 0;
}

@media (max-width: 520px) {
    .bted-columns-two {
        display: block;
    }

    .bted-columns-two .bted-column {
        width: 100% !important;
        margin-bottom: 12px;
    }

    .bted-columns-two .bted-column:last-child {
        margin-bottom: 0;
    }
}

/* V1.7 - sous-composants dans les colonnes */
.bted-column-item {
    position: relative;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: rgba(255,255,255,.7);
}

.bted-column-item:hover {
    border-color: #b9d2f6;
}

.bted-column-item-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    display: none;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 4px;
    background: #dc3545;
    color: #fff;
    line-height: 20px;
    padding: 0;
    z-index: 3;
}

.bted-column-item:hover .bted-column-item-remove {
    display: block;
}

.bted-column-image {
    text-align: center;
}

.bted-column-image img {
    display: block;
    margin: 0 auto;
}

.bted-column-add {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px dashed #d8e0e8;
    font-size: 11px;
    color: #687586;
}

.bted-column-add button {
    border: 1px solid #cfd8e3;
    border-radius: 4px;
    background: #fff;
    padding: 5px 7px;
    font-size: 11px;
}

.bted-column-add button:hover {
    border-color: #8db9f8;
    background: #f5f9ff;
}

/* V1.7.1 - réordonnancement des sous-composants */
.bted-column-item-tools {
    position: absolute;
    top: 3px;
    right: 3px;
    display: none;
    overflow: hidden;
    border-radius: 4px;
    z-index: 4;
}

.bted-column-item:hover .bted-column-item-tools,
.bted-column-item:focus-within .bted-column-item-tools {
    display: flex;
}

.bted-column-item-tools button {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-right: 1px solid rgba(255,255,255,.2);
    background: #0d6efd;
    color: #fff;
    line-height: 24px;
}

.bted-column-item-tools button:last-child {
    border-right: 0;
    background: #dc3545;
}

.bted-column-item-tools button:hover:not(:disabled) {
    filter: brightness(.9);
}

.bted-column-item-tools button:disabled {
    opacity: .35;
    cursor: default;
}

.bted-column-item-remove {
    display: none !important;
}

/* V1.8 - alignement des zones de texte */
.bted-toolbar-separator {
    width: 1px;
    height: 22px;
    margin: 4px 2px;
    background: rgba(255,255,255,.22);
}

.bted-inline-toolbar [data-align="left"] {
    text-align: left;
}

.bted-inline-toolbar [data-align="center"] {
    text-align: center;
}

.bted-inline-toolbar [data-align="right"] {
    text-align: right;
}

/* V1.8.1 - pictogrammes d'alignement explicites */
.bted-inline-toolbar .bted-align-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    width: 31px;
    padding: 0 6px;
}

.bted-inline-toolbar .bted-align-icon span {
    display: block;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}

.bted-align-left span:nth-child(2),
.bted-align-left span:nth-child(4) { width: 65%; align-self: flex-start; }

.bted-align-center span:nth-child(2),
.bted-align-center span:nth-child(4) { width: 65%; align-self: center; }

.bted-align-right span:nth-child(2),
.bted-align-right span:nth-child(4) { width: 65%; align-self: flex-end; }

.bted-align-justify span { width: 100%; }

/* V1.8.3 - taille de police dans la barre contextuelle */
.bted-inline-toolbar .bted-font-size {
    height: 30px;
    min-width: 62px;
    padding: 0 5px;
    border: 0;
    border-radius: 4px;
    background: #273244;
    color: #fff;
    font-size: 12px;
}

.bted-inline-toolbar .bted-font-size:focus {
    outline: 1px solid rgba(255,255,255,.5);
}

/* V1.9 - couleur du texte dans la barre contextuelle */
.bted-text-color {
    position: relative;
    display: flex;
    width: 31px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.bted-text-color:hover {
    background: rgba(255,255,255,.14);
}

.bted-text-color span {
    border-bottom: 3px solid currentColor;
    line-height: 18px;
}

.bted-text-color input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* V1.10 - footer newsletter */
.bted-footer {
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

.bted-footer-links {
    margin-top: 7px;
}

.bted-footer-links a {
    text-decoration: underline;
}

.bted-footer-socials {
    display: flex;
    flex-wrap: wrap;
    margin-top: 14px;
    align-items: center;
}

.bted-footer-social-link {
    display: inline-block;
}

.bted-footer-social-link img {
    display: block;
    border: 0;
    object-fit: contain;
}

.bted-properties-section-title {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e2e6eb;
    font-weight: 700;
    font-size: 13px;
}

.bted-footer-add-link {
    width: 100%;
    border: 1px solid #a9bdd3;
    background: #f7faff;
    border-radius: 6px;
    padding: 8px 10px;
}

.bted-footer-link-editor {
    display: grid;
    gap: 9px;
    padding: 10px;
    border: 1px solid #dfe4e9;
    border-radius: 7px;
    background: #fafbfd;
}

.bted-footer-link-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bted-footer-link-tools {
    display: flex;
    gap: 3px;
}

.bted-footer-link-tools button {
    width: 27px;
    height: 27px;
    padding: 0;
    border: 1px solid #d4d9df;
    border-radius: 4px;
    background: #fff;
}

.bted-footer-link-tools button:last-child {
    color: #b4232f;
}

.bted-footer-link-tools button:disabled {
    opacity: .35;
}

.bted-switch-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* V1.10.2 - ergonomie : panneau Propriétés indépendant */
.bted-app {
    height: 100vh;
    min-height: 0;
}

.bted-main {
    min-height: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.bted-stage-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.bted-right {
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    position: sticky;
    top: 0;
}

.bted-left {
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
}

@media (max-width: 1100px) {
    .bted-app {
        height: auto;
    }

    .bted-main,
    .bted-left,
    .bted-right {
        height: auto;
        position: static;
        overflow: visible;
    }

    .bted-stage-wrap {
        overflow: auto;
    }
}

/* V1.10.3 - footer verrouillé */
.bted-palette-item:disabled {
    opacity: .45;
    cursor: not-allowed;
    background: #f3f4f6;
}

.bted-footer-block {
    cursor: default;
}

.bted-footer-block.is-selected {
    outline-color: #6b7280;
}

/* V1.10.4 - correction présentation checkbox footer */
.bted-field .bted-switch-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    width: auto;
}

.bted-field .bted-switch-row input[type="checkbox"] {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

.bted-field .bted-switch-row span {
    display: inline;
    margin: 0;
    white-space: nowrap;
    color: #4b5563;
}

/* V1.11 - en-tête structurel verrouillé */
.bted-header-block {
    cursor: default;
}

.bted-header-block.is-selected {
    outline-color: #6b7280;
}

.bted-header img {
    max-width: 100%;
    height: auto;
}

/* Intégration Vanilla Email Designer : confinement et hauteur du composant */
#emailDesigner {
    width: 100%;
    height: min(820px, calc(100vh - 140px));
    min-height: 650px;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    overflow: hidden;
    background: #eef1f5;
}

#emailDesigner .bted-app,
#emailDesigner .bted-main,
#emailDesigner .bted-left,
#emailDesigner .bted-right {
    height: 100%;
    min-height: 0;
}

#emailDesigner .bted-app {
    min-height: 0;
}

#emailDesigner .bted-stage {
    min-height: 600px;
}

@media (max-width: 1100px) {
    #emailDesigner {
        height: auto;
        min-height: 0;
        overflow: visible;
    }
}

/* V1.12 - bordures de blocs */
#emailDesigner .bted-block-frame {
    width: 100%;
    min-width: 0;
}

#emailDesigner .bted-properties-section-title {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid #e2e6eb;
    font-weight: 700;
    font-size: 13px;
}

/* Text background color control */
.bted-background-color span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
