/* ═══════════════════════════════════════════════════
   WIDEBLAZE — Text Expansion Manager
   Premium 2-Column Layout (Aside + Main)
   ═══════════════════════════════════════════════════ */

.wb-view {
    position: fixed !important;
    top: 45px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: calc(100vh - 45px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box;
    font-family: 'Inter', 'Outfit', sans-serif;
    color: var(--text-main);
    background: var(--bg-body);
    z-index: 10;
}

.wb-layout {
    display: flex;
    align-items: stretch;
    width: 100%;
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ── ASIDE LEFT (Flat Sidebar — TextBlaze Style) ── */
.wb-aside {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    background: var(--bg-body-secondary);
    border-right: 1px solid var(--border-color);
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    gap: 0;
    /* Subtle scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}



.wb-aside::-webkit-scrollbar {
    width: 4px;
}
.wb-aside::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Top action buttons area */
.wb-aside-actions {
    padding: 12px 12px 8px;
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Section label (e.g. "Mes Raccourcis") */
.wb-aside-section-label {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 10px 14px 4px;
}

.wb-aside-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 12px;
}

/* Legacy group wrapper (kept for compat) */
.wb-aside-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wb-aside-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 4px;
}

.wb-aside-header span {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.wb-aside-header button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wb-aside-header button:hover {
    color: var(--primary);
    background: rgba(59,130,246,0.08);
}

/* Folder Items — Flat nav style (TextBlaze-like) */
.wb-folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-main);
    border: none;
    border-left: 2px solid transparent;
    margin: 0;
}

.wb-folder-item:hover {
    background: rgba(0,0,0,0.04);
    color: var(--primary);
}
[data-theme="dark"] .wb-folder-item:hover {
    background: rgba(255,255,255,0.04);
}

.wb-folder-item.active {
    background: rgba(59,130,246,0.08);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 700;
}

.wb-folder-item i {
    font-size: 0.95rem;
    opacity: 0.65;
    flex-shrink: 0;
}

.wb-folder-item.active i {
    opacity: 1;
}

.wb-folder-count {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 6px;
    background: rgba(0,0,0,0.06);
    color: var(--text-muted);
    min-width: 18px;
    text-align: center;
}

.wb-folder-item.active .wb-folder-count {
    background: rgba(59,130,246,0.15);
    color: var(--primary);
}

/* Sub-snippets under folder */
.wb-folder-snippets {
    padding-left: 28px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 4px;
}

.wb-folder-snippet {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.wb-folder-snippet:hover {
    color: var(--text-main);
    background: var(--bg-body-secondary);
}

.wb-folder-snippet.active {
    color: var(--primary);
    font-weight: 700;
}

.wb-folder-snippet i {
    font-size: 0.65rem;
    opacity: 0.5;
}

/* ── MAIN CONTENT ── */
.wb-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-width: 0;
    padding: 20px 24px 24px;
    height: 100%;
    overflow-y: auto;
}

/* Header Bar */
.wb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.wb-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.wb-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

.wb-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 500;
    box-sizing: border-box;
    transition: all 0.2s;
}

.wb-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.wb-btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: var(--text-on-primary, white);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
}

.wb-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59,130,246,0.3);
}

.wb-btn-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}

.wb-btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* KPI Cards */
.wb-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.wb-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 2px 12px -2px rgba(0,0,0,0.03);
    transition: all 0.25s;
}

.wb-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

.wb-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.wb-kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    letter-spacing: -0.02em;
}

.wb-kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

/* Test Zone */
.wb-test-zone {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px -2px rgba(0,0,0,0.03);
}

.wb-test-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.wb-test-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.wb-test-header h3 i { color: var(--primary); }

.wb-test-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
}

.wb-test-subtitle code {
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.78rem;
}

.wb-test-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wb-test-area {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-body-secondary);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.wb-test-area:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.08);
}

.wb-test-area::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Snippet List */
.wb-snippet-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wb-snippet-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
}

.wb-snippet-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(59,130,246,0.08);
    transform: translateY(-1px);
}

.wb-snippet-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(59,130,246,0.08);
    color: var(--primary);
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.85rem;
    font-family: 'Inter', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.wb-snippet-trigger i {
    font-size: 0.75rem;
    opacity: 0.6;
}

.wb-snippet-info {
    flex: 1;
    min-width: 0;
}

.wb-snippet-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wb-snippet-preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.wb-snippet-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.wb-snippet-card:hover .wb-snippet-actions {
    opacity: 1;
}

