/* =====================================================
   ADMIN PANEL — Construir Portugal
   Uses existing design tokens from global.css
   ===================================================== */

/* ==================== LEADS TABLE ==================== */
.lead-tipo-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-600);
    white-space: nowrap;
    line-height: 1.4;
}

.lead-notas-icon {
    display: inline-flex;
    align-items: center;
    color: var(--gray-400);
    cursor: default;
}

.lead-notas-icon:hover {
    color: var(--primary);
}

/* ==================== LAYOUT ==================== */
.admin-body {
    margin: 0;
    padding: 0;
    background: var(--gray-50);
    min-height: 100vh;
}

.admin-shell {
    min-height: 100vh;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 40%, var(--orange-700) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(209, 124, 43, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(33, 53, 119, 0.2) 0%, transparent 50%);
    animation: loginBgPulse 15s ease-in-out infinite alternate;
}

@keyframes loginBgPulse {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-5%, -5%) scale(1.1);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 440px;
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: loginCardEntry 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loginCardEntry {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    background: linear-gradient(135deg, var(--orange-500) 0%, var(--orange-700) 100%);
    padding: 40px 32px 32px;
    text-align: center;
}

.login-logo {
    height: 48px;
    margin-bottom: 16px;
    filter: brightness(0) invert(1);
}

.login-header h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: white;
    margin: 0 0 4px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin: 0;
}

.login-form {
    padding: 32px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-family: var(--font-body);
}

.login-form .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: all var(--transition-fast);
    background: var(--gray-50);
    color: var(--gray-900);
    box-sizing: border-box;
}

.login-form .form-input:focus {
    outline: none;
    border-color: var(--orange-500);
    background: white;
    box-shadow: 0 0 0 4px rgba(209, 124, 43, 0.1);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    display: flex;
}

.password-toggle:hover {
    color: var(--gray-600);
}

.login-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--error);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border-radius: var(--radius-md);
    justify-content: center;
}

.login-btn.loading span {
    opacity: 0;
}

.login-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== SIDEBAR ==================== */
.admin-sidebar {
    width: 256px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base), width var(--transition-base);
    box-shadow: 1px 0 0 #e5e7eb, 4px 0 16px rgba(0,0,0,0.04);
}

.admin-shell.sidebar-collapsed .admin-sidebar {
    transform: translateX(-100%);
}

/* ── Header ── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 12px;
    border-bottom: 1px solid #f3f4f6;
    background: white;
    flex-shrink: 0;
}

.sidebar-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: white;
    background: var(--orange-500);
    padding: 3px 8px;
    border-radius: 5px;
    line-height: 1.4;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    border-radius: 6px;
    flex-shrink: 0;
}

.sidebar-close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* ── Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 8px 8px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-group-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 14px 8px 4px;
}

.nav-group-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #f3f4f6;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.855rem;
    font-family: var(--font-body);
    transition: background 0.12s, color 0.12s;
    position: relative;
    cursor: pointer;
}

.sidebar-nav .nav-item:hover {
    background: #f9f5f0;
    color: #1f2937;
}

.sidebar-nav .nav-item:hover svg {
    stroke: var(--orange-500);
    opacity: 1;
}

.sidebar-nav .nav-item.active {
    background: linear-gradient(135deg, var(--blue-900, #0f1a38) 0%, var(--blue-700, #192752) 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(15, 26, 56, 0.3);
    border-left: 3px solid var(--orange-500, #d17c2b);
}

.sidebar-nav .nav-item.active svg {
    stroke: white;
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 0.67rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
    line-height: 1.5;
}

.nav-item.active .sidebar-badge {
    background: rgba(255,255,255,0.3);
    color: white;
}

.sidebar-nav .nav-item svg {
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity 0.12s, stroke 0.12s;
}

.sidebar-nav .nav-item > span:not(.sidebar-badge):not([id]) {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Sidebar nav-item tooltip (renderizado no body via JS) ── */
#sidebar-tooltip {
    position: fixed;
    background: #111827;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 230px;
    white-space: normal;
    box-shadow: 0 4px 20px rgba(0,0,0,0.22);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

#sidebar-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* seta à esquerda do balão */
#sidebar-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #111827;
}

body[data-admin-theme="dark"] #sidebar-tooltip {
    background: #f3f4f6;
    color: #111827;
}
body[data-admin-theme="dark"] #sidebar-tooltip::before {
    border-right-color: #f3f4f6;
}

.sidebar-footer {
    padding: 10px 8px;
    border-top: 1px solid #f3f4f6;
    background: white;
    flex-shrink: 0;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
}

.admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-700, #192752), var(--blue-900, #0f1a38));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.admin-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.admin-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.admin-role {
    font-size: 0.65rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-top: 1px;
}

.logout-btn-sidebar {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 10px;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--font-body);
    font-weight: 500;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.logout-btn-sidebar:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.logout-btn-sidebar:hover svg {
    stroke: #dc2626;
}

/* ==================== MAIN CONTENT ==================== */
.admin-main {
    flex: 1;
    min-width: 0;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: all var(--transition-base);
    background: var(--gray-50);
}

.admin-shell.sidebar-collapsed .admin-main {
    margin-left: 0;
}

/* ==================== TOPBAR ==================== */
.admin-topbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: flex;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--gray-100);
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    min-width: 240px;
    transition: all var(--transition-fast);
}

.topbar-search:focus-within {
    border-color: var(--orange-300);
    box-shadow: 0 0 0 3px rgba(209, 124, 43, 0.1);
    background: white;
}

.topbar-search svg {
    color: var(--gray-400);
    flex-shrink: 0;
}

.topbar-search input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--gray-800);
    width: 100%;
}

.topbar-search input::placeholder {
    color: var(--gray-400);
}

/* ==================== CONTENT AREA ==================== */
.admin-content {
    padding: 28px;
    flex: 1;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--gray-400);
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--orange-500);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ==================== KPI CARDS ==================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--orange-200);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.kpi-card.orange::before {
    background: linear-gradient(90deg, var(--orange-500), var(--orange-300));
}

.kpi-card.blue::before {
    background: linear-gradient(90deg, var(--blue-500), var(--blue-300));
}

.kpi-card.green::before {
    background: linear-gradient(90deg, var(--success), #6ee7b7);
}

.kpi-card.red::before {
    background: linear-gradient(90deg, var(--error), #fca5a5);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.kpi-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-500);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon.orange {
    background: var(--orange-50);
    color: var(--orange-600);
}

.kpi-icon.blue {
    background: var(--blue-50);
    color: var(--blue-500);
}

.kpi-icon.green {
    background: var(--success-light);
    color: var(--success-dark);
}

.kpi-icon.red {
    background: #fee2e2;
    color: var(--error);
}

.kpi-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 4px;
}

.kpi-trend {
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.up {
    color: var(--success);
}

.kpi-trend.down {
    color: var(--error);
}

.kpi-sub {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.kpi-card.clickable {
    cursor: pointer;
}

/* ── Page toolbar (search + action buttons) ── */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.page-toolbar .topbar-search {
    flex: 1;
    min-width: 200px;
    max-width: 420px;
}

.toolbar-advanced {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}

.toolbar-count {
    margin-left: auto;
    color: var(--gray-500);
    font-size: 0.85rem;
    font-weight: 600;
    align-self: center;
}

/* ── Pill tab switcher (Email Marketing header) ── */
.pill-tabs {
    display: flex;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.pill-tab {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    color: var(--gray-500);
    white-space: nowrap;
}

.pill-tab.active {
    background: white;
    color: var(--gray-900);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.section-page-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    flex: 1;
    min-width: 120px;
}

.kpi-value-sm {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
    margin-bottom: 4px;
}

/* ── CRM estado tabs ── */
.crm-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: 0 20px;
    border-bottom: 2px solid var(--gray-100);
    scrollbar-width: none;
}

.crm-tabs::-webkit-scrollbar { display: none; }

.crm-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 14px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 0.875rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.crm-tab:hover { color: var(--gray-800); }

.crm-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.crm-tab-count {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    background: var(--gray-100);
    color: var(--gray-600);
}

.crm-tab.active .crm-tab-count {
    background: rgba(var(--primary-rgb, 249,115,22), 0.12);
    color: var(--primary);
}

/* ── Dashboard layout ── */
.dash-section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    margin-top: 8px;
}

.dash-section-label-text {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    white-space: nowrap;
}

.dash-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-100);
}

.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.dash-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.dash-bottom .admin-card {
    margin-bottom: 0;
}

.dash-quick-actions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-quick-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-700);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-base);
}

.dash-quick-action-btn:hover {
    background: #f9f5f0;
    border-color: var(--orange-200);
    color: var(--gray-900);
}

.dash-quick-action-btn svg {
    color: var(--gray-400);
    flex-shrink: 0;
    transition: color var(--transition-base);
}

.dash-quick-action-btn:hover svg {
    color: var(--orange-500);
}

.dash-quick-action-badge {
    margin-left: auto;
    background: var(--error);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

/* ==================== DATA CARDS ==================== */
.admin-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--gray-100);
    margin-bottom: 24px;
    overflow: hidden;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
    gap: 12px;
}

.admin-card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.admin-card-body {
    padding: 24px;
}

.admin-card-body.no-padding {
    padding: 0;
}

/* ==================== DATA TABLES ==================== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: var(--gray-50);
}

.admin-table th {
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background var(--transition-fast);
}

.admin-table tbody tr:hover {
    background: var(--gray-100);
}

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

/* Table cell helpers */
.cell-bold {
    font-weight: 600;
    color: var(--gray-800);
}

.cell-muted {
    font-size: 0.82rem;
    color: var(--gray-500);
}

.cell-mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--gray-500);
}

.cell-truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-clickable {
    cursor: pointer;
}

.table-empty-cell {
    padding: 24px !important;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.85rem;
}

.status-dot-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

/* ==================== STATUS BADGES ==================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.processing {
    background: var(--blue-50);
    color: var(--blue-700);
}

.status-badge.completed {
    background: var(--success-light);
    color: var(--success-dark);
}

.status-badge.cancelled {
    background: #fee2e2;
    color: var(--error-dark);
}

.status-badge.accepted {
    background: var(--success-light);
    color: var(--success-dark);
}

.status-badge.rejected {
    background: #fee2e2;
    color: var(--error-dark);
}

.status-badge.reviewed {
    background: var(--blue-50);
    color: var(--blue-700);
}

.status-badge.fulfilled {
    background: var(--success-light);
    color: var(--success-dark);
}

.status-badge.expired {
    background: var(--gray-100);
    color: var(--gray-500);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-badge.pending .status-dot {
    background: #f59e0b;
}

.status-badge.processing .status-dot {
    background: var(--blue-500);
}

.status-badge.completed .status-dot,
.status-badge.accepted .status-dot,
.status-badge.fulfilled .status-dot {
    background: var(--success);
}

.status-badge.cancelled .status-dot,
.status-badge.rejected .status-dot {
    background: var(--error);
}

.status-badge.reviewed .status-dot {
    background: var(--blue-500);
}

.status-badge.expired .status-dot {
    background: var(--gray-400);
}

/* ==================== ACTION BUTTONS ==================== */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: var(--gray-500);
}

.action-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.action-btn.edit:hover {
    background: var(--blue-50);
    color: var(--blue-700);
}

.action-btn.delete:hover {
    background: #fee2e2;
    color: var(--error);
}

.action-btn.view:hover {
    background: var(--orange-50);
    color: var(--orange-600);
}

.actions-cell {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

/* Small buttons */
.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    padding: 8px 14px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ==================== FILTERS BAR ==================== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font-body);
    color: var(--gray-700);
    background: white;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--orange-300);
}

.form-field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    font-family: var(--font-body);
}

.filter-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: white;
    min-width: 200px;
    transition: border-color var(--transition-fast);
}

.filter-search:focus-within {
    border-color: var(--orange-300);
}

.filter-search input {
    border: none;
    outline: none;
    font-size: 0.85rem;
    font-family: var(--font-body);
    color: var(--gray-800);
    width: 100%;
    background: none;
}

.filter-search svg {
    color: var(--gray-400);
    flex-shrink: 0;
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-600);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--orange-300);
    color: var(--orange-600);
}

.pagination-btn.active {
    background: var(--orange-500);
    border-color: var(--orange-500);
    color: white;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.confirm-modal {
    background: white;
    border-radius: var(--radius-xl);
    padding: 40px 32px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-2xl);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.confirm-icon {
    margin-bottom: 16px;
}

.confirm-modal h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.confirm-modal p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 0 0 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 120px;
}

/* ==================== EDITOR PANEL (Slide-in) ==================== */
.editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.4);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.editor-overlay.show {
    display: block;
    opacity: 1;
}

.editor-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 680px;
    max-width: 100%;
    height: 100vh;
    background: white;
    z-index: 201;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.editor-panel.show {
    transform: translateX(0);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.editor-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.editor-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.editor-close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.editor-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

/* ── Editor Sections ── */
.editor-section {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.editor-section:last-child {
    margin-bottom: 0;
}

.editor-section > .form-row,
.editor-section > .form-group,
.editor-section > .image-gallery,
.editor-section > .image-upload-zone,
.editor-section > .grouping-related-chips,
.editor-section > div[style],
.editor-section > p {
    padding-left: 16px;
    padding-right: 16px;
}

.editor-section > .form-row:last-child,
.editor-section > .form-group:last-child {
    padding-bottom: 16px;
}

.editor-section > .image-gallery { padding-top: 0; }
.editor-section > .image-upload-zone { margin-bottom: 12px; }

.editor-section-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.editor-section-header svg {
    opacity: 0.6;
    flex-shrink: 0;
}

.editor-section-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--gray-200);
    color: var(--gray-600);
    padding: 1px 6px;
    border-radius: 10px;
    letter-spacing: 0;
    text-transform: none;
}

.editor-toggles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px 20px;
    padding: 14px 16px;
}

/* ==================== FORM ELEMENTS ==================== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row.full {
    grid-template-columns: 1fr;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--gray-600);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Info icon com tooltip nos labels do formulário ── */
.label-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--gray-300);
    color: var(--gray-600);
    font-size: 0.65rem;
    font-weight: 700;
    font-style: normal;
    cursor: default;
    vertical-align: middle;
    margin-left: 5px;
    text-transform: none;
    letter-spacing: 0;
    flex-shrink: 0;
}

/* Tooltip flutuante ancorado ao body via JS */
#admin-label-tooltip {
    position: fixed;
    background: #1f2937;
    color: #f9fafb;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: pre-line;
    width: 240px;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.15s ease;
}

#admin-label-tooltip.visible {
    opacity: 1;
}

#admin-label-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--gray-800);
    transition: all var(--transition-fast);
    background: white;
    box-sizing: border-box;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--orange-500);
    box-shadow: 0 0 0 3px rgba(209, 124, 43, 0.08);
}

.form-input:disabled {
    background: var(--gray-50);
    color: var(--gray-400);
}

.form-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-fast);
    cursor: pointer;
    border: none;
    padding: 0;
}

.toggle-switch::after {
    content: '';
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active {
    background: var(--success);
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* ==================== IMAGE GALLERY ==================== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.image-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--gray-200);
    aspect-ratio: 1;
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
}

.image-item img {
    width: 100%;
    flex: 1;
    object-fit: cover;
    min-height: 0;
}

/* Label below image (Principal / Imagem A …) */
.image-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-align: center;
    color: var(--gray-500);
    padding: 3px 4px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-item .image-actions {
    position: absolute;
    top: 0; left: 0; right: 0;
    /* Only covers the image part, not the label */
    bottom: 26px;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.image-item:hover .image-actions {
    opacity: 1;
}

/* Unified button style for image actions */
.img-action-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    border: none;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    transition: all var(--transition-fast);
}

.img-action-btn.download-img:hover {
    background: var(--blue-600);
    color: white;
}

.img-action-btn.delete-img:hover {
    background: var(--error);
    color: white;
}

/* Drag handle on image cards */
.img-drag-handle {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.45);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: grab;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.15s;
}
.image-item:hover .img-drag-handle { opacity: 1; }
.image-item[draggable] { cursor: default; }

/* Highlight the principal image card */
.image-item-principal {
    border: 2px solid var(--orange-400) !important;
    position: relative;
}
.image-item-principal::before {
    content: "Principal";
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--orange-500);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    z-index: 2;
    pointer-events: none;
}

/* Legacy selector — keep for backward compat */
.image-actions button {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    border: none;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    transition: all var(--transition-fast);
}

.image-actions .delete-img:hover {
    background: var(--error);
    color: white;
}

.image-upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--gray-50);
}

.image-upload-zone:hover {
    border-color: var(--orange-300);
    background: var(--orange-50);
}

.image-upload-zone svg {
    color: var(--gray-400);
    margin-bottom: 8px;
}

.image-upload-zone p {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin: 0;
}

/* ==================== TOAST ==================== */
.admin-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    font-weight: 600;
    font-size: 0.9rem;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.admin-toast.show {
    display: flex;
}

.admin-toast.error {
    background: linear-gradient(135deg, var(--error) 0%, var(--error-dark) 100%);
}

