html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ============================================================
   Admin Layout — Header / Sidebar / Content
   ============================================================ */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --header-height: 56px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(37, 99, 235, 0.2);
    --sidebar-active-border: #2563eb;
    --sidebar-text: rgba(255, 255, 255, 0.65);
    --sidebar-text-active: #fff;
}

/* --- Top Header --- */

.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1030;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    white-space: nowrap;
}

.admin-brand:hover {
    color: #fff;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.35rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.admin-header-right {
    display: flex;
    align-items: center;
}

/* --- User Dropdown --- */

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.3rem 0.65rem 0.3rem 0.35rem;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.user-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-email {
    font-size: 0.85rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chevron {
    opacity: 0.6;
    flex-shrink: 0;
}

.user-dropdown-menu {
    min-width: 220px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0;
    margin-top: 0.35rem !important;
}

.user-dropdown-menu .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.user-dropdown-menu .dropdown-item:hover {
    background: #f1f5f9;
}

.user-dropdown-menu .dropdown-header {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #64748b;
}

/* --- Sidebar --- */

.admin-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    z-index: 1020;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin-bottom: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-active-border);
}

.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
}

.sidebar-footer {
    padding: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* --- Collapsed State --- */

.admin-body.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-collapsed-width);
}

.admin-body.sidebar-collapsed .sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.admin-body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    border-left-color: transparent;
}

.admin-body.sidebar-collapsed .sidebar-link.active {
    background: var(--sidebar-active);
}

.admin-body.sidebar-collapsed .admin-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* --- Tooltip on collapsed icons --- */

.admin-body.sidebar-collapsed .sidebar-link {
    position: relative;
}

.admin-body.sidebar-collapsed .sidebar-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-collapsed-width) - 4px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1040;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- Main Content --- */

.admin-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc;
}

.admin-content-inner {
    flex: 1;
    padding: 1.75rem 2rem;
}

.admin-footer {
    padding: 1rem 2rem;
    font-size: 0.8rem;
    border-top: 1px solid #e2e8f0;
}

/* --- Mobile Overlay --- */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1015;
}

/* --- Responsive --- */

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
        z-index: 1025;
    }

    .admin-body.sidebar-mobile-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-body.sidebar-mobile-open .sidebar-overlay {
        display: block;
    }

    .admin-body.sidebar-mobile-open .sidebar-label {
        opacity: 1 !important;
        width: auto !important;
    }

    .admin-content {
        margin-left: 0 !important;
    }
}

/* ============================================================
   Settings Pages
   ============================================================ */

.breadcrumb {
    font-size: 0.8rem;
}

.breadcrumb-item a {
    color: #2563eb;
}

.breadcrumb-item.active {
    color: #64748b;
}

.settings-tabs {
    border-bottom: 2px solid #e2e8f0;
}

.settings-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
    transition: color 0.15s, border-color 0.15s;
}

.settings-tabs .nav-link:hover {
    color: #0f172a;
    border-bottom-color: #cbd5e1;
    background: none;
}

.settings-tabs .nav-link.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: none;
}

.settings-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.settings-card-link:hover {
    color: inherit;
}

.settings-nav-card {
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.settings-nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

.settings-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #2563eb;
}

/* ============================================================
   User Avatar Variants
   ============================================================ */

.user-avatar-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-avatar-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: 1.5rem;
}

/* ============================================================
   Tables — Modern
   ============================================================ */