.wb-snippet-actions button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-body-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 0.9rem;
}

.wb-snippet-actions button:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.wb-snippet-actions button.delete:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239,68,68,0.05);
}

/* Empty State */
.wb-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.wb-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.wb-empty h3 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.wb-empty p {
    font-size: 0.85rem;
    margin: 0 0 1.5rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* Modal */
.wb-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wbFadeIn 0.2s ease-out;
}

@keyframes wbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wb-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);
    animation: wbSlideUp 0.3s ease-out;
}

@keyframes wbSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.wb-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.wb-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.wb-modal-close:hover {
    background: var(--bg-body-secondary);
    color: var(--text-main);
}

.wb-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.wb-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form Controls */
.wb-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wb-form-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.wb-form-input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-body-secondary);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    box-sizing: border-box;
    width: 100%;
}

.wb-form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.wb-form-textarea {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-body-secondary);
    color: var(--text-main);
    font-size: 0.88rem;
    font-family: inherit;
    min-height: 140px;
    resize: vertical;
    transition: all 0.2s;
    box-sizing: border-box;
    width: 100%;
    line-height: 1.6;
}

.wb-form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.wb-form-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-body-secondary);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
    width: 100%;
}

.wb-form-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Onboarding Modal */
.wb-onboard-card {
    background: var(--bg-body-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 12px;
}

.wb-onboard-card h4 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wb-onboard-card p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.wb-btn-import {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s;
    margin-top: 16px;
}

.wb-btn-import:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249,115,22,0.35);
}

.wb-btn-scratch {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: transparent;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.wb-btn-scratch:hover {
    border-color: var(--primary);
    background: var(--bg-body-secondary);
}

/* Variable Toolbar */
.wb-var-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.wb-var-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-body-secondary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.wb-var-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59,130,246,0.05);
}

.wb-var-btn i { font-size: 0.85rem; }

/* ═══ PREMIUM RICH WYSIWYG EDITOR ═══ */
.wb-editor-container {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 16px;
    background: var(--bg-body-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 8px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.02);
}

.wb-editor-main {
    display: flex;
    flex-direction: column;
    min-height: 360px;
    background: var(--bg-card);
}

/* Editor Toolbar */
.wb-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body-secondary);
    user-select: none;
}

.wb-editor-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.wb-editor-tb-btn:hover {
    color: var(--text-main);
    background: rgba(0,0,0,0.05);
    border-color: var(--border-color);
}

.wb-editor-tb-btn.active {
    color: var(--primary);
    background: rgba(59,130,246,0.08);
    border-color: rgba(59,130,246,0.2);
}

.wb-editor-tb-divider {
    width: 1px;
    height: 18px;
    background: var(--border-color);
    margin: 0 4px;
}