.admin-toast.loading {
    background: linear-gradient(135deg, var(--orange-500, #f97316) 0%, var(--orange-600, #ea580c) 100%);
    font-size: 1rem;
    padding: 16px 28px;
    min-width: 240px;
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.35);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--gray-500);
    margin: 0 0 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin: 0;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-close-btn {
        display: flex;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-shell.sidebar-collapsed .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-shell.sidebar-collapsed .admin-main {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .admin-content {
        padding: 16px;
    }

    .admin-topbar {
        padding: 0 16px;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .kpi-card {
        padding: 16px;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .dash-kpi-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .dash-bottom {
        grid-template-columns: 1fr 1fr;
    }

    .dash-bottom > *:last-child {
        grid-column: 1 / -1;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .topbar-search {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .editor-panel {
        width: 100%;
    }

    .admin-table {
        font-size: 0.85rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search {
        min-width: unset;
    }

    .pagination {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .dash-kpi-row {
        grid-template-columns: 1fr;
    }

    .dash-bottom {
        grid-template-columns: 1fr;
    }

    .dash-bottom > *:last-child {
        grid-column: unset;
    }

    .login-card {
        border-radius: var(--radius-lg);
    }

    .login-header {
        padding: 28px 24px 24px;
    }

    .login-form {
        padding: 24px;
    }

    .confirm-actions {
        flex-direction: column;
    }
}

/* ==================== SCROLLBAR ==================== */
.admin-content::-webkit-scrollbar,
.editor-body::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.admin-content::-webkit-scrollbar-track,
.editor-body::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.admin-content::-webkit-scrollbar-thumb,
.editor-body::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.admin-content::-webkit-scrollbar-thumb:hover,
.editor-body::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ==================== TABLE RESPONSIVE WRAPPER ==================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* ==================== CHART CONTAINERS ==================== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== TAB NAVIGATION ==================== */
.tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-100);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.tab-btn:hover {
    color: var(--gray-700);
}

.tab-btn.active {
    color: var(--orange-600);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--orange-500);
    border-radius: 2px 2px 0 0;
}

/* ==================== DRAG & DROP ORDERING ==================== */
.drag-handle-th {
    width: 32px;
    padding: 0 !important;
}

.drag-handle-cell {
    width: 32px;
    padding: 0 8px !important;
    color: var(--gray-300);
    cursor: grab;
    text-align: center;
}

.draggable-row {
    cursor: default;
    transition: background 0.15s;
}

.draggable-row:hover {
    background: var(--gray-100, #f3f4f6) !important;
}

.draggable-group-row:hover {
    background: #fde8c8 !important;
}

.draggable-row.dragging {
    opacity: 0.35;
    cursor: grabbing;
}

/* Drop position indicator — orange line before or after the target row */
.draggable-row.drag-line-before > td {
    box-shadow: inset 0 3px 0 var(--orange-500, #f97316);
}

.draggable-row.drag-line-after > td {
    box-shadow: inset 0 -3px 0 var(--orange-500, #f97316);
}

/* Category pills in table */
.category-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: var(--blue-50);
    color: var(--blue-700);
    margin-right: 4px;
    white-space: nowrap;
}

.category-pill.subfamilia {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ==================== CATEGORIES MANAGER ==================== */
.categories-tree {
    padding: 20px 24px;
    min-height: 200px;
}

.cat-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cat-node {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.cat-node.cat-inactive {
    opacity: 0.5;
}

.cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    gap: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cat-row:hover {
    border-color: var(--orange-300);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.cat-node.level-1 > .cat-row {
    background: var(--blue-50);
    border-color: var(--blue-200);
    font-weight: 600;
}

.cat-node.level-2 > .cat-row {
    background: white;
    border-color: var(--gray-200);
}

.cat-node.level-3 > .cat-row {
    background: var(--gray-50);
    border-color: var(--gray-150, #e8e8e8);
}

.cat-node.level-4 > .cat-row {
    background: var(--gray-50);
    border-color: var(--gray-100);
    font-size: 0.85rem;
}

.cat-children {
    margin-left: 28px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 12px;
    border-left: 2px solid var(--gray-100);
}

.cat-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.cat-level-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--gray-200);
    color: var(--gray-600);
    flex-shrink: 0;
    font-family: var(--font-mono);
}

.cat-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-icon-tag {
    font-size: 0.7rem;
    color: var(--gray-400);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.cat-ordem {
    font-size: 0.72rem;
    color: var(--orange-500);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.cat-slug-badge {
    font-size: 0.67rem;
    font-family: var(--font-mono);
    color: var(--gray-400);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.cat-inactive-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--gray-200);
    color: var(--gray-500);
}

.cat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ==================== CATALOG PREVIEW ==================== */
.preview-l1-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.preview-l1-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
    min-width: 120px;
}

.preview-l1-card:hover {
    border-color: var(--orange-400);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.preview-l1-card.active {
    border-color: var(--orange-500);
    background: var(--orange-50, #fff7ed);
}

.preview-l1-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.preview-subnav {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.preview-subnav-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    margin: 0 0 10px;
}

.preview-subnav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-subnav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-body);
    color: var(--gray-700);
    transition: all 0.12s;
}

.preview-subnav-btn:hover {
    border-color: var(--orange-400);
    color: var(--orange-700);
}

.preview-subnav-btn.active {
    background: var(--orange-500);
    border-color: var(--orange-500);
    color: white;
}

.preview-count {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.08);
}

.preview-subnav-btn.active .preview-count {
    background: rgba(255,255,255,0.25);
}

.preview-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.preview-bc-btn {
    background: none;
    border: none;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--orange-600);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.1s;
}

.preview-bc-btn:hover { background: var(--orange-50, #fff7ed); }
.preview-bc-btn.active { color: var(--gray-600); cursor: default; font-weight: 600; }

.preview-bc-sep { color: var(--gray-300); font-size: 1.1rem; }

.preview-products-header {
    font-size: 0.82rem;
    color: var(--gray-400);
    margin-bottom: 12px;
    font-weight: 500;
}

.preview-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.preview-product-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.12s;
}

.preview-product-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.preview-product-img {
    height: 110px;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-product-img.no-img,
.preview-product-img:has(.no-img-icon) {
    color: var(--gray-300);
}

.no-img-icon {
    color: var(--gray-300);
}

.preview-product-info {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.preview-product-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.3;
}

.preview-product-ref {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--gray-400);
}

.preview-destaque-badge {
    font-size: 0.65rem;
    color: var(--orange-600);
    font-weight: 600;
}

.preview-ordem-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(0,0,0,0.55);
    color: white;
}

.preview-more {
    grid-column: 1 / -1;
    padding: 16px;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.85rem;
    border: 1px dashed var(--gray-200);
    border-radius: var(--radius-md);
}

.preview-product-actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px 10px;
    border-top: 1px solid var(--gray-100);
}

.preview-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.12s;
    border: 1px solid transparent;
    line-height: 1;
}

.preview-action-edit {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-200);
}

.preview-action-edit:hover {
    background: var(--blue-50);
    color: var(--blue-700);
    border-color: var(--blue-300);
}

.preview-action-preview {
    background: var(--orange-50, #fff7ed);
    color: var(--orange-700);
    border-color: var(--orange-200);
}

.preview-action-preview:hover {
    background: var(--orange-500);
    color: white;
    border-color: var(--orange-500);
}

/* ==================== PRODUCTS TABLE — COLUMN WIDTHS ==================== */
.col-checkbox { width: 36px; padding: 0 8px !important; text-align: center; }
.col-ref      { width: 130px; }
.col-name     { min-width: 220px; }
.col-cat      { width: 180px; }
.col-compact  { width: 72px; text-align: center !important; }
.col-actions  { width: 90px; }

/* ==================== FIX ORDER BUTTON ==================== */
.btn-fix-order {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--orange-300);
    background: var(--orange-50);
    color: var(--orange-700);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-fix-order:hover:not(:disabled) {
    background: var(--orange-500);
    color: white;
    border-color: var(--orange-500);
}
.btn-fix-order:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== BULK ACTION BAR ==================== */
.bulk-action-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--orange-50);
    border-bottom: 1px solid var(--orange-200);
    font-size: 0.87rem;
    color: var(--orange-800);
    flex-wrap: wrap;
}
.bulk-action-bar.show { display: flex; }
.bulk-action-bar strong { font-weight: 700; }
.bulk-selects { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bulk-select {
    padding: 5px 10px;
    font-size: 0.82rem;
    border: 1px solid var(--orange-300);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-700);
}
.btn-bulk-move {
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--orange-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
}
.btn-bulk-move:hover:not(:disabled) { background: var(--orange-600); }
.btn-bulk-move:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-bulk-cancel {
    padding: 6px 12px;
    font-size: 0.82rem;
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--gray-600);
}
.btn-bulk-cancel:hover { background: var(--gray-100); }

/* Checkbox styling in table */
.admin-table input[type="checkbox"] {
    width: 15px; height: 15px; cursor: pointer; accent-color: var(--orange-500);
}
.row-selected td { background: var(--orange-50) !important; }

/* ==================== PREVIEW SEARCH ==================== */
.preview-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 8px 12px;
}
.preview-search-bar svg { color: var(--gray-400); flex-shrink: 0; }
.preview-search-bar input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.9rem;
    width: 100%;
    color: var(--gray-700);
}

/* Sidebar overlay on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}
/* ==================== THEME TOGGLE BUTTON ==================== */
.btn-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: none;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-theme-toggle:hover { background: var(--gray-100); color: var(--gray-900); }

/* ==================== DARK THEME ==================== */
body[data-admin-theme="dark"] {
    /* Palette — neutral dark, not blue-tinted */
    --dk-bg:       #111113;
    --dk-surface:  #1a1a1f;
    --dk-surface2: #222228;
    --dk-surface3: #2c2c34;
    --dk-border:   #35353f;
    --dk-border2:  #45454f;
    --dk-text:     #f0f0f3;
    --dk-text2:    #b8b8c4;
    --dk-muted:    #78788a;
    --dk-hover:    rgba(255,255,255,0.04);
    --dk-orange:   #f97316;
    --dk-orange-s: rgba(249,115,22,0.12);
}

/* ── Base ── */
body[data-admin-theme="dark"],
body[data-admin-theme="dark"] .admin-body { background: var(--dk-bg); color: var(--dk-text); }
body[data-admin-theme="dark"] .admin-main { background: var(--dk-bg); }

/* ── Sidebar ── */
body[data-admin-theme="dark"] .admin-sidebar {
    background: var(--dk-surface);
    border-right: 1px solid var(--dk-border);
    box-shadow: none;
}
body[data-admin-theme="dark"] .sidebar-header  { background: var(--dk-surface2); border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .sidebar-footer  { background: var(--dk-surface2); border-top-color: var(--dk-border); }
body[data-admin-theme="dark"] .nav-group-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] .nav-group-label::after { background: var(--dk-border); }
body[data-admin-theme="dark"] .sidebar-nav .nav-item { color: var(--dk-text2); }
body[data-admin-theme="dark"] .sidebar-nav .nav-item svg { stroke: var(--dk-muted); }
body[data-admin-theme="dark"] .sidebar-nav .nav-item:hover {
    background: var(--dk-hover);
    color: var(--dk-text);
}
body[data-admin-theme="dark"] .sidebar-nav .nav-item:hover svg { stroke: var(--dk-orange); opacity: 1; }
body[data-admin-theme="dark"] .sidebar-nav .nav-item.active svg { stroke: white; opacity: 1; }
body[data-admin-theme="dark"] .admin-user-info { background: var(--dk-surface3); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .admin-name  { color: var(--dk-text); }
body[data-admin-theme="dark"] .admin-role  { color: var(--dk-muted); }
body[data-admin-theme="dark"] .logout-btn-sidebar {
    background: transparent;
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .logout-btn-sidebar:hover {
    background: rgba(220,38,38,0.12);
    border-color: #991b1b;
    color: #fca5a5;
}

/* Category tree icon */
.cat-icon-svg {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--blue-700, #192752);
    opacity: 0.7;
}
body[data-admin-theme="dark"] .logout-btn-sidebar:hover svg { stroke: #fca5a5; }

/* ── Topbar ── */
body[data-admin-theme="dark"] .admin-topbar {
    background: var(--dk-surface);
    border-bottom: 1px solid var(--dk-border);
    box-shadow: 0 1px 0 var(--dk-border);
}
body[data-admin-theme="dark"] .page-title   { color: var(--dk-text); }
body[data-admin-theme="dark"] .sidebar-toggle { color: var(--dk-text2); }
body[data-admin-theme="dark"] .sidebar-toggle:hover { background: var(--dk-surface3); }
body[data-admin-theme="dark"] .topbar-search {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    box-shadow: none;
}
body[data-admin-theme="dark"] .topbar-search:focus-within {
    border-color: var(--dk-orange);
    background: var(--dk-surface2);
    box-shadow: 0 0 0 3px var(--dk-orange-s);
}
body[data-admin-theme="dark"] .topbar-search input { color: var(--dk-text); }
body[data-admin-theme="dark"] .topbar-search input::placeholder { color: var(--dk-muted); }
body[data-admin-theme="dark"] .topbar-search svg { color: var(--dk-muted); }
body[data-admin-theme="dark"] .btn-theme-toggle {
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .btn-theme-toggle:hover {
    background: var(--dk-surface3);
    color: var(--dk-text);
    border-color: var(--dk-border2);
}
body[data-admin-theme="dark"] .btn-secondary {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .btn-secondary:hover {
    background: var(--dk-surface3);
    border-color: var(--dk-border2);
    color: var(--dk-text);
}

/* ── Cards ── */
body[data-admin-theme="dark"] .admin-card {
    background: var(--dk-surface);
    border-color: var(--dk-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
body[data-admin-theme="dark"] .admin-card-header { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .admin-card-title  { color: var(--dk-text); }
body[data-admin-theme="dark"] .admin-card-body   { color: var(--dk-text2); }

/* ── Table ── */
body[data-admin-theme="dark"] .admin-table thead   { background: var(--dk-surface2); }
body[data-admin-theme="dark"] .admin-table th {
    color: var(--dk-muted);
    border-bottom-color: var(--dk-border);
    font-size: 0.75rem;
}
body[data-admin-theme="dark"] .admin-table td {
    color: var(--dk-text2);
    border-bottom-color: var(--dk-border);
}
body[data-admin-theme="dark"] .admin-table tbody tr:hover { background: var(--dk-hover); }
body[data-admin-theme="dark"] .cell-bold   { color: var(--dk-text); }
body[data-admin-theme="dark"] .cell-mono   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .admin-table input[type="checkbox"] { accent-color: var(--dk-orange); }
body[data-admin-theme="dark"] .row-selected td { background: var(--dk-orange-s) !important; }
body[data-admin-theme="dark"] .category-pill {
    background: rgba(59,130,246,0.15);
    color: #93c5fd;
}
body[data-admin-theme="dark"] .category-pill.subfamilia {
    background: var(--dk-surface3);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .action-btn {
    background: var(--dk-surface3);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .action-btn.edit:hover { background: #1e3a5f; border-color: #2563eb; color: #93c5fd; }
body[data-admin-theme="dark"] .action-btn.delete:hover { background: #3b0a0a; border-color: #dc2626; color: #fca5a5; }
body[data-admin-theme="dark"] .drag-handle-cell { color: var(--dk-muted); }

/* ── Filters ── */
body[data-admin-theme="dark"] .filters-bar { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .filter-search {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .filter-search input { color: var(--dk-text); }
body[data-admin-theme="dark"] .filter-search input::placeholder { color: var(--dk-muted); }
body[data-admin-theme="dark"] .filter-search svg { color: var(--dk-muted); }
body[data-admin-theme="dark"] .filter-select {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .btn-fix-order {
    background: var(--dk-orange-s);
    border-color: rgba(249,115,22,0.3);
    color: #fdba74;
}

/* ── Pagination ── */
body[data-admin-theme="dark"] .pagination { border-top-color: var(--dk-border); }
body[data-admin-theme="dark"] .pagination-info { color: var(--dk-muted); }
body[data-admin-theme="dark"] .pagination-btn {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .pagination-btn:hover:not(:disabled):not(.active) {
    background: var(--dk-surface3);
    border-color: var(--dk-border2);
    color: var(--dk-text);
}

/* ── Bulk bar ── */
body[data-admin-theme="dark"] #selectAllFilteredHint {
    background: rgba(249,115,22,0.07);
    border-bottom-color: rgba(249,115,22,0.2);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] #selectAllFilteredHint button { color: #fb923c !important; }

body[data-admin-theme="dark"] .bulk-action-bar {
    background: var(--dk-orange-s);
    border-bottom-color: rgba(249,115,22,0.25);
    color: #fdba74;
}
body[data-admin-theme="dark"] .bulk-select {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}

/* ── Forms / Editor ── */
body[data-admin-theme="dark"] .editor-panel {
    background: var(--dk-surface);
    border-left: 1px solid var(--dk-border);
}
body[data-admin-theme="dark"] .editor-header {
    background: var(--dk-surface2);
    border-bottom-color: var(--dk-border);
}
body[data-admin-theme="dark"] .editor-header h3     { color: var(--dk-text); }
body[data-admin-theme="dark"] .editor-close         { color: var(--dk-muted); }
body[data-admin-theme="dark"] .editor-close:hover   { background: var(--dk-surface3); color: var(--dk-text); }
body[data-admin-theme="dark"] .editor-footer {
    background: var(--dk-surface2);
    border-top-color: var(--dk-border);
}
body[data-admin-theme="dark"] .editor-body label     { color: var(--dk-muted); font-size: 0.82rem; }
body[data-admin-theme="dark"] .editor-section        { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .editor-section-header { background: var(--dk-surface2); border-bottom-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .editor-section-badge  { background: var(--dk-surface3); color: var(--dk-muted); }
body[data-admin-theme="dark"] .form-input,
body[data-admin-theme="dark"] .form-select,
body[data-admin-theme="dark"] textarea.form-input {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text);
}
body[data-admin-theme="dark"] .form-input:focus,
body[data-admin-theme="dark"] textarea.form-input:focus {
    border-color: var(--dk-orange);
    box-shadow: 0 0 0 3px var(--dk-orange-s);
}
body[data-admin-theme="dark"] .form-input::placeholder { color: var(--dk-muted); }
body[data-admin-theme="dark"] .form-group small     { color: var(--dk-muted); }

/* Image gallery in editor */
body[data-admin-theme="dark"] .image-item {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .image-item-principal { border-color: var(--dk-orange) !important; }
body[data-admin-theme="dark"] .image-label {
    background: var(--dk-surface2);
    border-top-color: var(--dk-border);
    color: var(--dk-muted);
}
body[data-admin-theme="dark"] .image-upload-zone {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-muted);
}
body[data-admin-theme="dark"] .image-upload-zone:hover {
    background: var(--dk-surface3);
    border-color: var(--dk-orange);
    color: var(--dk-orange);
}

/* ── Catalog Preview ── */
body[data-admin-theme="dark"] .preview-search-bar {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .preview-search-bar input { color: var(--dk-text); }
body[data-admin-theme="dark"] .preview-search-bar input::placeholder { color: var(--dk-muted); }
body[data-admin-theme="dark"] .preview-search-bar svg { color: var(--dk-muted); }
body[data-admin-theme="dark"] .preview-l1-card {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .preview-l1-card:hover,
body[data-admin-theme="dark"] .preview-l1-card.active {
    background: var(--dk-orange);
    border-color: var(--dk-orange);
    color: white;
}
body[data-admin-theme="dark"] .preview-subnav-btn {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .preview-subnav-btn.active,
body[data-admin-theme="dark"] .preview-subnav-btn:hover { background: var(--dk-orange-s); color: #fdba74; border-color: rgba(249,115,22,0.3); }
body[data-admin-theme="dark"] .preview-product-card {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .preview-product-name { color: var(--dk-text); }
body[data-admin-theme="dark"] .preview-product-ref  { color: var(--dk-muted); }
body[data-admin-theme="dark"] .preview-products-header { color: var(--dk-muted); border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .preview-breadcrumb { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .preview-bc-btn { color: var(--dk-muted); }
body[data-admin-theme="dark"] .preview-bc-btn.active { color: var(--dk-text); }

/* ── Modals ── */
body[data-admin-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
body[data-admin-theme="dark"] .modal,
body[data-admin-theme="dark"] .confirm-modal {
    background: var(--dk-surface);
    border: 1px solid var(--dk-border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
body[data-admin-theme="dark"] .confirm-modal h3 { color: var(--dk-text); }
body[data-admin-theme="dark"] .confirm-modal p  { color: var(--dk-text2); }

/* ── Misc ── */
body[data-admin-theme="dark"] .empty-state h3,
body[data-admin-theme="dark"] .empty-state p   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .loading-state p { color: var(--dk-muted); }
body[data-admin-theme="dark"] .spinner { border-color: var(--dk-border); border-top-color: var(--dk-orange); }
body[data-admin-theme="dark"] .admin-toast { background: var(--dk-surface); border: 1px solid var(--dk-border); color: var(--dk-text); box-shadow: 0 4px 20px rgba(0,0,0,0.5); }

/* ── KPI Cards ── */
body[data-admin-theme="dark"] .kpi-card {
    background: rgba(26, 26, 31, 0.8);
    backdrop-filter: blur(10px);
    border-color: var(--dk-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

body[data-admin-theme="dark"] .kpi-card:hover {
    border-color: var(--dk-orange);
    background: var(--dk-surface2);
}
body[data-admin-theme="dark"] .kpi-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] .kpi-value { color: var(--dk-text); }
body[data-admin-theme="dark"] .kpi-icon.blue   { background: rgba(59,130,246,0.15);  color: #93c5fd; }
body[data-admin-theme="dark"] .kpi-icon.green  { background: rgba(16,185,129,0.15);  color: #6ee7b7; }
body[data-admin-theme="dark"] .kpi-icon.orange { background: rgba(249,115,22,0.15);  color: #fdba74; }
body[data-admin-theme="dark"] .kpi-icon.red    { background: rgba(239,68,68,0.15);   color: #fca5a5; }
body[data-admin-theme="dark"] .kpi-sub { color: var(--dk-muted); }
body[data-admin-theme="dark"] .pill-tabs { background: var(--dk-border); }
body[data-admin-theme="dark"] .pill-tab { color: var(--dk-muted); }
body[data-admin-theme="dark"] .pill-tab.active { background: var(--dk-surface); color: var(--dk-text); }
body[data-admin-theme="dark"] .section-page-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .kpi-value-sm { color: var(--dk-text); }
body[data-admin-theme="dark"] .page-toolbar { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .toolbar-advanced { background: var(--dk-bg); border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .crm-tabs { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .crm-tab { color: var(--dk-muted); }
body[data-admin-theme="dark"] .crm-tab:hover { color: var(--dk-text); }
body[data-admin-theme="dark"] .crm-tab-count { background: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .dash-section-label::after { background: var(--dk-border); }
body[data-admin-theme="dark"] .dash-section-label-text { color: var(--dk-muted); }
body[data-admin-theme="dark"] .dash-quick-action-btn { background: var(--dk-surface); border-color: var(--dk-border); color: var(--dk-text); }
body[data-admin-theme="dark"] .dash-quick-action-btn:hover { background: rgba(249,115,22,0.1); border-color: rgba(249,115,22,0.3); }

/* ── Slide-in panels (leads, fornecedores detail) ── */
body[data-admin-theme="dark"] #leadDetailPanel,
body[data-admin-theme="dark"] #fornDetailPanel {
    background: var(--dk-surface);
    color: var(--dk-text);
}
body[data-admin-theme="dark"] #leadDetailPanel h3,
body[data-admin-theme="dark"] #fornDetailPanel h3 { color: var(--dk-text); }
body[data-admin-theme="dark"] #leadDetailPanel p,
body[data-admin-theme="dark"] #fornDetailPanel p  { color: var(--dk-muted); }
body[data-admin-theme="dark"] #leadDetailPanel input,
body[data-admin-theme="dark"] #leadDetailPanel select,
body[data-admin-theme="dark"] #leadDetailPanel textarea,
body[data-admin-theme="dark"] #fornDetailPanel input,
body[data-admin-theme="dark"] #fornDetailPanel select,
body[data-admin-theme="dark"] #fornDetailPanel textarea {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text);
}
body[data-admin-theme="dark"] .form-field-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] #leadDetailPanel .admin-card-body,
body[data-admin-theme="dark"] #leadDetailPanel [style*="background:var(--gray-50)"],
body[data-admin-theme="dark"] #leadDetailPanel [style*="background: var(--gray-50)"] {
    background: var(--dk-surface2) !important;
    border-color: var(--dk-border) !important;
}

/* ── Advanced filters bar ── */
body[data-admin-theme="dark"] #leadsAdvancedFilters,
body[data-admin-theme="dark"] #fornAdvancedFilters {
    background: var(--dk-surface2) !important;
    border-color: var(--dk-border) !important;
}

/* ── Category tree rows ── */
body[data-admin-theme="dark"] .category-row {
    background: var(--dk-surface);
    border-color: var(--dk-border);
    color: var(--dk-text);
}
body[data-admin-theme="dark"] .category-row:hover { background: var(--dk-hover); }
body[data-admin-theme="dark"] .category-row.level-1 { background: var(--dk-surface2); }
body[data-admin-theme="dark"] .category-name  { color: var(--dk-text); }
body[data-admin-theme="dark"] .category-icon-slug { color: var(--dk-muted); }
body[data-admin-theme="dark"] .category-order { color: var(--dk-orange); }

/* ── Estado tabs (leads) ── */
body[data-admin-theme="dark"] .admin-card-body button[onclick*="onFilter"] {
    color: var(--dk-muted);
}

/* ── Lead tipo badges ── */
body[data-admin-theme="dark"] .lead-tipo-badge {
    background: var(--dk-surface3);
    color: var(--dk-text2);
}

/* ── Delete / generic modals ── */
body[data-admin-theme="dark"] #leadDeleteModal,
body[data-admin-theme="dark"] #fornDeleteModal {
    background: var(--dk-surface);
    border: 1px solid var(--dk-border);
}
body[data-admin-theme="dark"] #leadDeleteModal h3,
body[data-admin-theme="dark"] #fornDeleteModal h3 { color: var(--dk-text); }
body[data-admin-theme="dark"] #leadDeleteModal p,
body[data-admin-theme="dark"] #fornDeleteModal p  { color: var(--dk-text2); }

/* ── Bulk action bar ── */
body[data-admin-theme="dark"] #leadBulkActions {
    background: var(--dk-surface);
    border-color: var(--dk-border);
    color: var(--dk-text);
}

/* ── Update banner ── */
body[data-admin-theme="dark"] #updateBanner {
    background: #92400e;
    color: #fde68a;
}

/* Image drag & drop */
.image-item.img-dragging { opacity: 0.35; }
.image-item.img-drag-over { outline: 2px dashed var(--orange-400); outline-offset: 2px; }
body[data-admin-theme="dark"] .image-item.img-drag-over { outline-color: var(--dk-orange); }

/* ==================== AGRUPAMENTO (BETA) ==================== */
.grouping-shell { display: flex; flex-direction: column; gap: 0; }

.grouping-beta-bar {
    display: flex; align-items: center; gap: 8px;
    background: #fff7ed; border: 1px solid #fed7aa; border-radius: var(--radius-md);
    padding: 10px 16px; font-size: 0.82rem; color: #92400e; margin-bottom: 20px;
}
.grouping-beta-bar code { background: #ffedd5; padding: 1px 5px; border-radius: 4px; font-size: 0.8rem; }

/* Tabs */
.grouping-tabs {
    display: flex; gap: 4px; margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-200); padding-bottom: 0;
}
.grouping-tab {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; background: none; cursor: pointer;
    font-size: 0.875rem; font-weight: 500; color: var(--gray-500);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: color 0.15s, border-color 0.15s;
}
.grouping-tab:hover { color: var(--gray-800); }
.grouping-tab.active { color: var(--orange-600); border-bottom-color: var(--orange-500); font-weight: 600; }
.tab-count {
    background: var(--orange-100); color: var(--orange-700);
    font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 9px;
}

/* Filtros */
.grouping-filters {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    background: white; padding: 16px; border-radius: var(--radius-md);
    border: 1px solid var(--gray-200); margin-bottom: 16px;
}
.grouping-filter-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.grouping-filter-group label { font-size: 0.8rem; font-weight: 500; color: var(--gray-600); }
.grouping-filter-group--action { flex: 0; min-width: auto; }
.form-input--sm { height: 36px; padding: 0 10px; font-size: 0.85rem; }

/* Info bar */
.grouping-info-bar {
    display: flex; align-items: center; gap: 12px;
    background: #fff7ed; border: 1px solid #fed7aa;
    border-radius: var(--radius-md); padding: 8px 14px;
    font-size: 0.85rem; color: #92400e; margin-bottom: 12px;
    flex-wrap: wrap;
}
.grouping-shift-hint {
    font-size: 0.75rem; color: #b45309; opacity: 0.7;
}
.grouping-deselect-all {
    font-size: 0.78rem; background: none; border: none;
    color: var(--orange-600); cursor: pointer; text-decoration: underline; padding: 0;
    font-family: inherit;
}
.grouping-copy-names-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.78rem; font-weight: 600; font-family: inherit;
    background: var(--orange-500, #f97316); color: white;
    border: none; border-radius: 6px; padding: 4px 10px;
    cursor: pointer; transition: background 0.15s;
}
.grouping-copy-names-btn:hover { background: var(--orange-600, #ea580c); }

/* Grid de produtos */
.grouping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.grouping-empty-state {
    grid-column: 1/-1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    padding: 48px 0; color: var(--gray-400); text-align: center; font-size: 0.9rem;
}
.grouping-card {
    position: relative; border: 2px solid var(--gray-200); border-radius: var(--radius-md);
    background: white; cursor: pointer; overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.grouping-card:hover { border-color: var(--orange-300); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.grouping-card--selected { border-color: var(--orange-500); background: #fff7ed; }
.grouping-card-check {
    position: absolute; top: 6px; right: 6px; width: 20px; height: 20px;
    background: var(--gray-200); border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.grouping-card--selected .grouping-card-check { background: var(--orange-500); }
.grouping-card-img { width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--gray-50); }
.grouping-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.grouping-no-img {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    color: var(--gray-300);
}
.grouping-card-info { padding: 8px; }
.grouping-card-name { font-size: 0.75rem; font-weight: 500; color: var(--gray-700); line-height: 1.3; margin: 0 0 2px; }
.grouping-card-ref { font-size: 0.68rem; color: var(--gray-400); margin: 0; font-family: var(--font-mono); }

/* Modal */
.grouping-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.grouping-modal {
    background: white; border-radius: var(--radius-xl); width: 100%; max-width: 680px;
    max-height: 92vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.grouping-modal--wide { max-width: min(1400px, 98vw); width: 98vw; max-height: 95vh; }
.grouping-modal--create { max-width: min(1400px, 98vw); width: 98vw; max-height: 95vh; }
.grouping-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
}
.grouping-modal-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.grouping-modal-body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.grouping-modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--gray-200);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* Image picker */
.grouping-img-picker { display: flex; gap: 12px; align-items: flex-start; }
.grouping-img-preview {
    width: 96px; height: 96px; border: 2px dashed var(--gray-300); border-radius: var(--radius-md);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; color: var(--gray-400); font-size: 0.72rem; flex-shrink: 0; overflow: hidden;
}
.grouping-img-options { flex: 1; }
.grouping-img-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.grouping-img-thumb {
    width: 48px; height: 48px; border: 2px solid var(--gray-200); border-radius: 6px;
    overflow: hidden; cursor: pointer; transition: border-color 0.15s;
}
.grouping-img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.grouping-img-thumb.selected { border-color: var(--orange-500); }
.grouping-img-thumb:hover { border-color: var(--orange-300); }

/* Relacionados chips */
.grouping-related-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; padding: 4px 0; }
.grouping-related-empty { font-size: 0.82rem; color: var(--gray-400); padding: 4px 0; }
.grouping-related-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--orange-50); border: 1px solid var(--orange-200);
    border-radius: 20px; padding: 3px 10px 3px 12px;
    font-size: 0.8rem; color: var(--gray-800); max-width: 280px;
}
.grouping-related-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grouping-related-chip-remove {
    background: none; border: none; cursor: pointer; padding: 0 2px;
    color: var(--gray-400); font-size: 1rem; line-height: 1; flex-shrink: 0;
    transition: color 0.1s;
}
.grouping-related-chip-remove:hover { color: var(--danger); }

/* Tabela filhos */
.grouping-children-table { border: 1px solid var(--gray-200); border-radius: var(--radius-md); overflow-x: auto; background: white; position: relative; }
.grouping-children-header {
    display: grid; grid-template-columns: minmax(180px, 1.8fr) minmax(200px, 2fr) repeat(7, auto) 40px;
    gap: 10px; padding: 10px 16px; background: var(--gray-50);
    font-size: 0.75rem; font-weight: 600; color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200); text-transform: uppercase; letter-spacing: 0.4px;
    width: max-content; min-width: 100%;
}
.grouping-children-header span:nth-child(1) { grid-column: 1; }
.grouping-children-header span:nth-child(2) { grid-column: 2; }

.grouping-child-row {
    display: grid; grid-template-columns: minmax(180px, 1.8fr) minmax(200px, 2fr) repeat(7, auto) 40px;
    gap: 10px; padding: 10px 16px; align-items: center;
    border-bottom: 1px solid var(--gray-100);
    width: max-content; min-width: 100%;
}
.grouping-child-row .child-original-name { grid-column: 1; }
.grouping-child-row .child-name-input     { grid-column: 2; }
.grouping-child-row .child-v1-input       { grid-column: 3; width: 130px; min-width: 130px; }
.grouping-child-row .child-v2-input       { grid-column: 4; width: 130px; min-width: 130px; }
.grouping-child-row .child-v3-input       { grid-column: 5; width: 130px; min-width: 130px; }
.grouping-child-row .child-v4-input       { grid-column: 6; width: 130px; min-width: 130px; }
.grouping-child-row .child-v5-input       { grid-column: 7; width: 130px; min-width: 130px; }
.grouping-child-row .child-v6-input       { grid-column: 8; width: 130px; min-width: 130px; }
.grouping-child-row .child-v7-input       { grid-column: 9; width: 130px; min-width: 130px; }
.grouping-child-row .grouping-remove-child { grid-column: 10; }
.grouping-child-row > div:last-child { grid-column: 10; display: flex; gap: 2px; align-items: center; }

#v1ColLabel, #editV1ColLabel { grid-column: 3; width: 130px; min-width: 130px; }
#v2ColLabel, #editV2ColLabel { grid-column: 4; width: 130px; min-width: 130px; }
#v3ColLabel, #editV3ColLabel { grid-column: 5; width: 130px; min-width: 130px; }
#v4ColLabel, #editV4ColLabel { grid-column: 6; width: 130px; min-width: 130px; }
#v5ColLabel, #editV5ColLabel { grid-column: 7; width: 130px; min-width: 130px; }
#v6ColLabel, #editV6ColLabel { grid-column: 8; width: 130px; min-width: 130px; }
#v7ColLabel, #editV7ColLabel { grid-column: 9; width: 130px; min-width: 130px; }

.grouping-child-row:last-child { border-bottom: none; }
.child-original-name {
    font-size: 0.78rem; color: var(--gray-500); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.grouping-remove-child {
    background: none; border: none; color: var(--gray-400); cursor: pointer;
    padding: 4px; border-radius: 4px; display: flex; align-items: center;
    transition: color 0.15s, background 0.15s;
}
.grouping-remove-child:hover { color: var(--danger); background: #fee2e2; }
.grouping-edit-child {
    background: none; border: none; color: var(--gray-400); cursor: pointer;
    padding: 4px; border-radius: 4px; display: flex; align-items: center;
    transition: color 0.15s, background 0.15s;
}
.grouping-edit-child:hover { color: var(--orange-500); background: var(--orange-50); }

/* Lista de grupos */
.grouping-groups-list { background: white; border-radius: var(--radius-md); border: 1px solid var(--gray-200); overflow: hidden; }

/* Secções por família */
.grouping-familia-section { border-bottom: 1px solid var(--gray-200); }
.grouping-familia-section:last-child { border-bottom: none; }
.grouping-familia-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; background: var(--gray-50);
    cursor: pointer; user-select: none;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}
.grouping-familia-header:hover { background: var(--orange-50, #fff7ed); }
.grouping-familia-name { font-size: 0.82rem; font-weight: 700; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.5px; }
.grouping-familia-badge {
    font-size: 0.72rem; font-weight: 600; padding: 2px 8px;
    background: var(--orange-100, #ffedd5); color: var(--orange-600, #ea580c);
    border-radius: 10px;
}
.grouping-subfamilia-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px 8px 32px;
    background: var(--gray-50); border-bottom: 1px solid var(--gray-100);
    cursor: pointer; user-select: none; transition: background 0.15s;
}
.grouping-subfamilia-header:hover { background: #f8f8f8; }
.grouping-subfamilia-body .grouping-group-row { padding-left: 40px; }
.grouping-familia-body .grouping-group-row:last-child { border-bottom: none; }
.grouping-toggle--sm { width: 30px; height: 17px; flex-shrink: 0; }
.grouping-toggle--sm .grouping-toggle-slider::before { width: 11px; height: 11px; top: 3px; left: 3px; }
.grouping-toggle--sm input:checked + .grouping-toggle-slider::before { transform: translateX(13px); }

body[data-admin-theme="dark"] .grouping-familia-header { background: #1a1f2e; }
body[data-admin-theme="dark"] .grouping-familia-header:hover { background: #1e2435; }
body[data-admin-theme="dark"] .grouping-subfamilia-header { background: #161b28; }
body[data-admin-theme="dark"] .grouping-familia-name { color: var(--dk-text-secondary, #a0aec0); }
.grouping-groups-header {
    display: grid; grid-template-columns: 2.5fr 1.2fr 0.8fr 1fr 1.2fr;
    gap: 12px; padding: 10px 16px; background: var(--gray-50);
    font-size: 0.75rem; font-weight: 600; color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200); text-transform: uppercase; letter-spacing: 0.4px;
}
.grouping-group-row {
    display: grid; grid-template-columns: 2.5fr 1.2fr 0.8fr 1fr 1.2fr;
    gap: 12px; padding: 12px 16px; align-items: center;
    border-bottom: 1px solid var(--gray-100); transition: background 0.1s;
}
.grouping-group-row:last-child { border-bottom: none; }
.grouping-group-row:hover { background: var(--gray-50); }
.grouping-group-name { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 0.875rem; }
.grouping-group-thumb {
    width: 36px; height: 36px; border-radius: 6px; object-fit: cover;
    border: 1px solid var(--gray-200); flex-shrink: 0;
}
.grouping-group-thumb--empty {
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100); color: var(--gray-300);
}
.grouping-group-sub { font-size: 0.8rem; color: var(--gray-500); }
.grouping-group-count { font-size: 0.82rem; color: var(--gray-600); }

/* Toggle switch */
.grouping-toggle-wrap { display: flex; align-items: center; gap: 8px; }
.grouping-toggle { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.grouping-toggle input { opacity: 0; width: 0; height: 0; }
.grouping-toggle-slider {
    position: absolute; inset: 0; background: var(--gray-300); border-radius: 10px;
    transition: background 0.2s;
}
.grouping-toggle-slider::before {
    content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
    background: white; top: 3px; left: 3px; transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.grouping-toggle input:checked + .grouping-toggle-slider { background: var(--orange-500); }
.grouping-toggle input:checked + .grouping-toggle-slider::before { transform: translateX(16px); }
.grouping-toggle-label { font-size: 0.8rem; color: var(--gray-500); }

/* Variantes list */
.grouping-variants .admin-card-body { padding: 0; }
.grouping-variant-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-bottom: 1px solid var(--gray-100);
    transition: background 0.1s;
}
.grouping-variant-row:last-child { border-bottom: none; }
.grouping-variant-row:hover { background: var(--gray-50); }
.variant-name-display { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; }
.variant-edit-form { flex: 1; max-width: 280px; }
.variant-actions { display: flex; gap: 6px; }

/* Dark mode */
body[data-admin-theme="dark"] .grouping-beta-bar { background: #431407; border-color: #92400e; color: #fed7aa; }
body[data-admin-theme="dark"] .grouping-beta-bar code { background: #7c2d12; }
body[data-admin-theme="dark"] .grouping-filters,
body[data-admin-theme="dark"] .grouping-groups-list,
body[data-admin-theme="dark"] .grouping-children-table { background: var(--dk-surface); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .grouping-card { background: var(--dk-surface); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .grouping-card--selected { background: #431407; border-color: var(--orange-500); }
body[data-admin-theme="dark"] .grouping-card-name { color: var(--dk-text); }
body[data-admin-theme="dark"] .grouping-modal { background: var(--dk-surface); }
body[data-admin-theme="dark"] .grouping-modal-header,
body[data-admin-theme="dark"] .grouping-modal-footer { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .grouping-modal-header h3 { color: var(--dk-text); }
body[data-admin-theme="dark"] .grouping-children-header,
body[data-admin-theme="dark"] .grouping-groups-header { background: #1a1f2e; }
body[data-admin-theme="dark"] .grouping-group-row:hover,
body[data-admin-theme="dark"] .grouping-variant-row:hover { background: #1a1f2e; }
body[data-admin-theme="dark"] .grouping-group-row,
body[data-admin-theme="dark"] .grouping-variant-row,
body[data-admin-theme="dark"] .grouping-child-row { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .grouping-img-preview { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .variant-name-display { color: var(--dk-text); }
body[data-admin-theme="dark"] .grouping-info-bar { background: #431407; border-color: #92400e; color: #fed7aa; }
body[data-admin-theme="dark"] .grouping-shift-hint { color: #fbbf24; }
body[data-admin-theme="dark"] .grouping-deselect-all { color: #fb923c; }

/* ── Grouping: topbar ─────────────────────────────── */
.grouping-topbar {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.grouping-search-wrap {
    flex: 1; position: relative; display: flex; align-items: center;
}
.grouping-search-wrap > svg {
    position: absolute; left: 10px; opacity: 0.4; pointer-events: none;
}
.grouping-search-input {
    width: 100%; padding: 8px 12px 8px 32px;
    border: 1px solid var(--gray-200); border-radius: var(--radius-md);
    font-size: 0.85rem; color: var(--gray-800); background: white;
    transition: border-color 0.15s;
}
.grouping-search-input:focus { outline: none; border-color: var(--orange-400); }
.grouping-sel-badge {
    background: rgba(255,255,255,0.25); border-radius: 9px;
    padding: 0 6px; font-size: 0.75rem; margin-left: 2px;
}

/* ── Grouping: L1 família buttons ────────────────── */
.grouping-l1-nav {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.grouping-l1-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--gray-200);
    background: white; font-size: 0.82rem; font-weight: 500; color: var(--gray-600);
    cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.grouping-l1-btn:hover { border-color: var(--orange-300); color: var(--orange-600); }
.grouping-l1-btn.active {
    border-color: var(--orange-500); background: #fff7ed; color: var(--orange-700); font-weight: 600;
}
.grouping-l1-count {
    background: var(--gray-100); color: var(--gray-500);
    border-radius: 10px; padding: 1px 7px; font-size: 0.72rem; font-weight: 400;
}
.grouping-l1-btn.active .grouping-l1-count { background: var(--orange-100); color: var(--orange-600); }

/* ── Grouping: subnav chips ─────────────────────── */
.grouping-subnav {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 8px; padding: 10px 0;
}
.grouping-subnav--l3 { padding-left: 16px; }
.grouping-subnav-btn {
    padding: 5px 12px; border-radius: 14px;
    border: 1px solid var(--gray-200); background: white;
    font-size: 0.79rem; color: var(--gray-600); cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    display: inline-flex; align-items: center; gap: 5px;
}
.grouping-subnav-btn:hover { border-color: var(--orange-300); color: var(--orange-600); }
.grouping-subnav-btn.active { border-color: var(--orange-500); background: #fff7ed; color: var(--orange-700); font-weight: 600; }
.grouping-subnav-btn span { font-size: 0.72rem; color: inherit; opacity: 0.7; }
.grouping-subnav-btn--l3 { font-size: 0.76rem; }

/* ── Grouping: grid inner wrapper ───────────────── */
.grouping-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.grouping-grid-count {
    grid-column: 1 / -1; font-size: 0.78rem; color: var(--gray-400);
    padding: 2px 0 6px; margin-bottom: 2px;
}

/* ── Grouping: card states ───────────────────────── */
.grouping-card--grouped {
    cursor: default; position: relative;
    border-color: #16a34a !important;
    background: #f0fdf4 !important;
}
.grouping-card--grouped:hover { border-color: #16a34a !important; box-shadow: 0 2px 8px rgba(22,163,74,0.15) !important; }
.grouping-card--grouped .grouping-card-img { opacity: 0.75; }
.grouping-card--grouped .grouping-card-name { color: #15803d; }

.grouping-card-grouped-badge {
    position: absolute; top: 6px; right: 6px;
    background: #16a34a; color: white;
    font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
    border-radius: 20px; padding: 2px 7px; z-index: 1;
    display: flex; align-items: center; gap: 3px;
}

.grouping-card--no-shadow {
    opacity: 0.4; cursor: not-allowed;
}
.grouping-card--no-shadow:hover { border-color: var(--gray-200) !important; box-shadow: none !important; }

/* ── Group Preview Modal ─────────────────────────── */
.grouping-modal--preview { max-width: min(1000px, 96vw); width: 96vw; max-height: 92vh; }
.grouping-preview-body { padding: 0 !important; gap: 0 !important; }

.gp-preview { display: flex; flex-direction: column; }

.gp-preview-layout {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
    border-bottom: 1px solid var(--gray-100);
}

/* Galeria */
.gp-preview-gallery {
    padding: 28px 24px; border-right: 1px solid var(--gray-100);
    display: flex; flex-direction: column; gap: 12px; background: var(--gray-50);
}
.gp-preview-img-wrap {
    width: 100%; aspect-ratio: 1; border-radius: var(--radius-lg);
    overflow: hidden; background: white; border: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: center; position: relative;
}
.gp-preview-img-wrap img {
    width: 100%; height: 100%; object-fit: contain; padding: 16px;
    transition: opacity 0.2s;
}
.gp-no-img-icon { color: var(--gray-200); }
.gp-preview-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.gp-thumb {
    width: 56px; height: 56px; border: 2px solid var(--gray-200); border-radius: 8px;
    overflow: hidden; cursor: pointer; transition: border-color 0.15s; background: white;
}
.gp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gp-thumb:hover { border-color: var(--orange-300); }
.gp-thumb.active { border-color: var(--orange-500); }

/* Info */
.gp-preview-info { padding: 28px 28px; display: flex; flex-direction: column; gap: 20px; }

.gp-preview-breadcrumb {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.75rem; color: var(--gray-400);
}
.gp-bc-sep { color: var(--gray-300); }
.gp-bc-active { color: var(--gray-600); font-weight: 500; }

.gp-preview-title { font-size: 1.35rem; font-weight: 700; color: var(--gray-900); margin: 0; line-height: 1.3; }
.gp-preview-ref { font-size: 0.8rem; color: var(--gray-400); font-family: var(--font-mono); margin: 0; }

/* Bloco de variante — estilo Leroy Merlin */
.gp-variant-block { display: flex; flex-direction: column; gap: 10px; }
.gp-variant-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; font-weight: 600; color: var(--gray-700);
}
.gp-variant-selected {
    font-weight: 400; color: var(--orange-600);
    background: #fff7ed; border-radius: 6px; padding: 1px 8px; font-size: 0.8rem;
}
.gp-variant-options { display: flex; flex-wrap: wrap; gap: 8px; }
.gp-variant-btn {
    padding: 8px 16px; border: 1.5px solid var(--gray-200); border-radius: 8px;
    background: white; font-size: 0.85rem; font-weight: 500; color: var(--gray-700);
    cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
    min-width: 52px; text-align: center;
}
.gp-variant-btn:hover:not(:disabled) { border-color: var(--orange-300); color: var(--orange-600); }
.gp-variant-btn.active {
    border-color: var(--orange-500); background: #fff7ed;
    color: var(--orange-700); font-weight: 600;
}
.gp-variant-btn--disabled,
.gp-variant-btn:disabled {
    opacity: 0.35; cursor: not-allowed;
    border-color: var(--gray-200); color: var(--gray-400);
    text-decoration: line-through;
}
.gp-variant-block--locked .gp-variant-options { opacity: 0.4; pointer-events: none; }

/* CTA */
.gp-preview-cta { margin-top: 4px; }
.gp-cta-btn {
    width: 100%; padding: 14px 20px; border-radius: 10px;
    background: var(--orange-500); color: white; border: none;
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: background 0.15s, opacity 0.15s;
}
.gp-cta-btn:hover:not(:disabled) { background: var(--orange-600); }
.gp-cta-btn:disabled { opacity: 0.45; cursor: not-allowed; background: var(--gray-400); }

.gp-preview-note {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.72rem; color: var(--gray-400); margin: 0;
}

/* Tabela sumário */
.gp-preview-table { padding: 20px 28px 24px; }
.gp-table-title { font-size: 0.8rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 10px; }
.gp-table-header {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 8px;
    padding: 8px 12px; background: var(--gray-50); border-radius: 6px 6px 0 0;
    font-size: 0.72rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.4px;
    border: 1px solid var(--gray-200);
}
.gp-table-header:has(+ .gp-table-row span:nth-child(3)) { grid-template-columns: 2fr 1fr 1fr 1.2fr; }
.gp-table-row {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 8px;
    padding: 9px 12px; font-size: 0.82rem; color: var(--gray-700);
    border: 1px solid var(--gray-200); border-top: none;
    transition: background 0.1s;
}
.gp-table-row:last-child { border-radius: 0 0 6px 6px; }
.gp-table-row:hover { background: var(--gray-50); }
.gp-table-row.active { background: #fff7ed; border-left: 3px solid var(--orange-500); }
.gp-table-row code { font-size: 0.8rem; color: var(--orange-700); background: #fff7ed; padding: 1px 6px; border-radius: 4px; }

/* Dark mode additions */
body[data-admin-theme="dark"] .grouping-search-input { background: var(--dk-surface); border-color: var(--dk-border); color: var(--dk-text); }
body[data-admin-theme="dark"] .grouping-l1-btn { background: var(--dk-surface); border-color: var(--dk-border); color: var(--dk-text-muted); }
body[data-admin-theme="dark"] .grouping-l1-btn.active { background: #431407; border-color: var(--orange-500); color: #fed7aa; }
body[data-admin-theme="dark"] .grouping-l1-count { background: var(--dk-border); color: var(--dk-text-muted); }
body[data-admin-theme="dark"] .grouping-subnav-btn { background: var(--dk-surface); border-color: var(--dk-border); color: var(--dk-text-muted); }
body[data-admin-theme="dark"] .grouping-subnav-btn.active { background: #431407; border-color: var(--orange-500); color: #fed7aa; }

/* ==================== EDITABLE FIELDS (drawer edit-per-field) ==================== */
.ef-field {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 12px 14px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    cursor: default;
}
.ef-field:hover {
    background: #fff;
    border-color: var(--gray-300);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.ef-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-400);
    margin-bottom: 4px;
}
.ef-view {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}
.ef-val {
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--gray-900);
    flex: 1;
    line-height: 1.4;
}
.ef-val.empty {
    color: var(--gray-300);
    font-weight: 400;
    font-style: italic;
}
.ef-btn-pencil {
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 5px 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.ef-field:hover .ef-btn-pencil {
    opacity: 1;
}
.ef-btn-pencil:hover {
    color: var(--primary);
    background: rgba(var(--primary-rgb, 37,99,235), 0.08);
}
.ef-edit {
    display: none;
    margin-top: 8px;
}
.ef-edit input,
.ef-edit select,
.ef-edit textarea {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--gray-800);
    outline: none;
    box-sizing: border-box;
    background: #fff;
}
.ef-save-btn {
    padding: 7px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.ef-save-btn:hover { opacity: 0.88; }
.ef-cancel-btn {
    padding: 7px 10px;
    background: #fff;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.88rem;
}
.ef-cancel-btn:hover { background: var(--gray-50); }

/* ==================== PROFILE MODAL ==================== */
.lead-profile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 250;
}
.lead-profile-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(820px, 96vw);
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 251;
    overflow: hidden;
    flex-direction: column;
}
.lead-profile-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 28px 32px 32px;
}
.profile-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-100);
}
.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}
.profile-info-item { display: contents; }
.profile-info-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}
.profile-info-value {
    font-size: 0.9rem;
    color: var(--gray-800);
}
.timeline-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}
.timeline-content { flex: 1; min-width: 0; }
.timeline-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}
.timeline-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
}

/* ==================== EMAIL PREVIEW MODAL ==================== */
.email-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
}
.email-preview-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 96vw);
    height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 301;
    flex-direction: column;
    overflow: hidden;
}

/* =====================================================
   FACEBOOK GROUPS MODULE
   ===================================================== */

/* ── Tab switcher ── */
.fb-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.fb-tabs__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
    flex: 1;
    min-width: 140px;
    font-family: var(--font-display);
}
.fb-tabs__pills {
    display: flex;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.fb-tabs__btn {
    padding: 6px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    color: var(--gray-500);
    font-family: var(--font-body);
}
.fb-tabs__btn.active {
    background: #fff;
    color: var(--gray-900);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Modals base (.fb-modal wraps .modal-overlay) ── */
.fb-modal {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 50px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.25s cubic-bezier(0.4,0,0.2,1);
}
.fb-modal--sm { max-width: 480px; }
.fb-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.fb-modal__title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}
.fb-modal__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}
.fb-modal__close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}
.fb-modal__body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 18px;
    overflow-y: auto;
}
.fb-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* ── Form elements inside modals ── */
.fb-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fb-form-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-body);
}
.fb-form-label span {
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--gray-400);
    font-size: 0.78rem;
    margin-left: 4px;
}
.fb-form-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--gray-800);
    background: white;
    resize: vertical;
    line-height: 1.6;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.fb-form-textarea:focus {
    outline: none;
    border-color: var(--orange-400);
    box-shadow: 0 0 0 3px rgba(209,124,43,0.1);
}

/* ── Image dropzone ── */
.fb-dropzone {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.fb-dropzone:hover,
.fb-dropzone--active {
    border-color: var(--orange-400);
    background: var(--orange-50);
}
.fb-dropzone__icon {
    color: var(--gray-300);
    margin-bottom: 4px;
}
.fb-dropzone__text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-600);
    margin: 0;
}
.fb-dropzone__hint {
    font-size: 0.76rem;
    color: var(--gray-400);
    margin: 0;
}

/* ── Templates grid ── */
.fb-templates-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.fb-templates-count {
    margin: 0;
    color: var(--gray-400);
    font-size: 0.85rem;
}
.fb-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.fb-template-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
    box-shadow: var(--shadow-xs);
    overflow: visible;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.fb-template-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--orange-200);
}
.fb-template-card__thumb {
    aspect-ratio: 1.91 / 1;
    overflow: hidden;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    flex-shrink: 0;
}
.fb-template-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fb-template-card__thumb--empty {
    color: var(--gray-300);
}
.fb-template-card__body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.fb-template-card__name {
    margin: 0 0 4px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fb-template-card__desc {
    margin: 0;
    font-size: 0.87rem;
    color: var(--gray-600);
    line-height: 1.55;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fb-template-stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 3px 9px;
    background: var(--primary-50, #eff6ff);
    color: var(--primary, #2563eb);
    border: 1px solid var(--primary-100, #dbeafe);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
body[data-admin-theme="dark"] .fb-template-stats-badge {
    background: rgba(37,99,235,0.12);
    color: #93c5fd;
    border-color: rgba(37,99,235,0.25);
}
.fb-template-card__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fb-template-card__date {
    font-size: 0.74rem;
    color: var(--gray-400);
}
.fb-template-card__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.fb-tpl-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-700);
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    font-family: var(--font-body);
}

.fb-tpl-btn svg {
    flex-shrink: 0;
}

.fb-tpl-btn--secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.fb-tpl-btn--restore {
    border-color: rgba(37, 99, 235, 0.2);
    background: rgba(37, 99, 235, 0.03);
    color: #2563eb;
}

.fb-tpl-btn--restore:hover {
    background: rgba(37, 99, 235, 0.07);
    border-color: rgba(37, 99, 235, 0.3);
    color: #1d4ed8;
}

.fb-tpl-menu-trigger {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.fb-tpl-menu-trigger:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

/* ── Dropdown Menu ── */
.fb-dropdown-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    z-index: 9999;
    padding: 6px;
    min-width: 170px;
    display: none;
    animation: fadeIn var(--transition-fast) ease;
}

.fb-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--gray-700);
    white-space: nowrap;
    border-radius: 6px;
    font-family: var(--font-body);
    transition: background 0.15s, color 0.15s;
}

.fb-dropdown-menu button:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.fb-dropdown-menu button svg {
    flex-shrink: 0;
    color: inherit;
    opacity: 0.7;
}

.fb-dropdown-menu button.danger {
    color: #ef4444;
}

.fb-dropdown-menu button.danger:hover {
    background: #fff1f2;
    color: #b91c1c;
}

.fb-dropdown-menu .sep {
    margin: 4px 0;
    border-top: 1px solid var(--gray-100);
}



/* ── Empty state ── */
.fb-empty {
    text-align: center;
    padding: 60px 24px;
    background: var(--gray-50);
    border-radius: var(--radius-xl);
    border: 2px dashed var(--gray-200);
}
.fb-empty__icon {
    color: var(--gray-300);
    margin-bottom: 14px;
}
.fb-empty__title {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-500);
}
.fb-empty__text {
    margin: 0 0 20px;
    font-size: 0.87rem;
    color: var(--gray-400);
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* ── Facebook post preview modal ── */
.fb-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.72);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    overflow-y: auto;
}
.fb-preview-wrapper {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s cubic-bezier(0.4,0,0.2,1);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
/* Admin label bar above the post */
.fb-preview-bar {
    background: #1877f2;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.fb-preview-bar__label {
    color: rgba(255,255,255,0.9);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.fb-preview-bar__close {
    background: rgba(255,255,255,0.18);
    border: none;
    cursor: pointer;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.15s;
}
.fb-preview-bar__close:hover { background: rgba(255,255,255,0.3); }
/* The post card itself */
.fb-post {
    background: #fff;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.fb-post__header {
    padding: 12px 16px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.fb-post__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1877f2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.fb-post__meta { flex: 1; min-width: 0; }
.fb-post__name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #050505;
    line-height: 1.3;
}
.fb-post__date {
    font-size: 0.73rem;
    color: #65676b;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}
.fb-post__more {
    color: #65676b;
    cursor: default;
    padding: 4px;
    border-radius: 50%;
}
.fb-post__text {
    padding: 4px 16px 12px;
    font-size: 0.93rem;
    color: #050505;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.fb-post__text a { color: #1877f2; text-decoration: none; }
.fb-post__image {
    border-top: 1px solid #e4e6eb;
    border-bottom: 1px solid #e4e6eb;
}
.fb-post__image img {
    width: 100%;
    display: block;
    max-height: 380px;
    object-fit: contain;
    background: #f0f2f5;
}
.fb-post__stats {
    padding: 7px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fb-post__reactions-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.83rem;
    color: #65676b;
    cursor: default;
}
.fb-post__reaction-icons {
    display: flex;
}
.fb-post__reaction-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 1.5px solid #fff;
}
.fb-post__reaction-icon--like  { background: #1877f2; margin-right: -4px; }
.fb-post__reaction-icon--love  { background: #f33e58; margin-right: -4px; }
.fb-post__reaction-icon--haha  { background: #f7b125; }
.fb-post__counts {
    display: flex;
    gap: 12px;
    font-size: 0.83rem;
    color: #65676b;
    cursor: default;
}
.fb-post__divider {
    height: 1px;
    background: #e4e6eb;
    margin: 0 16px;
}
.fb-post__actions {
    padding: 2px 8px 6px;
    display: flex;
    gap: 2px;
}
.fb-post__action-btn {
    flex: 1;
    background: none;
    border: none;
    cursor: default;
    padding: 8px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #65676b;
    border-radius: 6px;
    font-family: inherit;
}
.fb-post__action-btn svg { flex-shrink: 0; }

/* Dark mode */
body[data-admin-theme="dark"] .fb-tabs__pills { background: var(--dk-surface2); }
body[data-admin-theme="dark"] .fb-tabs__btn.active { background: var(--dk-surface); color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-tabs__title { color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-modal { background: var(--dk-surface); border: 1px solid var(--dk-border); }
body[data-admin-theme="dark"] .fb-modal__header,
body[data-admin-theme="dark"] .fb-modal__footer { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .fb-modal__title { color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-modal__close:hover { background: var(--dk-hover); color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-form-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] .fb-form-textarea { background: var(--dk-surface2); border-color: var(--dk-border); color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-dropzone { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .fb-dropzone:hover { border-color: var(--dk-orange); background: rgba(209,124,43,0.06); }
body[data-admin-theme="dark"] .fb-template-card { background: var(--dk-surface); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .fb-template-card:hover { border-color: var(--dk-orange); }
body[data-admin-theme="dark"] .fb-template-card__thumb { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .fb-template-card__name { color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-template-card__desc { color: var(--dk-text2); }
body[data-admin-theme="dark"] .fb-empty { background: var(--dk-surface2); border-color: var(--dk-border); }

body[data-admin-theme="dark"] .fb-tpl-btn {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-text2);
}

body[data-admin-theme="dark"] .fb-tpl-btn--secondary:hover {
    background: var(--dk-surface3);
    border-color: var(--dk-border2);
    color: var(--dk-text);
}

body[data-admin-theme="dark"] .fb-tpl-btn--restore {
    border-color: rgba(37,99,235,0.3);
    background: rgba(37,99,235,0.1);
    color: #93c5fd;
}

body[data-admin-theme="dark"] .fb-tpl-btn--restore:hover {
    background: rgba(37,99,235,0.15);
    border-color: rgba(37,99,235,0.4);
    color: #bfdbfe;
}

body[data-admin-theme="dark"] .fb-tpl-menu-trigger {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
    color: var(--dk-muted);
}

body[data-admin-theme="dark"] .fb-tpl-menu-trigger:hover {
    background: var(--dk-surface3);
    border-color: var(--dk-border2);
    color: var(--dk-text);
}

body[data-admin-theme="dark"] .fb-dropdown-menu {
    background: var(--dk-surface);
    border-color: var(--dk-border);
    box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}

body[data-admin-theme="dark"] .fb-dropdown-menu button {
    color: var(--dk-text2);
}

body[data-admin-theme="dark"] .fb-dropdown-menu button:hover {
    background: var(--dk-surface2);
    color: var(--dk-text);
}

body[data-admin-theme="dark"] .fb-dropdown-menu button.danger {
    color: #f87171;
}

body[data-admin-theme="dark"] .fb-dropdown-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

body[data-admin-theme="dark"] .fb-dropdown-menu .sep {
    border-top-color: var(--dk-border);
}


/* ==================== FACEBOOK GROUPS MODAL RE-STYLING ==================== */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 20px 24px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    color: white !important;
    cursor: pointer;
    padding: 8px !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    outline: none;
    box-shadow: none !important;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05);
}

.modal-close svg {
    stroke: currentColor;
    display: block;
}

#fbTagWrap:focus-within,
#fbBulkTagWrap:focus-within {
    border-color: var(--orange-500) !important;
    box-shadow: 0 0 0 3px rgba(209, 124, 43, 0.15);
}

/* =====================================================
   EMAIL MARKETING TEMPLATES NEW UI/UX STYLES
   ===================================================== */

/* Audience filter chips */
.tmpl-audience-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-600);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.tmpl-audience-chip:hover { border-color: var(--orange-400); color: var(--orange-600); }
.tmpl-audience-chip.active { background: var(--orange-50,#fff7ed); border-color: var(--orange-400); color: var(--orange-700,#b45309); font-weight: 600; }
body[data-admin-theme="dark"] .tmpl-audience-chip { background: var(--dk-surface); border-color: var(--dk-border); color: var(--dk-text-muted); }
body[data-admin-theme="dark"] .tmpl-audience-chip.active { background: rgba(209,124,43,0.15); border-color: var(--orange-500); color: var(--orange-400); }

/* Grid and Card Layout */
.tmpl-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 10px 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}
.tmpl-search-bar:focus-within {
    border-color: var(--orange-500);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(209, 124, 43, 0.1);
}
.tmpl-search-input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--gray-800);
    width: 100%;
}
.tmpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.tmpl-card {
    background: #ffffff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 380px;
    transition: all var(--transition-base);
}
.tmpl-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 12px 24px -8px rgba(0, 0, 0, 0.08);
    border-color: var(--orange-300);
}
.tmpl-card-preview-wrap {
    height: 200px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Hover overlay: darkens preview + shows zoom icon on hover */
.tmpl-card-preview-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(10, 10, 10, 0);
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tmpl-card-preview-wrap:hover::after {
    background: rgba(10, 10, 10, 0.35);
}
.tmpl-preview-zoom-icon {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.tmpl-card-preview-wrap:hover .tmpl-preview-zoom-icon {
    opacity: 1;
}
.tmpl-card-iframe-scaled {
    width: 800px;
    height: 500px;
    border: none;
    transform: scale(0.38);
    transform-origin: center center;
    pointer-events: none;
    position: absolute;
    background: white;
}
.tmpl-card-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--gray-400);
    text-align: center;
}
.tmpl-card-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.tmpl-card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 6px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tmpl-card-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: auto;
}
.tmpl-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--gray-100);
    padding-top: 12px;
    margin-top: 12px;
}

/* Preset Picker Modal */
.tmpl-preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}
.tmpl-preset-card {
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    background: white;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}
.tmpl-preset-card:hover {
    border-color: var(--orange-400);
    background: var(--orange-50);
}
.tmpl-preset-card.selected {
    border-color: var(--orange-500);
    background: var(--orange-50);
    box-shadow: 0 0 0 3px rgba(209, 124, 43, 0.15);
}
.tmpl-preset-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gray-800);
}
.tmpl-preset-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.4;
}

/* Split Editor Layout */
.tmpl-editor-split {
    display: flex;
    gap: 24px;
    align-items: stretch;
    min-height: 700px;
    margin-top: 16px;
}
.tmpl-editor-pane {
    flex: 1.2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.tmpl-preview-pane {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    background: var(--gray-100);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: sticky;
    top: 80px;
    height: calc(100vh - 120px);
}
.tmpl-preview-header {
    background: #ffffff;
    border-bottom: 1px solid var(--gray-200);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.tmpl-preview-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gray-600);
}
.tmpl-preview-modes {
    display: flex;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--gray-200);
}
.tmpl-preview-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--gray-500);
    transition: all var(--transition-fast);
}
.tmpl-preview-btn.active {
    background: #ffffff;
    color: var(--gray-800);
    box-shadow: var(--shadow-xs);
}
.tmpl-preview-frame-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
    position: relative;
}
.tmpl-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: width 0.3s ease, border-radius 0.3s ease;
}
.tmpl-iframe.mobile {
    width: 375px;
    height: 100%;
    max-height: 667px;
    border: 12px solid #1a1a1a;
    border-radius: 36px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* CodeMirror customization */
.CodeMirror {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    height: 480px !important;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.CodeMirror-focused {
    border-color: var(--orange-500);
}

/* Dark theme overrides for our new UI */
body[data-admin-theme="dark"] .tmpl-search-bar {
    background: var(--dk-surface);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .tmpl-search-input {
    color: var(--dk-text);
}
body[data-admin-theme="dark"] .tmpl-card {
    background: var(--dk-surface);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .tmpl-card:hover {
    border-color: var(--dk-orange);
}
body[data-admin-theme="dark"] .tmpl-card-preview-wrap {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .tmpl-card-title {
    color: var(--dk-text);
}
body[data-admin-theme="dark"] .tmpl-card-date {
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .tmpl-card-actions {
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .tmpl-preset-card {
    background: var(--dk-surface);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .tmpl-preset-card:hover {
    border-color: var(--dk-orange);
    background: rgba(209,124,43,0.06);
}
body[data-admin-theme="dark"] .tmpl-preset-card.selected {
    border-color: var(--dk-orange);
    background: rgba(209,124,43,0.1);
}
body[data-admin-theme="dark"] .tmpl-preset-title {
    color: var(--dk-text);
}
body[data-admin-theme="dark"] .tmpl-preset-desc {
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .tmpl-preview-pane {
    border-color: var(--dk-border);
    background: var(--dk-surface2);
}
body[data-admin-theme="dark"] .tmpl-preview-header {
    background: var(--dk-surface);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .tmpl-preview-title {
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .tmpl-preview-modes {
    background: var(--dk-surface2);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .tmpl-preview-btn {
    color: var(--dk-text2);
}
body[data-admin-theme="dark"] .tmpl-preview-btn.active {
    background: var(--dk-surface);
    color: var(--dk-text);
}

/* ==================== PROFILE MODAL TABS ==================== */
.profile-tabs {
    display: flex;
    gap: 8px;
    padding: 0 32px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    overflow-x: auto;
    scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar {
    display: none;
}
.profile-tab-btn {
    padding: 14px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 700;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    outline: none;
}
.profile-tab-btn:hover {
    color: var(--gray-800);
    border-bottom-color: var(--gray-300);
}
.profile-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ==================== GALERIA MULTIMÉDIA ==================== */

/* Page header */
.gallery-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.gallery-page-header__left { display: flex; align-items: center; gap: 16px; }
.gallery-page-header__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.gallery-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}
.gallery-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-500);
}

/* Drop zone */
.gallery-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed var(--gray-300);
    border-radius: 16px;
    padding: 48px 24px;
    background: var(--gray-50);
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 24px;
    cursor: pointer;
}
.gallery-dropzone.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}
.gallery-dropzone__icon {
    color: var(--gray-300);
    margin-bottom: 4px;
}
.gallery-dropzone__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-600);
    margin: 0;
}
.gallery-dropzone__sub {
    font-size: 0.82rem;
    color: var(--gray-400);
    margin: 0;
}

/* Progress bar */
.gallery-upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 20px;
}
.gallery-upload-progress__bar {
    flex: 1;
    height: 6px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}
.gallery-upload-progress__fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0%;
}
.gallery-upload-progress__label {
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    min-width: 120px;
}

/* Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.gallery-empty {
    grid-column: 1/-1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 48px 0;
    color: var(--gray-400);
    text-align: center;
}
.gallery-empty p { margin: 0; font-size: 0.9rem; }

/* Card */
.gallery-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.gallery-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

.gallery-card__thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--gray-100);
    cursor: pointer;
}
.gallery-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.gallery-card:hover .gallery-card__thumb img {
    transform: scale(1.05);
}
.gallery-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.gallery-card:hover .gallery-card__overlay { opacity: 1; }

.gallery-card__body {
    padding: 12px 14px;
}
.gallery-card__title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 3px;
}
.gallery-card__description {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 8px;
    line-height: 1.4;
}
.gallery-card__description--empty {
    color: var(--gray-300);
    font-style: italic;
}
.gallery-card__meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-bottom: 10px;
}
.gallery-card__actions {
    display: flex;
    gap: 6px;
}

/* Upload metadata modal rows */
.gallery-meta-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
}
.gallery-meta-row__preview {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-300);
}
.gallery-meta-row__fields {
    flex: 1;
    min-width: 0;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.gallery-lightbox.visible { opacity: 1; }

.gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 20, 0.92);
    backdrop-filter: blur(6px);
}

.gallery-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.gallery-lightbox__close:hover { background: rgba(255,255,255,0.2); }

.gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
}
.gallery-lightbox__nav:hover { background: rgba(255,255,255,0.2); }
.gallery-lightbox__nav--prev { left: 16px; }
.gallery-lightbox__nav--next { right: 16px; }

.gallery-lightbox__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: min(90vw, 900px);
    max-height: 90vh;
}
.gallery-lightbox__img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 24px 48px rgba(0,0,0,0.5);
}
.gallery-lightbox__info {
    text-align: center;
}
.gallery-lightbox__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    margin: 0 0 4px;
}
.gallery-lightbox__desc {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.7);
    margin: 0 0 4px;
    line-height: 1.4;
}
.gallery-lightbox__meta {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
    margin: 0;
}

/* Dark mode */
body[data-admin-theme="dark"] .gallery-card {
    background: var(--dk-surface);
    border-color: var(--dk-border);
}
body[data-admin-theme="dark"] .gallery-card__title { color: var(--dk-text); }
body[data-admin-theme="dark"] .gallery-card__description { color: var(--dk-muted); }
body[data-admin-theme="dark"] .gallery-card__meta { color: var(--dk-muted); }
body[data-admin-theme="dark"] .gallery-meta-row__preview {
    border-color: var(--dk-border);
    background: var(--dk-surface2);
}
body[data-admin-theme="dark"] .gallery-dropzone {
    border-color: var(--dk-border);
    background: var(--dk-surface2);
}
body[data-admin-theme="dark"] .gallery-dropzone__title { color: var(--dk-text); }
body[data-admin-theme="dark"] .gallery-upload-progress {
    background: var(--dk-surface);
    border-color: var(--dk-border);
}

/* ==================== TEMPLATE ARCHIVE PILLS ==================== */
.tpl-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 4px;
}
.tpl-filter-pill {
    padding: 6px 14px;
    border-radius: 7px;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.tpl-filter-pill:hover { color: var(--gray-800); }
.tpl-filter-pill.active {
    background: white;
    color: var(--gray-900);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.tpl-archived-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 5px;
    margin-bottom: 6px;
}

.fb-template-card--archived {
    opacity: 0.65;
    filter: grayscale(0.3);
}
.fb-template-card--archived:hover {
    opacity: 0.85;
    filter: grayscale(0);
}

body[data-admin-theme="dark"] .tpl-filter-bar {
    background: var(--dk-surface2);
}
body[data-admin-theme="dark"] .tpl-filter-pill.active {
    background: var(--dk-surface);
}
body[data-admin-theme="dark"] .tpl-filter-pill { color: var(--dk-muted); }

/* =====================================================
   ANALYTICS MODULE — Redesigned Styles
   ===================================================== */

/* ── Skeleton ── */
.an-skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: anSkeletonShimmer 1.4s infinite;
    border-radius: var(--radius-md);
}
@keyframes anSkeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Page Header ── */
.an-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}
.an-title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.an-period-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    font-family: var(--font-body);
}
.an-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.5;
}
.an-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ── Period Selector ── */
.an-period-group {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.an-period-btn {
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--gray-500);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.an-period-btn:hover { color: var(--gray-900); background: rgba(0,0,0,0.05); }
.an-period-btn.active {
    background: white;
    color: var(--gray-900);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* ── Cards ── */
.an-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.an-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07), 0 8px 24px rgba(0,0,0,0.05); }

.an-card-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.an-card-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.an-card-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}
.an-card-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 2px 9px;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    font-family: var(--font-body);
}
.an-card-body {
    padding: 20px 24px;
}
.an-card-body--list {
    padding: 8px 0;
}

/* ── Chart Wrappers ── */
.an-chart-wrap {
    position: relative;
    height: 260px;
    width: 100%;
}
.an-chart-wrap--md {
    height: 220px;
}

/* ── Legend ── */
.an-legend {
    display: flex;
    align-items: center;
    font-size: 0.78rem;
    color: var(--gray-500);
    flex-wrap: wrap;
    gap: 4px;
    font-family: var(--font-body);
}
.an-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* ── KPI Row ── */
.an-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.an-kpi-row--sm {
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 28px;
}
@media (max-width: 1280px) { .an-kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1400px) { .an-kpi-row--sm { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .an-kpi-row--sm { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .an-kpi-row { grid-template-columns: 1fr 1fr; } .an-kpi-row--sm { grid-template-columns: 1fr 1fr; } }

/* ── KPI Card ── */
.an-kpi {
    padding: 20px;
    position: relative;
    cursor: default;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.an-kpi-accent {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0.8;
}
.an-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    flex-shrink: 0;
}
.an-kpi-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--gray-900);
    transition: color 0.2s;
}
.an-kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    font-family: var(--font-body);
}
.an-kpi-sub {
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-body);
}

/* ── KPI Small Card ── */
.an-kpi-sm {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.an-kpi-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.an-kpi-sm-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}
.an-kpi-sm-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    font-family: var(--font-body);
}

/* ── Grid Layouts ── */
.an-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) { .an-grid-2 { grid-template-columns: 1fr; } }

/* ── Donut ── */
.an-donut-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}
.an-donut-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}
.an-donut-num {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
}
.an-donut-lbl {
    font-size: 0.72rem;
    color: var(--gray-400);
    font-family: var(--font-body);
    font-weight: 500;
}
.an-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-left: 24px;
    flex: 1;
    min-width: 0;
}
.an-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.an-donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.an-donut-legend-label {
    font-size: 0.8rem;
    color: var(--gray-700);
    font-family: var(--font-body);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.an-donut-legend-pct {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-400);
    font-family: var(--font-body);
    flex-shrink: 0;
}

/* ── Search List ── */
.an-search-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
}
.an-search-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 24px;
    transition: background 0.1s;
}
.an-search-item:hover { background: var(--gray-50); }
.an-search-rank {
    font-size: 0.72rem;
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--gray-300);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    padding-top: 2px;
}
.an-search-content {
    flex: 1;
    min-width: 0;
}
.an-search-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.an-search-term {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    font-family: var(--font-body);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.an-search-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-400);
    font-family: var(--font-body);
    flex-shrink: 0;
}
.an-search-bar-wrap {
    height: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.an-search-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--orange-500), var(--orange-300));
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Integrations ── */
.an-integrations {
    border: 1.5px solid rgba(209,124,43,0.2);
    background: linear-gradient(160deg, white 60%, var(--orange-50) 100%);
}
.an-integrations-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.an-integration-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}
.an-integration-item:last-child { border-bottom: none; }
.an-integration-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--gray-100);
}
.an-integration-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--gray-800);
    font-family: var(--font-body);
    margin-bottom: 2px;
}
.an-integration-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-family: var(--font-body);
}
.an-badge-em {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    background: var(--orange-50);
    color: var(--orange-600);
    border: 1px solid rgba(209,124,43,0.2);
    white-space: nowrap;
}

