/* ═══════════════════════════════════════════════════
   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: 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: #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);
}