.wb-editor-mode-toggle {
    margin-left: auto;
    display: flex;
    background: var(--bg-body-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
}

.wb-editor-mode-btn {
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.wb-editor-mode-btn.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Editor Area */
.wb-editor-area {
    flex: 1;
    padding: 18px;
    font-size: 0.92rem;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background: var(--bg-card);
    min-height: 250px;
    white-space: pre-wrap;
}

.wb-editor-area::placeholder {
    color: var(--text-muted);
    opacity: 0.4;
}

/* ── Command Sidebar ── */
.wb-cmd-sidebar {
    background: var(--bg-body-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    user-select: none;
}

.wb-cmd-search-box {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.wb-cmd-search-box input {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.78rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    box-sizing: border-box;
}

.wb-cmd-search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.wb-cmd-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wb-cmd-section-title {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 4px 6px;
    margin-bottom: 4px;
}

.wb-cmd-items-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wb-cmd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.wb-cmd-item:hover {
    background: rgba(0,0,0,0.03);
}

.wb-cmd-item-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.wb-cmd-item-info {
    min-width: 0;
}

.wb-cmd-item-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 4px;
}

.wb-cmd-item-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.wb-pro-badge {
    font-size: 0.58rem;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(249,115,22,0.1);
    color: #f97316;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Colored Variable Pills (TextBlaze replica) ── */
.wb-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    margin: 1px 3px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    user-select: none;
    vertical-align: baseline;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.wb-pill i {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Pink / Rose - Conditionals */
.wb-pill-if, .wb-pill-elseif, .wb-pill-endif {
    background: #fdf2f8 !important;
    border-color: #fbcfe8 !important;
    color: #db2777 !important;
}
.wb-pill-if:hover, .wb-pill-elseif:hover, .wb-pill-endif:hover {
    background: #fce7f3 !important;
    border-color: #f9a8d4 !important;
}

/* Gray - Else */
.wb-pill-else {
    background: #f3f4f6 !important;
    border-color: #e5e7eb !important;
    color: #4b5563 !important;
}
.wb-pill-else:hover {
    background: #e5e7eb !important;
}

/* Blue - Date / Time */
.wb-pill-date, .wb-pill-time {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #2563eb !important;
}
.wb-pill-date:hover, .wb-pill-time:hover {
    background: #dbeafe !important;
}

/* Purple - Clipboard */
.wb-pill-clipboard {
    background: #f5f3ff !important;
    border-color: #ddd6fe !important;
    color: #7c3aed !important;
}
.wb-pill-clipboard:hover {
    background: #ede9fe !important;
}

/* Cyan - Cursor */
.wb-pill-cursor {
    background: #ecfeff !important;
    border-color: #cffafe !important;
    color: #0891b2 !important;
}
.wb-pill-cursor:hover {
    background: #cffafe !important;
}

/* Teal - Text inputs */
.wb-pill-formtext, .wb-pill-formparagraph {
    background: #f0fdfa !important;
    border-color: #ccfbf1 !important;
    color: #0d9488 !important;
}
.wb-pill-formtext:hover, .wb-pill-formparagraph:hover {
    background: #ccfbf1 !important;
}

/* Orange - Menu dropdown */
.wb-pill-formmenu {
    background: #fff7ed !important;
    border-color: #ffedd5 !important;
    color: #ea580c !important;
}
.wb-pill-formmenu:hover {
    background: #ffedd5 !important;
}

/* Emerald - Toggle switch */
.wb-pill-formtoggle {
    background: #f0fdf4 !important;
    border-color: #dcfce7 !important;
    color: #059669 !important;
}
.wb-pill-formtoggle:hover {
    background: #dcfce7 !important;
}

/* Red - Autopilot actions */
.wb-pill-click, .wb-pill-key {
    background: #fef2f2 !important;
    border-color: #fee2e2 !important;
    color: #dc2626 !important;
}
.wb-pill-click:hover, .wb-pill-key:hover {
    background: #fee2e2 !important;
}

/* Purple - Formula/Expression {=} */
.wb-pill-formula {
    background: #f5f3ff !important;
    border-color: #ddd6fe !important;
    color: #7c3aed !important;
    font-style: italic;
}
.wb-pill-formula:hover {
    background: #ede9fe !important;
}

/* Cyan/Teal - Repeat / EndRepeat */
.wb-pill-repeat {
    background: #ecfeff !important;
    border-color: #a5f3fc !important;
    color: #0e7490 !important;
    border-style: dashed !important;
}
.wb-pill-repeat:hover {
    background: #cffafe !important;
}
.wb-pill-endrepeat {
    background: #ecfeff !important;
    border-color: #a5f3fc !important;
    color: #0e7490 !important;
    opacity: 0.75;
    border-style: dashed !important;
}
.wb-pill-endrepeat:hover {
    background: #cffafe !important;
    opacity: 1;
}

/* Indigo - Import snippet */
.wb-pill-import {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #4338ca !important;
}
.wb-pill-import:hover {
    background: #e0e7ff !important;
}

/* Stone/Gray - Note (non-visible) */
.wb-pill-note {
    background: #fafaf9 !important;
    border-color: #d6d3d1 !important;
    color: #78716c !important;
    border-style: dotted !important;
    opacity: 0.8;
}
.wb-pill-note:hover {
    background: #f5f5f4 !important;
    opacity: 1;
}

/* Amber/Gold - Random */
.wb-pill-random {
    background: #fffbeb !important;
    border-color: #fde68a !important;
    color: #d97706 !important;
}
.wb-pill-random:hover {
    background: #fef3c7 !important;
}

/* Blue - formdate (same as time family) */
.wb-pill-formdate {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
}
.wb-pill-formdate:hover {
    background: #dbeafe !important;
}
/* Editable Raw Pill */
.wb-pill-raw {
    display: inline-block;
    background: #eff6ff !important;
    border: 1px dashed #3b82f6 !important;
    color: #1d4ed8 !important;
    padding: 2px 6px;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: text;
    margin: 0 2px;
    outline: none;
}
[data-theme="dark"] .wb-pill-raw {
    background: rgba(59,130,246,0.15) !important;
    border-color: rgba(59,130,246,0.5) !important;
    color: #60a5fa !important;
}

/* ═══ VISUAL PREVIEW MODE (Mode Visuel) ═══ */
.wb-preview-panel {
    flex: 1;
    padding: 28px 32px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    min-height: 400px;
    line-height: 1.75;
    font-size: 0.92rem;
    color: var(--text-main);
    overflow-y: auto;
    font-family: 'Inter', sans-serif;
    position: relative;
}

.wb-preview-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 27px,
        rgba(0,0,0,0.025) 27px,
        rgba(0,0,0,0.025) 28px
    );
    pointer-events: none;
    border-radius: inherit;
}
[data-theme="dark"] .wb-preview-panel::before {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 27px,
        rgba(255,255,255,0.04) 27px,
        rgba(255,255,255,0.04) 28px
    );
}

.wb-preview-content {
    position: relative;
    z-index: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Form controls in preview */
.wb-preview-input {
    display: inline-block;
    border: 1px solid var(--border-color);
    border-bottom: 2px solid var(--primary);
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 1px 6px;
    font-size: 0.88rem;
    font-family: inherit;
    background: transparent;
    color: var(--text-main);
    min-width: 80px;
    max-width: 260px;
    outline: none;
    border-radius: 0;
    transition: border-color 0.15s;
}
.wb-preview-input:focus {
    border-bottom-color: #7c3aed;
}

.wb-preview-textarea {
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--bg-body-secondary);
    color: var(--text-main);
    min-width: 240px;
    resize: vertical;
    margin: 6px 0;
    outline: none;
    transition: border-color 0.15s;
}
.wb-preview-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.wb-preview-select {
    display: inline-block;
    border: 1px solid var(--border-color);
    border-bottom: 2px solid var(--primary);
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 1px 6px;
    font-size: 0.88rem;
    font-family: inherit;
    background: transparent;
    color: var(--text-main);
    outline: none;
    border-radius: 0;
    cursor: pointer;
    appearance: auto;
}

.wb-preview-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    user-select: none;
}
.wb-preview-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Values rendered in preview */
.wb-preview-val {
    font-weight: 500;
    color: var(--text-main);
}

.wb-preview-formula {
    color: #7c3aed;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: rgba(124,58,237,0.07);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(124,58,237,0.15);
}
[data-theme="dark"] .wb-preview-formula {
    background: rgba(139,92,246,0.12);
    color: #a78bfa;
}

.wb-preview-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.82rem;
    opacity: 0.7;
}