/* ── Dark Mode ── */
body[data-admin-theme="dark"] .an-skeleton {
    background: linear-gradient(90deg, var(--dk-surface2) 25%, var(--dk-surface3) 50%, var(--dk-surface2) 75%);
    background-size: 200% 100%;
}
body[data-admin-theme="dark"] .an-card {
    background: var(--dk-surface);
    border-color: var(--dk-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
body[data-admin-theme="dark"] .an-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.3);
}
body[data-admin-theme="dark"] .an-card-header { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .an-card-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .an-card-badge { background: var(--dk-surface3); color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .an-period-label { background: var(--dk-surface3); color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-period-group { background: var(--dk-surface2); }
body[data-admin-theme="dark"] .an-period-btn:hover { background: rgba(255,255,255,0.06); color: var(--dk-text); }
body[data-admin-theme="dark"] .an-period-btn.active { background: var(--dk-surface3); color: var(--dk-text); box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
body[data-admin-theme="dark"] .an-kpi-value { color: var(--dk-text); }
body[data-admin-theme="dark"] .an-kpi-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-kpi-sm-value { opacity: 1; }
body[data-admin-theme="dark"] .an-kpi-sm-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-donut-num { color: var(--dk-text); }
body[data-admin-theme="dark"] .an-donut-lbl { color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-donut-legend-label { color: var(--dk-text2); }
body[data-admin-theme="dark"] .an-donut-legend-pct { color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-search-item:hover { background: var(--dk-hover); }
body[data-admin-theme="dark"] .an-search-rank { color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-search-term { color: var(--dk-text); }
body[data-admin-theme="dark"] .an-search-count { color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-search-bar-wrap { background: var(--dk-surface3); }
body[data-admin-theme="dark"] .an-integrations {
    background: linear-gradient(160deg, var(--dk-surface) 60%, rgba(209,124,43,0.06) 100%);
    border-color: rgba(209,124,43,0.25);
}
body[data-admin-theme="dark"] .an-integration-item { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .an-integration-icon { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .an-integration-name { color: var(--dk-text); }
body[data-admin-theme="dark"] .an-integration-desc { color: var(--dk-muted); }
body[data-admin-theme="dark"] .an-badge-em { background: var(--dk-orange-s); color: #fdba74; border-color: rgba(249,115,22,0.3); }
body[data-admin-theme="dark"] .tpl-filter-pill.active { color: var(--dk-text); }

/* =====================================================
   ACTIVITY MODULE — Redesigned Styles
   ===================================================== */

/* ── Header ── */
.act-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.act-title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0 0 4px;
}
.act-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

/* ── KPI Row ── */
.act-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
@media (max-width: 900px) { .act-kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .act-kpi-row { grid-template-columns: 1fr 1fr; } }

.act-kpi-card {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.act-kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}
.act-kpi-val {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
}
.act-kpi-lbl {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--gray-500);
    font-family: var(--font-body);
}

/* ── Toolbar ── */
.act-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
}
.act-pills-wrap {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.act-pill {
    padding: 5px 13px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--gray-500);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.act-pill:hover {
    border-color: var(--gray-400);
    color: var(--gray-800);
    background: var(--gray-50);
}
.act-pill.active {
    background: var(--blue-900);
    border-color: var(--blue-900);
    color: white;
}

/* ── Search ── */
.act-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    min-width: 200px;
    transition: border-color 0.15s;
}
.act-search-box:focus-within {
    border-color: var(--orange-500);
    background: white;
    box-shadow: 0 0 0 3px rgba(209,124,43,0.08);
}
.act-search-box svg { color: var(--gray-400); flex-shrink: 0; }
.act-search-box input {
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-family: var(--font-body);
    color: var(--gray-800);
    outline: none;
    width: 100%;
}
.act-search-box input::placeholder { color: var(--gray-400); }

/* ── Feed ── */
.act-feed {
    padding: 0;
}
.act-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--gray-400);
    font-size: 0.875rem;
}
.act-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--gray-400);
    font-size: 0.875rem;
}
.act-empty svg { opacity: 0.35; }

/* ── Day Group ── */
.act-day-group { padding: 0; }
.act-day-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    font-family: var(--font-body);
    padding: 14px 20px 8px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    z-index: 2;
}
.act-day-group:first-child .act-day-label { border-top: none; }

/* ── Item ── */
.act-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 20px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.1s;
}
.act-item:last-child { border-bottom: none; }
.act-item:hover { background: var(--gray-50); }

.act-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.act-item-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    font-family: var(--font-display);
    flex-shrink: 0;
    margin-top: 1px;
}
.act-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.act-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.act-item-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    white-space: nowrap;
}
.act-item-user {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-800);
    font-family: var(--font-body);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.act-anon {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--gray-400);
    font-family: var(--font-mono, monospace);
}
.act-role-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: rgba(15,26,56,0.1);
    color: var(--blue-900);
    font-family: var(--font-body);
}
.act-item-detail {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-family: var(--font-body);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 480px;
}
.act-detail-link {
    color: var(--orange-600);
    font-weight: 600;
    text-decoration: none;
}
.act-detail-link:hover { text-decoration: underline; }
.act-detail-q {
    color: var(--gray-700);
    font-weight: 600;
}
.act-detail-path {
    color: var(--gray-500);
    font-family: var(--font-mono, monospace);
    font-size: 0.76rem;
}
.act-detail-mono {
    color: var(--gray-400);
    font-family: var(--font-mono, monospace);
    font-size: 0.76rem;
    margin-left: 4px;
}
.act-detail-muted { color: var(--gray-400); }