.data-table-wrap {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.data-table thead th {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    white-space: nowrap;
    border: none;
}

.data-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 14px 16px;
    vertical-align: middle;
    border: none;
}

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.status-active { background: #dcfce7; color: #15803d; }
.status-inactive { background: #f1f5f9; color: #64748b; }

/* Icon-only action button */
.icon-action {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s;
}

.icon-action:hover {
    color: #0f172a;
}

.icon-action-danger:hover {
    color: #ef4444;
}

/* ============================================================
   Dashboard Cards
   ============================================================ */

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

/* ============================================================
   Modals
   ============================================================ */

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

/* ============================================================
   Client Branding
   ============================================================ */

.branding-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
    flex-shrink: 0;
}

.branding-section-icon-brand {
    background: #f5f3ff;
    color: #7c3aed;
}

/* Color picker + hex input side by side */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-input-group .form-control-color {
    width: 42px;
    height: 38px;
    padding: 2px;
    flex-shrink: 0;
    border-radius: 8px;
    cursor: pointer;
}

.color-hex-input {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

/* Contrast validator card */
.contrast-validator-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.contrast-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f1f5f9;
    color: #64748b;
}

.contrast-aaa { background: #dcfce7; color: #15803d; }
.contrast-aa { background: #dbeafe; color: #1d4ed8; }
.contrast-aa-large { background: #fef9c3; color: #a16207; }
.contrast-fail { background: #fee2e2; color: #dc2626; }

/* Font previews */
.font-preview {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

/* Logo previews */
.logo-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 60px;
}

.logo-preview img {
    max-height: 48px;
    max-width: 200px;
    object-fit: contain;
}

.logo-preview-dark {
    background: #0f172a;
    border-color: #1e293b;
}

/* ============================================================
   Asset Library
   ============================================================ */

.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fff;
}

.drop-zone:hover,
.drop-zone-active {
    border-color: #2563eb;
    background: #eff6ff;
}

.drop-zone-content p { margin: 0; }

/* Bulk bar */
.bulk-bar {
    background: #0f172a;
    color: #fff;
    border-radius: 10px;
    padding: 0.6rem 1rem;
}

.bulk-bar .btn-outline-secondary {
    color: #fff;
    border-color: rgba(255,255,255,0.2);
    font-size: 0.75rem;
}

.bulk-bar .btn-outline-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
}

.bulk-bar .btn-outline-danger {
    font-size: 0.75rem;
}

.bulk-bar .form-control,
.bulk-bar .form-select {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 0.75rem;
}

.bulk-bar .form-control::placeholder { color: rgba(255,255,255,0.5); }

/* Asset card */
.asset-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.asset-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.asset-archived {
    opacity: 0.55;
}

.asset-checkbox-wrap {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
}

.asset-checkbox-wrap .form-check-input {
    width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #cbd5e1;
    cursor: pointer;
}

.asset-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.asset-thumb:hover img {
    transform: scale(1.05);
}

.asset-info {
    padding: 0.5rem 0.6rem;
}

.asset-filename {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.asset-tag-pill {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Upload queue items */
.upload-queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.upload-queue-item:last-child {
    border-bottom: none;
}

.upload-queue-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    background: #f1f5f9;
}

.upload-queue-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-queue-info {
    flex: 1;
    min-width: 0;
}

/* AI badge colors */
.bg-purple-light { background: #f3e8ff; }
.text-purple-dark { color: #7c3aed; }

/* ── Email Builder ── */

/* Top bar: actions row */
.eb-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.eb-topbar-actions-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.eb-topbar-actions-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Top bar: details row */
.eb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}
.eb-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}
.eb-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.eb-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #64748b;
    transition: all 0.15s;
    flex-shrink: 0;
}
.eb-back-btn:hover { background: #f1f5f9; color: #334155; }
.eb-subject-input {
    border: 1px solid transparent;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 180px;
    flex: 1;
    transition: all 0.15s;
}
.eb-subject-input:hover { border-color: #e2e8f0; background: #f8fafc; }
.eb-subject-input:focus { border-color: #4f6ef7; background: #fff; outline: none; box-shadow: 0 0 0 2px rgba(79,110,247,0.15); }
.eb-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.eb-status-draft { background: #f1f5f9; color: #64748b; }
.eb-status-scheduled { background: #dbeafe; color: #2563eb; }
.eb-status-sent { background: #dcfce7; color: #16a34a; }
.eb-date-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.eb-date-group label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    margin: 0;
}
.eb-date-group input[type="date"] {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    padding: 3px 6px;
    background: #fff;
}
.eb-date-group input[type="date"]:focus { border-color: #4f6ef7; outline: none; }
.eb-topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.eb-topbar-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.eb-topbar-divider { width: 1px; height: 20px; background: #e2e8f0; }
.eb-btn-schedule { color: #2563eb; border-color: #93c5fd; }
.eb-btn-schedule:hover { background: #eff6ff; }
.eb-btn-send { background: #16a34a; color: #fff; border-color: #16a34a; }
.eb-btn-send:hover { background: #15803d; }
.eb-btn-listrak { color: #7c3aed; border-color: #c4b5fd; }
.eb-btn-listrak:hover { background: #f5f3ff; }
.eb-btn-approval { color: #ea580c; border-color: #fdba74; }
.eb-btn-approval:hover { background: #fff7ed; }
.eb-status-pending { background: #fff7ed; color: #ea580c; }

/* Main wrapper */
.eb-wrapper {
    display: flex;
    gap: 0;
    height: calc(100vh - 140px);
    min-height: 500px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

/* Palette */
.eb-palette {
    width: 200px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 12px;
}
.eb-palette-section { margin-bottom: 12px; }
.eb-palette-section-head {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    padding: 0 4px 6px;
}
.eb-palette-items { display: flex; flex-direction: column; gap: 3px; }
.eb-palette-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.15s;
    user-select: none;
    border: 1px solid transparent;
}
.eb-palette-item:hover {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.eb-palette-item:active { cursor: grabbing; transform: scale(0.97); }
.eb-palette-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #4f6ef7;
    flex-shrink: 0;
}
.eb-palette-item:hover .eb-palette-icon { background: #eef2ff; border-color: #c7d2fe; }
.eb-palette-label { font-size: 13px; font-weight: 500; color: #334155; }

/* Canvas area */
.eb-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f1f5f9;
}

/* Toolbar */
.eb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.eb-toolbar-group { display: flex; align-items: center; gap: 2px; }
.eb-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
}
.eb-tool-btn:hover:not(:disabled) { background: #f1f5f9; color: #334155; }
.eb-tool-btn:disabled { opacity: 0.35; cursor: default; }
.eb-tool-btn.active { background: #eef2ff; color: #4f6ef7; border-color: #c7d2fe; }
.eb-save-btn { background: #4f6ef7; color: #fff !important; border-color: #4f6ef7; }
.eb-save-btn:hover:not(:disabled) { background: #4361ee !important; }

/* Canvas scroll area */
.eb-canvas-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    justify-content: center;
}
.eb-canvas {
    width: 100%;
    max-width: 660px;
    transition: max-width 0.3s ease;
}
.eb-canvas-inner {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    min-height: 200px;
    overflow: hidden;
}

/* Empty state */
.eb-empty-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.eb-empty-icon { margin-bottom: 16px; opacity: 0.5; }
.eb-empty-title { font-size: 16px; font-weight: 600; color: #64748b; margin: 0 0 4px; }
.eb-empty-desc { font-size: 13px; color: #94a3b8; margin: 0; }

/* Canvas blocks */
.eb-block {
    position: relative;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
}
.eb-block:hover { border-color: rgba(79,110,247,0.3); }
.eb-block.is-selected { border-color: #4f6ef7; }
.eb-block.is-dragging { opacity: 0.4; }
.eb-block.drop-above { border-top: 3px solid #4f6ef7; }
.eb-block.drop-below { border-bottom: 3px solid #4f6ef7; }

.eb-block-content {
    pointer-events: none;
    overflow: hidden;
}
.eb-block-content table { width: 100%; }
.eb-block-content img { max-width: 100%; height: auto; }

/* Block overlay */
.eb-block-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 2;
    height: 0;
}
.eb-block:hover .eb-block-overlay,
.eb-block.is-selected .eb-block-overlay {
    opacity: 1;
    pointer-events: auto;
}
.eb-block-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: #4f6ef7;
    padding: 2px 8px;
    border-radius: 0 0 6px 6px;
    white-space: nowrap;
}
.eb-block-label-icon { display: flex; align-items: center; }
.eb-block-label-icon svg { stroke: #fff; }
.eb-block-actions {
    margin-left: auto;
    display: flex;
    gap: 1px;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.15s;
}
.eb-block:hover .eb-block-actions,
.eb-block.is-selected .eb-block-actions { opacity: 1; }
.eb-act-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.1s;
}
.eb-act-btn:hover { background: #f1f5f9; color: #334155; }
.eb-act-btn-danger:hover { background: #fef2f2; color: #dc2626; }

.eb-drag-handle {
    display: flex;
    align-items: center;
    padding: 2px;
    color: #fff;
    background: #4f6ef7;
    border-radius: 0 0 4px 0;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s;
}
.eb-block:hover .eb-drag-handle { opacity: 1; }
.eb-drag-handle:active { cursor: grabbing; }

/* Settings panel */
.eb-settings {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.eb-settings-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    flex: 1;
}
.eb-settings-empty-title { font-size: 14px; font-weight: 600; color: #64748b; margin: 12px 0 4px; }
.eb-settings-empty-desc { font-size: 12px; color: #94a3b8; margin: 0; }

.eb-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.eb-settings-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.eb-settings-icon { display: flex; align-items: center; color: #4f6ef7; }
.eb-settings-title { font-size: 14px; font-weight: 600; color: #1e293b; }
.eb-settings-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
}
.eb-settings-close:hover { background: #f1f5f9; color: #64748b; }

.eb-settings-body { padding: 0; flex: 1; overflow-y: auto; }

/* Settings sections */
.eb-settings-section { border-bottom: 1px solid #f1f5f9; }
.eb-settings-section-head {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    padding: 12px 16px 6px;
}
.eb-settings-section-body { padding: 4px 16px 12px; }

/* Setting controls */
.eb-setting { margin-bottom: 10px; }
.eb-setting:last-child { margin-bottom: 0; }
.eb-setting-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 4px;
}
.eb-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.15s;
}
.eb-input:focus { border-color: #4f6ef7; outline: none; box-shadow: 0 0 0 2px rgba(79,110,247,0.1); }
textarea.eb-input { resize: vertical; font-family: inherit; }
select.eb-input { cursor: pointer; }

/* Color picker */
.eb-color-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}
.eb-color-picker {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
}
.eb-color-hex {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: monospace;
}
.eb-color-hex:focus { border-color: #4f6ef7; outline: none; }

/* Alignment group */
.eb-align-group {
    display: flex;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.eb-align-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background: #fff;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}
.eb-align-btn:not(:last-child) { border-right: 1px solid #e2e8f0; }
.eb-align-btn:hover { background: #f8fafc; color: #64748b; }
.eb-align-btn.active { background: #eef2ff; color: #4f6ef7; }

/* Range slider */
.eb-range-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.eb-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    outline: none;
}
.eb-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4f6ef7;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.eb-range-value {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    min-width: 40px;
    text-align: right;
    white-space: nowrap;
}

/* Toggle */
.eb-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.eb-toggle-wrap .eb-setting-label { margin-bottom: 0; }
.eb-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}
.eb-toggle input { opacity: 0; width: 0; height: 0; }
.eb-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 20px;
    transition: all 0.2s;
}
.eb-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.eb-toggle input:checked + .eb-toggle-slider { background: #4f6ef7; }
.eb-toggle input:checked + .eb-toggle-slider::before { transform: translateX(16px); }

/* Code editor */
.eb-code-editor {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #1e293b;
    background: #f8fafc;
    resize: vertical;
    tab-size: 2;
}
.eb-code-editor:focus { border-color: #4f6ef7; outline: none; background: #fff; }

/* HTML block WYSIWYG toolbar */
.eb-html-visual-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px 6px 0 0;
    border-bottom: none;
    margin-bottom: -1px;
}
.eb-wysiwyg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    padding: 0;
}
.eb-wysiwyg-btn:hover { background: #e2e8f0; color: #1e293b; }
.eb-wysiwyg-sep {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    margin: 4px 3px;
}
.eb-html-visual-editor { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; }
.eb-html-visual-editor img { max-width: 100%; height: auto; }
.eb-html-visual-editor a { color: #2563eb; }

/* Settings button */
.eb-setting-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}
.eb-setting-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.eb-btn-primary { background: #4f6ef7; color: #fff; border-color: #4f6ef7; }
.eb-btn-primary:hover { background: #4361ee; }

/* Products in settings */
.eb-products-manager { margin-top: 4px; }
.eb-product-add {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.eb-product-add .eb-input { flex: 1; font-size: 12px; padding: 5px 8px; }
.eb-product-list { display: flex; flex-direction: column; gap: 4px; }
.eb-product-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.eb-product-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.eb-product-thumb-empty {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #e2e8f0;
    flex-shrink: 0;
}
.eb-product-info { flex: 1; min-width: 0; }
.eb-product-name { display: block; font-size: 12px; font-weight: 500; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-product-price { font-size: 11px; color: #64748b; }
.eb-product-remove {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    flex-shrink: 0;
}
.eb-product-remove:hover { background: #fef2f2; color: #dc2626; }
.eb-product-empty { font-size: 12px; color: #94a3b8; font-style: italic; margin: 4px 0 0; }
.eb-product-hint { font-size: 11px; color: #94a3b8; margin: 6px 0 0; }
.eb-block-product-remove {
    background: none; border: none; color: #94a3b8; cursor: pointer;
    font-size: 18px; line-height: 1; padding: 2px 4px; flex-shrink: 0;
    border-radius: 4px; transition: all 0.15s;
}
.eb-block-product-remove:hover { background: #fef2f2; color: #dc2626; }

/* Asset Picker */
.eb-asset-picker { margin-top: 4px; }
.eb-asset-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    max-height: 200px; overflow-y: auto; padding: 2px;
}
.eb-asset-item {
    border: 2px solid #e2e8f0; border-radius: 6px; overflow: hidden;
    cursor: pointer; transition: all 0.15s; aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    background: #f8fafc;
}
.eb-asset-item:hover { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
.eb-asset-item img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Modal */
.eb-modal-overlay {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
}
.eb-modal {
    background: #fff; border-radius: 12px; width: 90%; max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: ebModalIn 0.2s ease-out;
}
@keyframes ebModalIn { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: none; } }
.eb-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e2e8f0;
}
.eb-modal-title {
    margin: 0; font-size: 16px; font-weight: 600; color: #1e293b;
    display: flex; align-items: center; gap: 8px;
}
.eb-modal-close {
    background: none; border: none; font-size: 22px; color: #94a3b8;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.eb-modal-close:hover { color: #334155; }
.eb-modal-body { padding: 20px; }
.eb-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 20px; border-top: 1px solid #e2e8f0;
}

/* Toast */
.eb-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 8px 20px;
    background: #1e293b;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.eb-toast-show { transform: translateX(-50%) translateY(0); }
.eb-toast-error { background: #dc2626; }

/* Responsive */
@media (max-width: 1100px) {
    .eb-wrapper { flex-direction: column; height: auto; }
    .eb-palette { width: 100%; border-right: 0; border-bottom: 1px solid #e5e7eb; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 8px; }
    .eb-palette-section { margin-bottom: 0; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
    .eb-palette-section-head { padding: 0 8px; }
    .eb-palette-items { flex-direction: row; gap: 3px; }
    .eb-settings { width: 100%; border-left: 0; border-top: 1px solid #e5e7eb; max-height: 400px; }
    .eb-canvas-area { min-height: 500px; }
}