.wb-preview-cursor {
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: var(--primary);
    vertical-align: middle;
    animation: wb-cursor-blink 1.1s step-end infinite;
    margin: 0 1px;
}

@keyframes wb-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Preview empty state */
.wb-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 280px;
    color: var(--text-muted);
    text-align: center;
    opacity: 0.5;
}
.wb-preview-empty i {
    font-size: 2.5rem;
    opacity: 0.4;
}

.wb-sidebar-config-form {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

/* ── Inline micro popups (Editor Popups) ── */
.wb-editor-popup-overlay {
    position: absolute;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.15);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: wbFadeIn 0.15s ease-out;
}

.wb-editor-popup {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    overflow: hidden;
    animation: wbSlideUp 0.2s ease-out;
}

.wb-editor-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body-secondary);
}

.wb-editor-popup-header h4 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.wb-editor-popup-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wb-editor-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body-secondary);
}

/* Dark mode theme variables for pills override */
[data-theme="dark"] .wb-pill-if, 
[data-theme="dark"] .wb-pill-elseif, 
[data-theme="dark"] .wb-pill-endif {
    background: rgba(244,63,94,0.12) !important;
    border-color: rgba(244,63,94,0.4) !important;
    color: #f43f5e !important;
}
[data-theme="dark"] .wb-pill-else {
    background: rgba(156,163,175,0.12) !important;
    border-color: rgba(156,163,175,0.4) !important;
    color: #d1d5db !important;
}
[data-theme="dark"] .wb-pill-date,
[data-theme="dark"] .wb-pill-time {
    background: rgba(59,130,246,0.12) !important;
    border-color: rgba(59,130,246,0.4) !important;
    color: #60a5fa !important;
}
[data-theme="dark"] .wb-pill-clipboard {
    background: rgba(139,92,246,0.12) !important;
    border-color: rgba(139,92,246,0.4) !important;
    color: #a78bfa !important;
}
[data-theme="dark"] .wb-pill-cursor {
    background: rgba(6,182,212,0.12) !important;
    border-color: rgba(6,182,212,0.4) !important;
    color: #22d3ee !important;
}
[data-theme="dark"] .wb-pill-formtext, 
[data-theme="dark"] .wb-pill-formparagraph {
    background: rgba(20,184,166,0.12) !important;
    border-color: rgba(20,184,166,0.4) !important;
    color: #2dd4bf !important;
}
[data-theme="dark"] .wb-pill-formmenu {
    background: rgba(249,115,22,0.12) !important;
    border-color: rgba(249,115,22,0.4) !important;
    color: #fb923c !important;
}
[data-theme="dark"] .wb-pill-formtoggle {
    background: rgba(16,185,129,0.12) !important;
    border-color: rgba(16,185,129,0.4) !important;
    color: #34d399 !important;
}
[data-theme="dark"] .wb-pill-click,
[data-theme="dark"] .wb-pill-key {
    background: rgba(239,68,68,0.12) !important;
    border-color: rgba(239,68,68,0.4) !important;
    color: #f87171 !important;
}
/* ── Formula Helper Styles ── */
.wb-formula-helper {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-body-secondary);
    padding: 10px;
    margin-top: 12px;
}