.act-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
    min-width: 80px;
}
.act-item-time {
    font-size: 0.72rem;
    color: var(--gray-400);
    font-family: var(--font-body);
    white-space: nowrap;
}
.act-item-ip {
    font-size: 0.68rem;
    color: var(--gray-300);
    font-family: var(--font-mono, monospace);
    white-space: nowrap;
}

/* ── Pagination ── */
.act-pagination-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--gray-100);
    flex-wrap: wrap;
}
.act-pag-info {
    font-size: 0.8rem;
    color: var(--gray-400);
    font-family: var(--font-body);
    white-space: nowrap;
}

/* ── Dark Mode ── */
body[data-admin-theme="dark"] .act-title     { color: var(--dk-text); }
body[data-admin-theme="dark"] .act-subtitle  { color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-kpi-val   { color: var(--dk-text); }
body[data-admin-theme="dark"] .act-kpi-lbl   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-toolbar   { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .act-pill      { border-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-pill:hover { border-color: var(--dk-border2); color: var(--dk-text); background: var(--dk-hover); }
body[data-admin-theme="dark"] .act-pill.active { background: var(--blue-700); border-color: var(--blue-700); color: white; }
body[data-admin-theme="dark"] .act-search-box { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .act-search-box:focus-within { border-color: var(--dk-orange); background: var(--dk-surface3); box-shadow: 0 0 0 3px rgba(249,115,22,0.1); }
body[data-admin-theme="dark"] .act-search-box input { color: var(--dk-text); }
body[data-admin-theme="dark"] .act-search-box input::placeholder { color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-day-label { background: var(--dk-surface2); border-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-item:hover { background: var(--dk-hover); }
body[data-admin-theme="dark"] .act-item { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .act-item-user { color: var(--dk-text); }
body[data-admin-theme="dark"] .act-item-detail { color: var(--dk-text2); }
body[data-admin-theme="dark"] .act-detail-q   { color: var(--dk-text); }
body[data-admin-theme="dark"] .act-detail-link { color: #fdba74; }
body[data-admin-theme="dark"] .act-detail-path { color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-detail-mono { color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-detail-muted { color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-item-time { color: var(--dk-muted); }
body[data-admin-theme="dark"] .act-item-ip   { color: var(--dk-muted); opacity: 0.5; }
body[data-admin-theme="dark"] .act-role-badge { background: rgba(25,39,82,0.5); color: #93c5fd; }
body[data-admin-theme="dark"] .act-pagination-wrap { border-top-color: var(--dk-border); }
body[data-admin-theme="dark"] .act-pag-info  { color: var(--dk-muted); }

/* =====================================================
   REPORTS MODULE — Redesigned Styles
   ===================================================== */

/* ── Header ── */
.rep-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.rep-title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0 0 4px;
}
.rep-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

/* ── Layout ── */
.rep-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}
.rep-layout > .rep-main { min-width: 0; overflow: hidden; }
@media (max-width: 960px) { .rep-layout { grid-template-columns: 1fr; } }

/* ── Sidebar / Config ── */
.rep-config-card {
    padding: 0;
    overflow: hidden;
    position: sticky;
    top: 80px;
}
.rep-config-section {
    padding: 20px;
}
.rep-divider {
    height: 1px;
    background: var(--gray-100);
}
.rep-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    font-family: var(--font-body);
    margin-bottom: 12px;
}

/* ── Type Cards ── */
.rep-type-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rep-type-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.rep-type-card:hover {
    background: var(--rep-bg, var(--gray-50));
    border-color: var(--rep-color, var(--gray-200));
}
.rep-type-card.active {
    background: var(--rep-bg, var(--gray-50));
    border-color: var(--rep-color, var(--gray-300));
}
.rep-type-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--rep-bg, var(--gray-100));
    color: var(--rep-color, var(--gray-500));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.rep-type-card.active .rep-type-icon {
    background: var(--rep-color, var(--gray-500));
    color: white;
}
.rep-type-info {
    flex: 1;
    min-width: 0;
}
.rep-type-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-800);
    font-family: var(--font-body);
    line-height: 1.3;
}
.rep-type-desc {
    font-size: 0.74rem;
    color: var(--gray-400);
    font-family: var(--font-body);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rep-type-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: transparent;
    transition: all 0.15s;
}
.rep-type-card.active .rep-type-check {
    background: var(--rep-color, var(--gray-500));
    border-color: var(--rep-color, var(--gray-500));
    color: white;
}

/* ── Period Pills ── */
.rep-pills-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.rep-pill {
    padding: 7px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--gray-500);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}
.rep-pill:hover {
    border-color: var(--gray-400);
    color: var(--gray-800);
    background: var(--gray-50);
}
.rep-pill.active {
    background: var(--blue-900);
    border-color: var(--blue-900);
    color: white;
}
.rep-period-note {
    font-size: 0.74rem;
    color: var(--gray-400);
    font-family: var(--font-body);
    margin: 0;
    line-height: 1.4;
}

/* ── Generate Button ── */
.rep-generate-btn {
    width: 100%;
    justify-content: center;
}

/* ── Empty State ── */
.rep-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 64px 24px;
    color: var(--gray-400);
    text-align: center;
}
.rep-empty-state svg { opacity: 0.3; }
.rep-empty-state h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-600);
    margin: 0;
}
.rep-empty-state p {
    font-size: 0.85rem;
    color: var(--gray-400);
    margin: 0;
    max-width: 280px;
    line-height: 1.5;
}

/* ── Preview Header ── */
.rep-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--gray-100);
}
.rep-preview-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.rep-preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
}
.rep-preview-count {
    font-size: 0.875rem;
    color: var(--gray-700);
    font-family: var(--font-body);
}
.rep-preview-note {
    font-size: 0.78rem;
    color: var(--gray-400);
    font-family: var(--font-body);
}