.wb-formula-pill-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: monospace;
    display: inline-flex;
    align-items: center;
}

.wb-formula-pill-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary, #fff);
}

.wb-formula-fn-btn {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    padding: 5px 8px;
    border-radius: 5px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.65rem;
}

.wb-formula-fn-btn:hover {
    background: rgba(79, 70, 229, 0.08);
}

[data-theme="dark"] .wb-formula-fn-btn:hover {
    background: rgba(129, 140, 248, 0.15);
}

/* Responsive */
@media (max-width: 1100px) {
    .wb-layout {
        flex-direction: column;
    }
    .wb-aside {
        position: static;
        width: 100%;
        min-width: unset;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }
    .wb-main {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .wb-kpi-row {
        grid-template-columns: 1fr;
    }
    .wb-header {
        flex-direction: column;
        align-items: stretch;
    }
    .wb-search {
        max-width: 100%;
    }
    .wb-form-row {
        grid-template-columns: 1fr;
    }
}

/* ── Preview Note Block Styles ── */
.wb-preview-note-block {
    background: rgba(243, 244, 246, 0.5);
    border: 1.5px dashed var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 10px 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    position: relative;
}
[data-theme="dark"] .wb-preview-note-block {
    background: rgba(31, 41, 55, 0.4);
}
.wb-preview-note-header {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.wb-preview-note-header i {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.wb-preview-note-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(243, 244, 246, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}
[data-theme="dark"] .wb-preview-note-inline {
    background: rgba(55, 65, 81, 0.6);
}

/* Incremental editor polish: retain the existing three-panel structure. */
.wb-aside { width: 280px; min-width: 240px; background: var(--bg-card); }
.wb-aside .wb-folder-item {
    min-height: 38px;
    gap: 8px;
    line-height: 1.45;
    font-size: .85rem !important;
    text-align: left;
}
.wb-aside button.wb-folder-item {
    width: 100%;
    font-family: inherit;
    border: 0;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
}
.wb-aside button.wb-folder-item:hover { background: var(--bg-body-secondary); }
.wb-aside button.wb-folder-item.active {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, var(--bg-card));
    box-shadow: inset 3px 0 var(--primary);
}
.wb-aside .wb-import-button { color: var(--primary); padding: 12px 14px; }
.wb-aside .wb-aside-header { font-size: .72rem; padding: 16px 14px 8px; letter-spacing: .04em; }
.wb-aside .wb-folder-item > span:last-child:not(:first-child) { font-size: .72rem !important; }
.wb-view button:focus-visible,
.wb-view input:focus-visible,
.wb-view select:focus-visible,
.wb-view textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}
.wb-workspace { min-width: 0; }
.wb-metadata-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(140px, 180px) minmax(130px, 180px); gap: 16px; align-items: end; }
.wb-source-grid { display: grid; grid-template-columns: minmax(140px, 1fr) auto; gap: 16px; align-items: center; padding-top: 4px; }
.wb-workspace .wb-form-label { font-size: .73rem !important; line-height: 1.5; margin-bottom: 6px !important; }
.wb-workspace .wb-form-input,
.wb-workspace .wb-form-select { min-height: 38px; }
.wb-preview-note-block,
.wb-preview-note-inline,
[data-theme="dark"] .wb-preview-note-block,
[data-theme="dark"] .wb-preview-note-inline { background: var(--bg-body-secondary); }
@media (max-width: 1100px) {
    .wb-aside { width: 240px; }
    .wb-metadata-grid { grid-template-columns: 1fr 1fr; }
    .wb-metadata-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
    .wb-layout { overflow: auto; flex-direction: column; }
    .wb-aside { width: 100%; min-width: 0; max-height: 36vh; flex-shrink: 0; flex-direction: column; border-right: 0; border-bottom: 1px solid var(--border-color); }
    .wb-metadata-grid, .wb-source-grid { grid-template-columns: minmax(0, 1fr); }
    .wb-workspace { width: 100%; }
}

/* ── Mise en forme riche (snippets HTML) ── */
.wb-editor-area strong, .wb-editor-area b, .wb-preview-content strong, .wb-preview-content b { font-weight: 700; }
.wb-editor-area em, .wb-editor-area i:not([class]), .wb-preview-content em { font-style: italic; }
.wb-editor-area u, .wb-preview-content u { text-decoration: underline; }
.wb-editor-area s, .wb-editor-area strike, .wb-editor-area del, .wb-preview-content s, .wb-preview-content strike, .wb-preview-content del { text-decoration: line-through; }
.wb-editor-area ul, .wb-editor-area ol, .wb-preview-content ul, .wb-preview-content ol { margin: 0.4em 0; padding-left: 1.5em; }
.wb-editor-area ul, .wb-preview-content ul { list-style: disc; }
.wb-editor-area ol, .wb-preview-content ol { list-style: decimal; }
.wb-editor-area a, .wb-preview-content a { color: var(--primary); text-decoration: underline; cursor: pointer; }
.wb-editor-area p, .wb-preview-content p { margin: 0 0 0.6em; }
.wb-editor-rich-toggle { width: auto; gap: 6px; padding: 0 10px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.wb-editor-rich-toggle.active { color: var(--primary); }

/* L'editeur occupe la hauteur disponible au lieu d'une hauteur fixe. */
.wb-editor-container { min-height: max(480px, calc(100vh - 340px)); }

@media (max-width: 520px) {
    .wb-editor-rich-label { display: none; }
    .wb-editor-toolbar { flex-wrap: wrap; row-gap: 4px; }
}

/* ── Onglets de bibliotheque (aside) ── */
.wb-scope-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 10px 12px 6px; }
.wb-scope-tab { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 7px 4px; border: 1px solid var(--border-color); border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 0.72rem; font-weight: 600; cursor: pointer; }
.wb-scope-tab:hover { color: var(--text-main); background: var(--bg-hover); }
.wb-scope-tab.active { color: var(--primary); background: var(--primary-light); border-color: var(--primary); }
.wb-scope-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.wb-scope-hub { display: flex; align-items: center; gap: 6px; padding: 0 14px 6px; color: var(--text-muted); font-size: 0.7rem; font-weight: 600; }
.wb-rich-flag { font-size: 0.7rem; color: var(--text-muted); opacity: 0.8; }
.wb-editor-area code, .wb-preview-content code { padding: 1px 5px; border-radius: 4px; background: var(--bg-alternate); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88em; }

/* Smartphone : editeur pleine largeur, commandes empilees dessous (au lieu d'une colonne de 240px). */
@media (max-width: 768px) {
    .wb-editor-container { grid-template-columns: 1fr; min-height: 0; }
    .wb-editor-area { min-height: 220px; }
    .wb-cmd-sidebar { border-left: 0; border-top: 1px solid var(--border-color); height: auto; max-height: 320px; overflow: auto; }
}


/* ══════════════════════════════════════════════════════════════════════════════
   SKIN COCKPIT - identite My Stats / Actes Co
   Barre CockpitToolbar + espace de travail a hauteur fixe fait de cartes blanches (rayon 12, bordure fine,
   ombre discrete). Plus d'aplat gris : surfaces = --bg-card, fond de page = --bg-body, accent = --primary.
   ══════════════════════════════════════════════════════════════════════════════ */
.wb-view {
    padding: 10px 14px !important;
    gap: 10px !important;
    overflow: hidden !important;
    background: var(--bg-body) !important;
}
.wb-view > .cpt-toolbar { flex-shrink: 0; }

/* Conteneur de page : meme modele que My Stats et Actes Co (dans le flux de main-content, zero marge parasite). */
.main-content:has(.wb-view),
.main-content.impersonating:has(.wb-view) {
    margin: 45px 0 0 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}
.wb-view {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: auto !important;
    width: 100% !important;
    height: calc(100vh - 45px) !important;
    max-height: calc(100vh - 45px) !important;
    box-sizing: border-box !important;
    padding: 10px 14px !important;
    gap: 10px !important;
}