/* ── Export Buttons ── */
.rep-export-btns {
    display: flex;
    gap: 8px;
}
.rep-btn-excel {
    background: #10b981;
    border-color: #10b981;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.rep-btn-excel:hover { background: #059669; border-color: #059669; color: white; }
.rep-btn-pdf {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.rep-btn-pdf:hover { background: #dc2626; border-color: #dc2626; color: white; }

/* ── Column Selector ── */
.rep-col-selector {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}
.rep-col-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-600);
    font-family: var(--font-body);
    white-space: nowrap;
    padding-top: 2px;
}
.rep-col-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}
.rep-col-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--gray-600);
    font-family: var(--font-body);
    cursor: pointer;
}
.rep-col-check input[type="checkbox"] {
    accent-color: var(--orange-500);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* ── Table Wrap ── */
.rep-table-wrap {
    max-height: 480px;
    overflow-y: auto;
    overflow-x: auto;
}
.rep-more-row {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.8rem;
    font-family: var(--font-body);
    padding: 12px !important;
    background: var(--gray-50);
    font-style: italic;
}

/* ── Dark Mode ── */
body[data-admin-theme="dark"] .rep-title    { color: var(--dk-text); }
body[data-admin-theme="dark"] .rep-subtitle { color: var(--dk-muted); }
body[data-admin-theme="dark"] .rep-divider  { background: var(--dk-border); }
body[data-admin-theme="dark"] .rep-section-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] .rep-type-card:hover { background: var(--dk-hover); border-color: var(--dk-border2); }
body[data-admin-theme="dark"] .rep-type-card.active { background: var(--dk-surface2); border-color: var(--rep-color, var(--dk-border2)); }
body[data-admin-theme="dark"] .rep-type-label { color: var(--dk-text); }
body[data-admin-theme="dark"] .rep-type-desc  { color: var(--dk-muted); }
body[data-admin-theme="dark"] .rep-type-check { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .rep-pill       { border-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .rep-pill:hover { border-color: var(--dk-border2); color: var(--dk-text); background: var(--dk-hover); }
body[data-admin-theme="dark"] .rep-pill.active { background: var(--blue-700); border-color: var(--blue-700); color: white; }
body[data-admin-theme="dark"] .rep-period-note { color: var(--dk-muted); }
body[data-admin-theme="dark"] .rep-empty-state h3 { color: var(--dk-text2); }
body[data-admin-theme="dark"] .rep-preview-header { border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .rep-preview-count  { color: var(--dk-text2); }
body[data-admin-theme="dark"] .rep-preview-note   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .rep-col-selector   { background: var(--dk-surface2); border-bottom-color: var(--dk-border); }
body[data-admin-theme="dark"] .rep-col-label { color: var(--dk-text2); }
body[data-admin-theme="dark"] .rep-col-check { color: var(--dk-text2); }
body[data-admin-theme="dark"] .rep-col-check input { accent-color: var(--dk-orange); }
body[data-admin-theme="dark"] .rep-table-wrap { scrollbar-color: var(--dk-border) transparent; }
body[data-admin-theme="dark"] .rep-more-row   { background: var(--dk-surface2); color: var(--dk-muted); }


/* ====================================================
   ANGEL STYLES (ang-*)
   ==================================================== */

.ang-shell { padding: 0; overflow: hidden; }
.ang-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); background: var(--bg-primary); }
.ang-header-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 700; color: var(--gray-900); margin: 0 0 4px; }
.ang-header-title svg { color: var(--primary-color, #e85d04); flex-shrink: 0; }
.ang-header-sub { font-size: 0.82rem; color: var(--gray-500); margin: 0; }

.ang-source-bar { display: flex; flex-wrap: wrap; background: var(--gray-50, #f9fafb); border-bottom: 1px solid var(--border-color); padding: 0 4px; }
.ang-source-btn { display: flex; align-items: center; gap: 7px; padding: 10px 20px; border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--gray-500); transition: color 0.15s, border-color 0.15s; white-space: nowrap; }
.ang-source-btn:hover:not(.active) { color: var(--gray-700); }
.ang-source-btn.active.site { border-bottom-color: var(--blue-600, #2563eb); color: var(--blue-600, #2563eb); font-weight: 700; }
.ang-source-btn.active.wa { border-bottom-color: #25d366; color: #128C7E; font-weight: 700; }

.ang-tab-bar { display: flex; flex-wrap: wrap; background: var(--bg-primary); border-bottom: 1px solid var(--border-color); }
.ang-tab-btn { padding: 10px 18px; border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--gray-600); transition: color 0.15s, background 0.15s, border-color 0.15s; white-space: nowrap; }
.ang-tab-btn:hover:not(.active) { color: var(--gray-800); background: var(--gray-50, #f9fafb); }
.ang-tab-btn.active { border-bottom-color: var(--ang-accent, var(--blue-600, #2563eb)); color: var(--ang-accent, var(--blue-600, #2563eb)); font-weight: 700; }

.ang-content { padding: 24px; }

.ang-error { display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; color: #dc2626; font-size: 0.875rem; }

.ang-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.ang-count { font-size: 0.85rem; color: var(--gray-500); font-weight: 500; }

.ang-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border-color); }
.ang-table { margin: 0; border: none; border-radius: 0; }
.ang-table thead tr th { background: var(--gray-50, #f9fafb); }
.ang-table-empty { text-align: center; color: var(--gray-400); padding: 36px 20px; font-size: 0.875rem; }

.ang-td-mono { white-space: nowrap; font-size: 0.8rem; }
.ang-td-ellipsis { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ang-code { font-size: 0.76rem; background: var(--gray-100, #f3f4f6); padding: 2px 6px; border-radius: 4px; color: var(--gray-700); }
.ang-msg-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; background: var(--gray-100, #f3f4f6); border-radius: 999px; font-size: 0.78rem; font-weight: 600; color: var(--gray-700); }

.ang-log-row { cursor: pointer; }
.ang-log-row:hover td { background: var(--gray-50, #f9fafb); }

.ang-badge { display: inline-block; font-size: 0.73rem; padding: 2px 9px; border-radius: 999px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.ang-badge-gray   { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.ang-badge-green  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.ang-badge-red    { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.ang-badge-blue   { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.ang-badge-yellow { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.ang-badge-purple { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.ang-badge-auto   { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; font-size: 0.7rem; }

.ang-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }
.ang-avatar-blue { background: #dbeafe; color: #1d4ed8; }
.ang-user-cell { display: flex; align-items: center; gap: 8px; }
.ang-user-label { font-size: 0.82rem; color: var(--gray-700); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ang-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ang-pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.ang-page-info { font-size: 0.85rem; color: var(--gray-500); }

.ang-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-bottom: 28px; }
.ang-kpi-card { background: var(--bg-secondary, #f9fafb); border: 1px solid var(--border-color); border-radius: 12px; padding: 18px 16px; text-align: center; transition: transform 0.15s, box-shadow 0.15s; }
.ang-kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.ang-kpi-value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.ang-kpi-label { font-size: 0.75rem; color: var(--gray-500); font-weight: 500; }

.ang-chart-section { margin-top: 4px; }
.ang-section-title { font-size: 0.875rem; font-weight: 700; color: var(--gray-700); margin: 0 0 14px; }
.ang-bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 80px; padding-bottom: 2px; }
.ang-bar-chart-bar { flex: 1; border-radius: 3px 3px 0 0; min-width: 3px; transition: opacity 0.15s; cursor: default; }
.ang-bar-chart-bar:hover { opacity: 0.7; }
.ang-bar-axis { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--gray-400); margin-top: 6px; }

.ang-kb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }

.ang-learn-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ang-learn-stats { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.ang-learn-stat-card { border-radius: 10px; padding: 14px 18px; text-align: center; flex: 1; min-width: 100px; }
.ang-learn-stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.ang-learn-stat-label { font-size: 0.75rem; opacity: 0.85; }

.ang-learn-timeline { display: flex; flex-direction: column; gap: 20px; }
.ang-learn-day-label { font-size: 0.75rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-color); }
.ang-learn-item { border: 1px solid var(--border-color); border-radius: 10px; padding: 14px; background: var(--bg-primary); margin-bottom: 8px; transition: box-shadow 0.15s; }
.ang-learn-item:last-child { margin-bottom: 0; }
.ang-learn-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.ang-learn-item.inactive { background: var(--gray-50, #f9fafb); opacity: 0.7; }
.ang-learn-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.ang-learn-item-title { font-size: 0.85rem; font-weight: 600; color: var(--gray-800); margin-bottom: 4px; }
.ang-learn-item-body  { font-size: 0.82rem; color: var(--gray-600); line-height: 1.5; }
.ang-learn-item-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

.ang-settings-status { border-radius: 12px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.ang-settings-status.active   { background: #f0fdf4; border: 1px solid #bbf7d0; }
.ang-settings-status.inactive { background: #fef2f2; border: 1px solid #fecaca; }
.ang-settings-status-title { font-weight: 700; font-size: 0.95rem; }
.ang-settings-status.active   .ang-settings-status-title { color: #15803d; }
.ang-settings-status.inactive .ang-settings-status-title { color: #dc2626; }
.ang-settings-status-sub { font-size: 0.82rem; color: var(--gray-500); margin-top: 2px; }

.ang-settings-section { border: 1px solid var(--border-color); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; background: var(--bg-primary); }
.ang-settings-section-title { font-size: 0.875rem; font-weight: 700; color: var(--gray-700); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.ang-settings-label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 5px; color: var(--gray-800); }
.ang-settings-hint  { font-size: 0.78rem; color: var(--gray-400); margin: 4px 0 0; }
.ang-settings-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.ang-chip-item { display: flex; align-items: center; gap: 10px; background: var(--gray-50, #f9fafb); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; }
.ang-chip-emoji { font-size: 1.2rem; width: 28px; text-align: center; flex-shrink: 0; }
.ang-chip-label { flex: 1; font-size: 0.875rem; font-weight: 500; color: var(--gray-700); }
.ang-chip-remove { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 1rem; padding: 0 4px; line-height: 1; transition: color 0.15s; }
.ang-chip-remove:hover { color: #dc2626; }

.ang-conv-bar-wrap { background: var(--bg-secondary, #f9fafb); border: 1px solid var(--border-color); border-radius: 12px; padding: 18px 20px; margin-bottom: 20px; }
.ang-conv-bar-row { margin-bottom: 14px; }
.ang-conv-bar-row:last-child { margin-bottom: 0; }
.ang-conv-bar-header { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 5px; }
.ang-conv-bar-label { color: var(--gray-600); }
.ang-conv-bar-value { font-weight: 700; }
.ang-conv-bar-track { background: #e5e7eb; border-radius: 999px; height: 8px; overflow: hidden; }
.ang-conv-bar-fill  { height: 100%; border-radius: 999px; transition: width 0.4s; }

.ang-alert { display: flex; align-items: flex-start; gap: 10px; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 0.83rem; }
.ang-alert svg { flex-shrink: 0; margin-top: 1px; }
.ang-alert-red   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.ang-alert-green { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

.ang-empty { text-align: center; padding: 48px 20px; }
.ang-empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.ang-empty-text { font-size: 0.875rem; color: var(--gray-500); margin: 0; }
.ang-empty-sub  { font-size: 0.8rem;  color: var(--gray-400); margin: 6px 0 0; }

/* Dark mode */
body[data-admin-theme="dark"] .ang-header        { background: var(--dk-surface); }
body[data-admin-theme="dark"] .ang-header-title  { color: var(--dk-text); }
body[data-admin-theme="dark"] .ang-header-sub    { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-source-bar    { background: var(--dk-surface2); }
body[data-admin-theme="dark"] .ang-source-btn    { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-source-btn:hover:not(.active) { color: var(--dk-text2); }
body[data-admin-theme="dark"] .ang-tab-bar       { background: var(--dk-surface); }
body[data-admin-theme="dark"] .ang-tab-btn       { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-tab-btn:hover:not(.active) { background: var(--dk-hover); color: var(--dk-text); }
body[data-admin-theme="dark"] .ang-count         { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-table-wrap    { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-table thead tr th { background: var(--dk-surface2); }
body[data-admin-theme="dark"] .ang-table-empty   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-code          { background: var(--dk-surface2); color: var(--dk-text2); }
body[data-admin-theme="dark"] .ang-msg-count     { background: var(--dk-surface2); color: var(--dk-text2); }
body[data-admin-theme="dark"] .ang-log-row:hover td { background: var(--dk-hover); }
body[data-admin-theme="dark"] .ang-user-label    { color: var(--dk-text2); }
body[data-admin-theme="dark"] .ang-kpi-card      { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-kpi-label     { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-section-title { color: var(--dk-text2); }
body[data-admin-theme="dark"] .ang-bar-axis      { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-learn-day-label { color: var(--dk-muted); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-learn-item    { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-learn-item.inactive { background: var(--dk-surface); }
body[data-admin-theme="dark"] .ang-learn-item-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .ang-learn-item-body  { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-settings-section { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-settings-section-title { color: var(--dk-text2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-settings-label { color: var(--dk-text); }
body[data-admin-theme="dark"] .ang-settings-hint  { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-chip-item      { background: var(--dk-surface); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-chip-label     { color: var(--dk-text2); }
body[data-admin-theme="dark"] .ang-conv-bar-wrap  { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .ang-conv-bar-label { color: var(--dk-muted); }
body[data-admin-theme="dark"] .ang-conv-bar-track { background: var(--dk-border); }
body[data-admin-theme="dark"] .ang-page-info      { color: var(--dk-muted); }


/* ====================================================
   EMAIL MARKETING STYLES (em-*)
   ==================================================== */

/* Shell */
.em-shell { padding: 0; overflow: hidden; }

.em-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.em-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
}

.em-header-title svg { color: var(--primary-color, #e85d04); flex-shrink: 0; }
.em-header-sub { font-size: 0.82rem; color: var(--gray-500); margin: 0; }

/* Tab bar */
.em-tab-bar {
  display: flex;
  flex-wrap: wrap;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.em-tab-btn {
  padding: 10px 20px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.em-tab-btn:hover:not(.active) { color: var(--gray-800); background: var(--gray-50, #f9fafb); }

.em-tab-btn.active {
  border-bottom-color: var(--primary-color, #e85d04);
  color: var(--primary-color, #e85d04);
  font-weight: 700;
}

.em-content { padding: 24px; }

/* Alert */
.em-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 500;
}

.em-alert-blue { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.em-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
  display: inline-block;
}

/* KPI Grid */
.em-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.em-kpi-card {
  background: var(--em-bg, #f9fafb);
  border: 1px solid var(--em-border, var(--border-color));
  border-radius: 12px;
  padding: 18px 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.em-kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.em-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.em-kpi-label { font-size: 0.78rem; font-weight: 600; color: var(--gray-500); }

.em-kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.em-kpi-value { font-size: 1.9rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.em-kpi-sub   { font-size: 0.75rem; color: var(--gray-400); }

/* Dashboard layout */
.em-dash-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .em-dash-layout { grid-template-columns: 1fr; }
}

.em-dash-sidebar { display: flex; flex-direction: column; gap: 14px; }

.em-sidebar-title { margin: 0 0 12px; font-size: 0.88rem; font-weight: 700; color: var(--gray-700); }

.em-quick-actions { display: flex; flex-direction: column; gap: 8px; }

.em-pending-list { display: flex; flex-direction: column; gap: 6px; }

.em-pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--gray-50, #f9fafb);
  border-radius: 8px;
}

.em-pending-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.em-pending-name { font-size: 0.83rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray-800); }

/* Campaign filter bar */
.em-filter-bar {
  padding: 10px 16px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
}

.em-filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--gray-500);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.em-filter-tab:hover { border-color: var(--gray-300); color: var(--gray-700); }

.em-filter-tab.active {
  background: #fff7ed;
  border-color: var(--orange-400, #fb923c);
  color: var(--orange-600, #ea580c);
}

.em-filter-tab-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-500);
  font-weight: 700;
}

.em-filter-tab.active .em-filter-tab-count {
  background: var(--orange-500, #f97316);
  color: #fff;
}

/* Tipo badge */
.em-tipo-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.em-tipo-leads { background: #eff6ff; color: #2563eb; }
.em-tipo-forn  { background: #f5f3ff; color: #7c3aed; }

/* Estado badge */
.em-estado-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.em-estado-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }

.em-estado-enviada   { background: #d1fae5; color: #065f46; }
.em-estado-enviada   .em-estado-dot { background: #10b981; }

.em-estado-rascunho  { background: #fef3c7; color: #92400e; }
.em-estado-rascunho  .em-estado-dot { background: #f59e0b; }

.em-estado-aenviar   { background: #dbeafe; color: #1e40af; }
.em-estado-aenviar   .em-estado-dot { background: #3b82f6; }

.em-estado-agendada  { background: #f5f3ff; color: #5b21b6; }
.em-estado-agendada  .em-estado-dot { background: #8b5cf6; }

.em-estado-pausada   { background: #f3f4f6; color: #374151; }
.em-estado-pausada   .em-estado-dot { background: #9ca3af; }

.em-estado-arquivada { background: #f3f4f6; color: #6b7280; }
.em-estado-arquivada .em-estado-dot { background: #9ca3af; }

/* Menu button */
.em-menu-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--gray-500);
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.em-menu-btn:hover { border-color: var(--gray-300); background: var(--gray-50, #f9fafb); }

/* Table wrap */
.em-table-wrap {
  overflow-x: auto;
}

/* Dark mode */
body[data-admin-theme="dark"] .em-header       { background: var(--dk-surface); }
body[data-admin-theme="dark"] .em-header-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .em-header-sub   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .em-tab-bar      { background: var(--dk-surface); }
body[data-admin-theme="dark"] .em-tab-btn      { color: var(--dk-muted); }
body[data-admin-theme="dark"] .em-tab-btn:hover:not(.active) { background: var(--dk-hover); color: var(--dk-text); }
body[data-admin-theme="dark"] .em-kpi-card     { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .em-kpi-label    { color: var(--dk-muted); }
body[data-admin-theme="dark"] .em-kpi-sub      { color: var(--dk-muted); }
body[data-admin-theme="dark"] .em-sidebar-title { color: var(--dk-text2); }
body[data-admin-theme="dark"] .em-pending-item  { background: var(--dk-surface2); }
body[data-admin-theme="dark"] .em-pending-name  { color: var(--dk-text2); }
body[data-admin-theme="dark"] .em-filter-bar    { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .em-filter-tab    { background: var(--dk-surface2); border-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .em-filter-tab:hover { border-color: var(--dk-border2); color: var(--dk-text2); }
body[data-admin-theme="dark"] .em-filter-tab.active { background: #431407; border-color: #c2410c; color: #fed7aa; }
body[data-admin-theme="dark"] .em-filter-tab.active .em-filter-tab-count { background: #c2410c; }
body[data-admin-theme="dark"] .em-filter-tab-count { background: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .em-menu-btn { background: var(--dk-surface2); border-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .em-menu-btn:hover { background: var(--dk-hover); }


/* ====================================================
   FACEBOOK GROUPS STYLES (fb-shell / fb-kpi-* etc.)
   ==================================================== */

/* Shell */
.fb-shell { padding: 0; overflow: hidden; }

.fb-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.fb-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
}

.fb-header-title svg { color: #1877f2; flex-shrink: 0; }
.fb-header-sub { font-size: 0.82rem; color: var(--gray-500); margin: 0; }

/* Tab bar */
.fb-tab-bar {
  display: flex;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.fb-tab-btn {
  padding: 10px 20px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.fb-tab-btn:hover:not(.active) { color: var(--gray-800); background: var(--gray-50, #f9fafb); }

.fb-tab-btn.active {
  border-bottom-color: #1877f2;
  color: #1877f2;
  font-weight: 700;
}

.fb-content { padding: 24px; }

/* KPI grid */
.fb-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.fb-kpi-card {
  background: var(--fb-bg, #f9fafb);
  border: 1px solid var(--fb-border, var(--border-color));
  border-radius: 12px;
  padding: 18px 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.fb-kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.fb-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.fb-kpi-label { font-size: 0.78rem; font-weight: 600; color: var(--gray-500); }

.fb-kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fb-kpi-value    { font-size: 1.9rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.fb-kpi-value-sm { font-size: 1.1rem; font-weight: 700; line-height: 1.2; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-kpi-sub      { font-size: 0.75rem; color: var(--gray-400); }

/* Filter bar */
.fb-filter-bar {
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Bulk action bar */
.fb-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #1a1a2e;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  border: 2px solid #d17c2b;
  box-shadow: 0 4px 20px rgba(209, 124, 43, 0.25);
}

.fb-bulk-count {
  font-weight: 700;
  font-size: 0.9rem;
  color: #f5a623;
  background: rgba(245, 166, 35, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(245, 166, 35, 0.4);
  white-space: nowrap;
}

.fb-bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.fb-bulk-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.fb-bulk-btn--orange { background: var(--orange-500, #f97316); color: #fff; }
.fb-bulk-btn--blue   { background: #2563eb; color: #fff; }
.fb-bulk-btn--red    { background: #dc2626; color: #fff; }
.fb-bulk-btn--dismiss {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

/* Table */
.fb-table-wrap { overflow-x: auto; }

.fb-th-sort { cursor: pointer; }
.fb-th-sort:hover { background: var(--gray-50, #f9fafb); }

.fb-row--selected { background: #eff6ff !important; }

.fb-cat-badge {
  display: inline-block;
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-700, #374151);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
}

.fb-group-link {
  font-weight: 500;
  color: var(--gray-900);
  text-decoration: none;
  transition: color 0.15s;
}

.fb-group-link:hover { color: #1877f2; }

/* Action buttons in table */
.fb-action-group {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.fb-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-primary);
  cursor: pointer;
  color: var(--gray-600);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.fb-action-btn:hover { background: var(--gray-50, #f9fafb); border-color: var(--gray-300); }
.fb-action-btn--danger { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.fb-action-btn--danger:hover { background: #fee2e2; }

/* Pagination */
.fb-pagination {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
}

.fb-pagination-info { font-size: 0.85rem; color: var(--gray-500); }

/* Dark mode */
body[data-admin-theme="dark"] .fb-header       { background: var(--dk-surface); }
body[data-admin-theme="dark"] .fb-header-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-header-sub   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .fb-tab-bar      { background: var(--dk-surface); }
body[data-admin-theme="dark"] .fb-tab-btn      { color: var(--dk-muted); }
body[data-admin-theme="dark"] .fb-tab-btn:hover:not(.active) { background: var(--dk-hover); color: var(--dk-text); }
body[data-admin-theme="dark"] .fb-kpi-card     { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .fb-kpi-label    { color: var(--dk-muted); }
body[data-admin-theme="dark"] .fb-kpi-sub      { color: var(--dk-muted); }
body[data-admin-theme="dark"] .fb-cat-badge    { background: var(--dk-surface2); color: var(--dk-text2); }
body[data-admin-theme="dark"] .fb-group-link   { color: var(--dk-text2); }
body[data-admin-theme="dark"] .fb-group-link:hover { color: #60a5fa; }
body[data-admin-theme="dark"] .fb-action-btn   { background: var(--dk-surface2); border-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .fb-action-btn:hover { background: var(--dk-hover); }
body[data-admin-theme="dark"] .fb-action-btn--danger { background: #450a0a; border-color: #7f1d1d; color: #f87171; }
body[data-admin-theme="dark"] .fb-row--selected { background: #1e3a5f !important; }
body[data-admin-theme="dark"] .fb-pagination   { border-color: var(--dk-border); }
body[data-admin-theme="dark"] .fb-pagination-info { color: var(--dk-muted); }
body[data-admin-theme="dark"] .fb-filter-bar   { background: var(--dk-surface); }


/* ====================================================
   CRM SUGGESTIONS STYLES (crms-*)
   ==================================================== */

.crms-shell { padding: 0; overflow: hidden; }

/* Header */
.crms-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.crms-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
}

.crms-header-title svg { color: var(--primary-color, #e85d04); flex-shrink: 0; }
.crms-header-sub { font-size: 0.82rem; color: var(--gray-500); margin: 0; max-width: 520px; }

.crms-ignore-btn {
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Filter bar — urgency pills */
.crms-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.crms-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.15s;
}

.crms-pill:hover { border-color: var(--gray-300); color: var(--gray-800); }

.crms-pill-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-500);
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* Pill variants — idle */
.crms-pill--alta  { }
.crms-pill--media { }
.crms-pill--baixa { }

/* Pill variants — active */
.crms-pill--all.active   { background: var(--gray-900); border-color: var(--gray-900); color: #fff; }
.crms-pill--all.active .crms-pill-count { background: rgba(255,255,255,0.2); color: #fff; }

.crms-pill--alta.active  { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.crms-pill--alta.active .crms-pill-count { background: #dc2626; color: #fff; }

.crms-pill--media.active { background: #fffbeb; border-color: #fcd34d; color: #d97706; }
.crms-pill--media.active .crms-pill-count { background: #d97706; color: #fff; }

.crms-pill--baixa.active { background: #eff6ff; border-color: #93c5fd; color: #2563eb; }
.crms-pill--baixa.active .crms-pill-count { background: #2563eb; color: #fff; }

/* Content + grid */
.crms-content { padding: 24px; }

.crms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

/* Cards */
.crms-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--gray-300);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.crms-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); transform: translateY(-1px); }

.crms-card--alta  { border-left-color: #ef4444; }
.crms-card--media { border-left-color: #f59e0b; }
.crms-card--baixa { border-left-color: #3b82f6; }

.crms-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crms-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 20px;
}

.crms-badge--alta  { background: #fee2e2; color: #dc2626; }
.crms-badge--media { background: #fef3c7; color: #92400e; }
.crms-badge--baixa { background: #dbeafe; color: #1e40af; }

.crms-card-date { font-size: 0.75rem; color: var(--gray-400); }

.crms-card-body { display: flex; flex-direction: column; gap: 3px; }

.crms-empresa {
  font-weight: 800;
  color: var(--gray-900);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crms-titulo {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.86rem;
}

.crms-desc {
  color: var(--gray-500);
  font-size: 0.81rem;
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.crms-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

.crms-btn-feito { flex: 1; justify-content: center; gap: 5px; }
.crms-btn-lead  { gap: 4px; }

/* Empty state */
.crms-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--gray-400);
}

.crms-empty svg { margin-bottom: 14px; opacity: 0.4; }
.crms-empty-title { font-size: 1rem; font-weight: 700; color: var(--gray-600); margin: 0 0 6px; }
.crms-empty-sub   { font-size: 0.85rem; color: var(--gray-400); margin: 0; }

/* Dark mode */
body[data-admin-theme="dark"] .crms-header     { background: var(--dk-surface); }
body[data-admin-theme="dark"] .crms-header-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .crms-header-sub { color: var(--dk-muted); }
body[data-admin-theme="dark"] .crms-filter-bar { background: var(--dk-surface); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .crms-pill       { background: var(--dk-surface2); border-color: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .crms-pill:hover { border-color: var(--dk-border2); color: var(--dk-text2); }
body[data-admin-theme="dark"] .crms-pill-count { background: var(--dk-border); color: var(--dk-muted); }
body[data-admin-theme="dark"] .crms-pill--all.active   { background: var(--dk-text); border-color: var(--dk-text); color: var(--dk-surface); }
body[data-admin-theme="dark"] .crms-pill--alta.active  { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
body[data-admin-theme="dark"] .crms-pill--media.active { background: #431407; border-color: #92400e; color: #fcd34d; }
body[data-admin-theme="dark"] .crms-pill--baixa.active { background: #1e3a5f; border-color: #1d4ed8; color: #93c5fd; }
body[data-admin-theme="dark"] .crms-card      { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .crms-card--alta  { border-left-color: #ef4444; }
body[data-admin-theme="dark"] .crms-card--media { border-left-color: #f59e0b; }
body[data-admin-theme="dark"] .crms-card--baixa { border-left-color: #3b82f6; }
body[data-admin-theme="dark"] .crms-empresa  { color: var(--dk-text); }
body[data-admin-theme="dark"] .crms-titulo   { color: var(--dk-text2); }
body[data-admin-theme="dark"] .crms-desc     { color: var(--dk-muted); }
body[data-admin-theme="dark"] .crms-card-date{ color: var(--dk-muted); }
body[data-admin-theme="dark"] .crms-empty-title { color: var(--dk-text2); }
body[data-admin-theme="dark"] .crms-empty-sub   { color: var(--dk-muted); }


/* ====================================================
   CRM SHARED — Leads & Fornecedores (crm-page-* / crm-kpi-*)
   ==================================================== */

/* Page header — sits above KPI grid, outside any card */
.crm-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.crm-page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0 0 4px;
}

.crm-page-title svg { color: var(--primary-color, #e85d04); flex-shrink: 0; }
.crm-page-sub { font-size: 0.85rem; color: var(--gray-500); margin: 0; }

/* KPI grid — shared between leads and fornecedores */
.crm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.crm-kpi-card {
  background: var(--ck-bg, #f9fafb);
  border: 1px solid var(--ck-border, var(--border-color));
  border-radius: 12px;
  padding: 18px 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.crm-kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.crm-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.crm-kpi-label { font-size: 0.78rem; font-weight: 600; color: var(--gray-500); }

.crm-kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crm-kpi-value { font-size: 1.9rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.crm-kpi-sub   { font-size: 0.75rem; color: var(--gray-400); }

/* Dark mode */
body[data-admin-theme="dark"] .crm-page-title { color: var(--dk-text); }
body[data-admin-theme="dark"] .crm-page-sub   { color: var(--dk-muted); }
body[data-admin-theme="dark"] .crm-kpi-card   { background: var(--dk-surface2); border-color: var(--dk-border); }
body[data-admin-theme="dark"] .crm-kpi-label  { color: var(--dk-muted); }
body[data-admin-theme="dark"] .crm-kpi-sub    { color: var(--dk-muted); }


/* KPI grids responsive — 4 cols → 2 cols on narrow screens */
@media (max-width: 800px) {
  .em-kpi-grid,
  .fb-kpi-grid,
  .crm-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .em-kpi-grid,
  .fb-kpi-grid,
  .crm-kpi-grid { grid-template-columns: 1fr; }
}


/* =====================================================
   SUGESTÕES CRM — Group Cards + Modal
   ===================================================== */

.crms-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

/* Group card */
.crms-group-card {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 14px;
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.crms-group-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); transform: translateY(-1px); }

.crms-group-card--alta  { border-left: 4px solid #ef4444; }
.crms-group-card--media { border-left: 4px solid #f59e0b; }
.crms-group-card--baixa { border-left: 4px solid #3b82f6; }

.crms-group-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crms-group-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-500, #6b7280);
}

.crms-group-titulo {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  line-height: 1.3;
}

.crms-group-desc {
  font-size: 0.83rem;
  color: var(--gray-500, #6b7280);
  line-height: 1.5;
}

.crms-group-preview {
  font-size: 0.78rem;
  color: var(--gray-400, #9ca3af);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crms-group-more {
  font-weight: 600;
  color: var(--gray-500, #6b7280);
}

.crms-group-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Modal overlay */
.crms-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: crms-fade-in 0.15s ease;
}
@keyframes crms-fade-in { from { opacity: 0; } to { opacity: 1; } }

.crms-modal {
  background: var(--bg-primary, #fff);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: crms-slide-up 0.18s ease;
}
@keyframes crms-slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.crms-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  flex-shrink: 0;
}

.crms-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin: 0 0 4px;
}

.crms-modal-sub {
  font-size: 0.82rem;
  color: var(--gray-500, #6b7280);
  margin: 0;
}

.crms-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400, #9ca3af);
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.crms-modal-close:hover { color: var(--text-primary, #111827); background: var(--bg-secondary, #f3f4f6); }

.crms-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.crms-leads-list { display: flex; flex-direction: column; }

.crms-lead-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border-color, #f3f4f6);
  transition: background 0.1s;
}
.crms-lead-row:last-child { border-bottom: none; }
.crms-lead-row:hover { background: var(--bg-secondary, #f9fafb); }

.crms-lead-empresa {
  flex: 1;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-primary, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crms-lead-date {
  font-size: 0.75rem;
  color: var(--gray-400, #9ca3af);
  white-space: nowrap;
  flex-shrink: 0;
}

.crms-btn-goto {
  flex-shrink: 0;
  padding: 4px 8px !important;
}

/* Dark mode */
body[data-admin-theme="dark"] .crms-group-card { background: var(--bg-secondary, #1f2937); border-color: var(--border-color, #374151); }
body[data-admin-theme="dark"] .crms-modal { background: #1f2937; }
body[data-admin-theme="dark"] .crms-modal-header { border-color: #374151; }
body[data-admin-theme="dark"] .crms-lead-row { border-color: #374151; }
body[data-admin-theme="dark"] .crms-lead-row:hover { background: #111827; }

@media (max-width: 700px) {
  .crms-groups-grid { grid-template-columns: 1fr; }
  .crms-modal { max-height: 90vh; }
}


/* Modal search + footer */
.crms-modal-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  flex-shrink: 0;
  color: var(--gray-400, #9ca3af);
}

.crms-modal-search {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.88rem;
  color: var(--text-primary, #111827);
}
.crms-modal-search::placeholder { color: var(--gray-400, #9ca3af); }

.crms-modal-desc {
  font-size: 0.82rem;
  color: var(--gray-500, #6b7280);
  margin: 2px 0 4px;
}

.crms-modal-footer {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-color, #e5e7eb);
  flex-shrink: 0;
  flex-wrap: wrap;
}

body[data-admin-theme="dark"] .crms-modal-search-bar { border-color: #374151; }
body[data-admin-theme="dark"] .crms-modal-search { color: #f9fafb; }
body[data-admin-theme="dark"] .crms-modal-footer { border-color: #374151; }

/* ==================== PRODUCTS — VISUAL REFINEMENTS ==================== */

/* Group row: left-border accent for stronger visual identity */
.draggable-group-row {
    border-left: 3px solid var(--orange-400, #fb923c) !important;
}

/* GRUPO label chip */
.group-label-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--orange-700, #c2410c);
    background: var(--orange-100, #ffedd5);
    border: 1px solid var(--orange-200, #fed7aa);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Visível / Destaque SVG indicators */
.vis-icon { display: inline-flex; align-items: center; }
.vis-icon-yes { color: var(--success, #16a34a); }
.vis-icon-no  { color: var(--gray-300, #d1d5db); }
.feat-icon-yes { color: var(--orange-400, #fb923c); }

/* Delete action button — replaces inline styles */
.action-btn.delete {
    color: var(--error, #dc2626);
    border: 1px solid var(--red-200, #fecaca);
    background: transparent;
    margin-left: 8px;
    transition: background 0.15s, border-color 0.15s;
}
.action-btn.delete:hover {
    background: var(--red-50, #fef2f2);
    border-color: var(--error, #dc2626);
}

/* ==================== ANGEL — ACTION BUTTONS ==================== */

/* Compact inline action pair */
.ang-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.775rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
    line-height: 1.4;
}
.ang-action-view {
    background: var(--blue-50, #eff6ff);
    color: var(--blue-700, #1d4ed8);
    border-color: var(--blue-200, #bfdbfe);
}
.ang-action-view:hover {
    background: var(--blue-100, #dbeafe);
    border-color: var(--blue-400, #60a5fa);
}
.ang-action-delete {
    background: transparent;
    color: var(--gray-400, #9ca3af);
    border-color: transparent;
    padding: 4px 6px;
}
.ang-action-delete:hover {
    background: var(--red-50, #fef2f2);
    color: var(--red-600, #dc2626);
    border-color: var(--red-200, #fecaca);
}

/* Row hover state for angel table */
.ang-table tbody tr { transition: background 0.1s; }
.ang-table tbody tr:hover { background: var(--gray-50, #f9fafb); }

/* Dark mode */
body[data-admin-theme="dark"] .group-label-pill {
    background: rgba(251,146,60,0.15);
    border-color: rgba(251,146,60,0.3);
    color: #fdba74;
}
body[data-admin-theme="dark"] .ang-action-view {
    background: rgba(37,99,235,0.15);
    border-color: rgba(37,99,235,0.3);
    color: #93c5fd;
}
body[data-admin-theme="dark"] .ang-action-view:hover {
    background: rgba(37,99,235,0.25);
}
body[data-admin-theme="dark"] .ang-action-delete:hover {
    background: rgba(220,38,38,0.15);
    border-color: rgba(220,38,38,0.3);
    color: #fca5a5;
}

/* ═══════════════════════════════════════════════════
   BLOGS (Guias e Dicas) — reaproveita .gallery-* base
   ═══════════════════════════════════════════════════ */
.gallery-card__noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-300);
    background: var(--gray-100);
}
.blog-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--blue-700, #1d4ed8);
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.blog-card__draft {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--warning, #f59e0b);
    color: #1c1917;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}
.blog-card__featured {
    position: absolute;
    top: 42px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #facc15;
    color: #422006;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

/* Uploader de imagem no editor */
.blog-image-uploader {
    width: 100%;
    aspect-ratio: 16/9;
    border: 2px dashed var(--gray-300);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: var(--gray-50, #f9fafb);
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.blog-image-uploader:hover {
    border-color: var(--blue-400, #60a5fa);
    background: var(--gray-100);
}
.blog-image-uploader img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.blog-image-uploader__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--gray-400);
    text-align: center;
    padding: 16px;
}
.blog-image-uploader__empty span { font-size: 0.88rem; font-weight: 500; }
.blog-image-uploader__empty small { font-size: 0.74rem; color: var(--gray-400); }

body[data-admin-theme="dark"] .blog-image-uploader { background: rgba(255,255,255,0.02); }
body[data-admin-theme="dark"] .gallery-card__noimg { background: rgba(255,255,255,0.03); }