.wb-layout {
    display: grid !important;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 12px;
    flex: 1 1 0;
    min-height: 0;
    height: auto;
}

/* Carte de gauche : arborescence */
.wb-aside {
    width: auto !important;
    min-width: 0 !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
    overflow: hidden !important;
}
.wb-aside .wb-aside-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 14px 4px;
}
.wb-aside .wb-folder-item:hover,
.wb-aside button.wb-folder-item:hover { background: var(--bg-hover) !important; }
.wb-aside .wb-folder-item.active {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    box-shadow: inset 3px 0 0 var(--primary);
}

/* Colonne centrale : cartes */
.wb-main {
    padding: 0 2px 0 0 !important;
    gap: 12px !important;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.wb-workspace > div:first-child {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
    padding: 10px 14px !important;
}

/* Champs : blancs, bordure fine, focus primaire */
.wb-view .wb-form-input,
.wb-view .wb-form-select,
.wb-view .wb-form-textarea {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: var(--text-main);
}
.wb-view .wb-form-input:focus,
.wb-view .wb-form-select:focus,
.wb-view .wb-form-textarea:focus,
.wb-view .wb-form-input:focus-within { border-color: var(--primary) !important; outline: none; }
.wb-view .wb-form-label { color: var(--text-muted); letter-spacing: 0.03em; }

/* Editeur : une seule carte, barre d'outils et commandes integrees */
.wb-editor-container {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
    grid-template-columns: minmax(0, 1fr) 300px !important;
    gap: 0 !important;
}
.wb-editor-main { background: var(--bg-card) !important; }
.wb-editor-toolbar {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-color) !important;
    min-height: 44px;
    padding: 6px 10px;
}
.wb-editor-area { background: var(--bg-card) !important; }
.wb-editor-tb-btn:hover { background: var(--bg-hover) !important; }
.wb-editor-tb-btn.active { background: var(--primary-light) !important; border-color: transparent !important; color: var(--primary) !important; }
.wb-cmd-sidebar {
    background: var(--bg-card) !important;
    border-left: 1px solid var(--border-color) !important;
}
.wb-cmd-search-box { background: transparent !important; border-bottom: 1px solid var(--border-color); }
.wb-cmd-search-box input {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
}
.wb-cmd-section-title { color: var(--text-muted); }
.wb-cmd-item:hover { background: var(--bg-hover) !important; }

/* Bascules Code/Visuel et moteur : meme rendu que les controles segmentes d'Actes Co */
.wb-editor-mode-toggle {
    background: var(--bg-body) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 2px !important;
    gap: 2px !important;
}
.wb-editor-mode-btn { border-radius: 6px !important; font-size: 0.76rem; font-weight: 600; }
.wb-editor-mode-btn.active {
    background: var(--bg-card) !important;
    color: var(--primary) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

/* Console d'essai et panneaux d'analyse */
.wb-test-zone {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}
.wb-test-header { background: transparent !important; border-bottom: 1px solid var(--border-color); }

/* Barre cockpit : onglets de bibliotheque et actions */
.wb-seg-prefix {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.68rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-radius: 4px;
    padding: 0 4px;
}
.ac-seg-btn.active .wb-seg-prefix { color: var(--primary); background: var(--primary-light); }
.wb-quick-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--text-on-primary, #fff) !important;
}
.wb-quick-primary:hover { background: var(--primary-hover, var(--primary)) !important; }
.wb-readonly-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-body);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Tablette / smartphone : pile verticale, la page defile */
@media (max-width: 900px) {
    .wb-view { overflow-y: auto !important; }
    .wb-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        flex: none;
        overflow: visible !important;
    }
    .wb-aside { max-height: 260px; }
    .wb-main { overflow: visible !important; }
    .wb-editor-container { grid-template-columns: minmax(0, 1fr) !important; }
    .wb-cmd-sidebar { border-left: 0 !important; border-top: 1px solid var(--border-color) !important; max-height: 320px; }
}

/* Espacements alignes sur My Stats / Actes Co : 12px entre cartes, editeur qui occupe la hauteur restante. */
.wb-main { display: flex !important; flex-direction: column !important; gap: 12px !important; }
.wb-main > .wb-workspace { flex: 1 1 auto; min-height: 0; gap: 12px !important; }
.wb-main > .wb-workspace > div:nth-child(2) { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 420px; }
.wb-main > .wb-workspace > div:nth-child(2) > .wb-editor-container { flex: 1 1 auto; min-height: 0 !important; margin-top: 0 !important; }
.wb-main .wb-test-zone { margin-top: 0 !important; flex: none; }

/* Barre cockpit : onglets de bibliotheque toujours au meme endroit, quel que soit le nombre de boutons a droite
   (grille 1fr / auto / 1fr : le centre ne depend plus de la largeur des cotes). */
.wb-cockpit.cpt-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}
.wb-cockpit .cpt-left { justify-self: start; }
.wb-cockpit .cpt-center { justify-self: center; }
.wb-cockpit .cpt-right { justify-self: end; }
@media (max-width: 900px) {
    .wb-cockpit.cpt-toolbar { display: flex; }
    .wb-cockpit .cpt-left, .wb-cockpit .cpt-center, .wb-cockpit .cpt-right { justify-self: auto; }
}

/* ── Fenetre d'import (style cockpit : carte, bordure fine, rayon 12) ── */
.wb-import-modal { max-width: 660px !important; border-radius: 12px !important; }
.wb-import-modal .wb-modal-header { padding: 0.9rem 1.1rem; }
.wb-import-modal .wb-modal-header h3 { font-size: 0.98rem; }
.wb-import-modal .wb-modal-body { padding: 1rem 1.1rem; gap: 0.9rem; }
.wb-import-modal .wb-modal-footer { padding: 0.75rem 1.1rem; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border-color); }
.wb-import-error { display: flex; gap: 6px; align-items: center; margin: 0; padding: 8px 10px; border: 1px solid var(--danger); border-radius: 8px; background: var(--bg-badge-danger); color: var(--text-badge-danger); font-size: 0.82rem; }
.wb-import-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.wb-import-source { position: relative; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); color: var(--text-main); font: inherit; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03); }
.wb-import-source:hover, .wb-import-source:focus-within { border-color: var(--primary); background: var(--bg-hover); }
.wb-import-source i { font-size: 1.3rem; color: var(--primary); }
.wb-import-source span { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }
.wb-import-source input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.wb-import-note { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.wb-import-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wb-import-summary > div { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); }
.wb-import-summary strong { font-size: 1.15rem; color: var(--text-main); line-height: 1.2; }
.wb-import-summary span { font-size: 0.7rem; color: var(--text-muted); }
.wb-import-summary > div.warn { border-color: var(--warning); background: var(--bg-badge-warning); }
.wb-import-section-title { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.wb-import-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; max-height: 170px; overflow: auto; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); }
.wb-import-folder { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-main); cursor: pointer; }
.wb-import-folder span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-import-folder em { font-style: normal; font-size: 0.7rem; color: var(--text-muted); background: var(--bg-hover); border-radius: 999px; padding: 0 6px; }
.wb-import-radio { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-main); margin-bottom: 2px; cursor: pointer; }
.wb-import-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--text-muted); }
.wb-import-list i { margin-right: 4px; }
.wb-import-list code { color: var(--text-main); font-family: ui-monospace, Menlo, Consolas, monospace; }
.wb-import-progress { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0; color: var(--text-main); }
.wb-import-progress i { font-size: 1.8rem; color: var(--primary); }
.wb-import-spin { animation: wb-import-rotate 1s linear infinite; }
@keyframes wb-import-rotate { to { transform: rotate(360deg); } }
.wb-import-bar { width: 100%; height: 6px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; }
.wb-import-bar span { display: block; height: 100%; background: var(--primary); transition: width 0.2s; }
@media (max-width: 600px) { .wb-import-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Barre de mise en forme (style TextBlaze) : groupes, separateurs, emoji ── */
.wb-editor-toolbar { gap: 2px; flex-wrap: wrap; row-gap: 4px; }
.wb-tb-group { display: inline-flex; align-items: center; gap: 2px; }
.wb-editor-tb-divider { width: 1px; height: 18px; background: var(--border-color); margin: 0 6px; }
.wb-editor-tb-btn { width: 30px; height: 30px; font-size: 1rem; }
.wb-editor-mode-toggle { margin-left: auto; }
.wb-emoji-wrap { position: relative; display: inline-flex; }
.wb-emoji-pop {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(6, 34px); gap: 2px; padding: 6px;
    background: var(--bg-modal, var(--bg-card)); border: 1px solid var(--border-color); border-radius: 10px;
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0, 0, 0, 0.15));
}
.wb-emoji-btn { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; font-size: 1.15rem; cursor: pointer; }
.wb-emoji-btn:hover, .wb-emoji-btn:focus-visible { background: var(--bg-hover); outline: none; }
