/* ============================================================
   DASHMETA Ã¢â‚¬â€ DESIGN SYSTEM v2.0
   Inspired by DuckAds polish + dark mode premium
   ============================================================ */

/* Ã¢â€â‚¬Ã¢â€â‚¬ Critical Utility: Hide/Show views Ã¢â€â‚¬Ã¢â€â‚¬ */
.hidden { display: none !important; }

:root {
    /* Ã¢â€â‚¬Ã¢â€â‚¬ Backgrounds Ã¢â€â‚¬Ã¢â€â‚¬ */
    --bg-primary: #0f1117;
    --bg-secondary: #161822;
    --bg-card: #1c1f2e;
    --bg-card-hover: #232740;
    --bg-elevated: #252a3d;
    --bg-glass: rgba(22, 24, 34, 0.92);

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Accent / Brand Ã¢â€â‚¬Ã¢â€â‚¬ */
    --accent-primary: #818cf8;
    --accent-primary-light: #a5b4fc;
    --accent-primary-dark: #6366f1;
    --accent-gradient: linear-gradient(135deg, #818cf8, #6366f1);
    --glow-gradient: linear-gradient(135deg, rgba(129,140,248,0.08), rgba(99,102,241,0.04));
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #3b82f6;

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Text Ã¢â€â‚¬Ã¢â€â‚¬ */
    --text-primary: #e8eaf0;
    --text-secondary: #8b92a8;
    --text-muted: #5b6380;

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Borders Ã¢â€â‚¬Ã¢â€â‚¬ */
    --border-color: rgba(255,255,255,0.06);
    --border-color-hover: rgba(255,255,255,0.12);
    --border-color-focus: rgba(129,140,248,0.5);

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Radius (DuckAds-inspired: larger, softer) Ã¢â€â‚¬Ã¢â€â‚¬ */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Shadows Ã¢â€â‚¬Ã¢â€â‚¬ */
    --shadow-xs: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(129,140,248,0.12);

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Spacing Ã¢â€â‚¬Ã¢â€â‚¬ */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Transitions (DuckAds cubic-bezier) Ã¢â€â‚¬Ã¢â€â‚¬ */
    --ease-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Typography Ã¢â€â‚¬Ã¢â€â‚¬ */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Legacy vars (keep for compat) */
    --bg-darker: var(--bg-primary);
    --bg-dark: var(--bg-secondary);
    --bg-hover: var(--bg-card-hover);
    --primary-blue: var(--accent-primary-dark);
    --primary-blue-hover: #4f46e5;
    --status-green: var(--accent-success);
}

*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow: hidden;
}

body, body.dark-theme {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Subtle noise texture like DuckAds */
body::before {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 9999; opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat; background-size: 128px 128px;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* Ã¢â€â‚¬Ã¢â€â‚¬ Utilities Ã¢â€â‚¬Ã¢â€â‚¬ */
.ms-auto { margin-left: auto; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.hidden-desktop { display: none; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* View transition animation */
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.view-entering {
    animation: viewFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.text-warning { color: var(--accent-warning); }
.text-danger { color: var(--accent-danger); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

/* â”€â”€ View default display states â”€â”€ */
#dashboardView, #chatView {
    display: flex; flex-direction: column;
    height: 100%; overflow: hidden; flex: 1;
}
#settingsView, #reportsView {
    display: block; height: 100%;
    overflow-y: auto; flex: 1;
}
#controlCenterView {
    display: flex; flex-direction: column;
    height: 100%; overflow-y: auto;
}
#whatsappConfigView, #smartAlertsView, #launcherView, #creativesView, #optimizerView {
    display: block; height: 100%; overflow-y: auto;
}

/* â”€â”€ ALL views hidden state â”€â”€ */
#dashboardView.hidden, #settingsView.hidden,
#chatView.hidden, #adminView.hidden, #reportsView.hidden,
#controlCenterView.hidden, #whatsappConfigView.hidden,
#smartAlertsView.hidden, #launcherView.hidden, #creativesView.hidden,
#optimizerView.hidden {
    display: none !important;
}

/* ============================================================
   SIDEBAR Ã¢â‚¬â€ Polished DuckAds-style
   ============================================================ */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}
.logo {
    display: flex; align-items: center;
    gap: 10px; font-weight: 800;
    font-size: 16px; color: white;
    letter-spacing: -0.02em;
}
.logo-icon { font-size: 20px; color: var(--accent-primary); }

.sidebar-nav { padding: 12px 0; flex: 1; display: flex; flex-direction: column; }
.nav-list { list-style: none; }
.nav-item { margin-bottom: 2px; }

.nav-link {
    display: flex; align-items: center;
    gap: 12px; padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--ease-normal);
    font-weight: 500; font-size: 13px;
    border-radius: 0;
    position: relative;
}
.nav-link:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}
.nav-item.active .nav-link {
    background: linear-gradient(135deg, rgba(129,140,248,0.12), rgba(99,102,241,0.06));
    color: var(--accent-primary-light);
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin: 0 8px;
    padding: 10px 12px;
    box-shadow: 0 0 12px rgba(129,140,248,0.06);
}
/* Active indicator bar (DuckAds style) */
.nav-item.active .nav-link::before {
    content: '';
    position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(129,140,248,0.5);
}

.nav-link.active-secondary {
    background: rgba(129,140,248,0.08);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

.sidebar-divider {
    border: none; height: 1px;
    background: var(--border-color);
    margin: 12px 20px;
}

/* ============================================================
   BUTTONS Ã¢â‚¬â€ Refined, consistent
   ============================================================ */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--ease-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}

.btn-dark {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-dark:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-outline-light {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-outline-light:hover {
    background: rgba(255,255,255,0.04);
    color: white;
    border-color: var(--border-color-hover);
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--ease-fast);
}
.icon-btn:hover {
    background: var(--bg-card-hover);
    color: white;
    transform: translateY(-1px);
}

/* ============================================================
   INPUTS Ã¢â‚¬â€ Polished forms
   ============================================================ */
.themed-input, .themed-select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    transition: all var(--ease-fast);
    outline: none;
}
.themed-input:focus, .themed-select:focus {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(129,140,248,0.1);
}
.themed-input::placeholder { color: var(--text-muted); }

.themed-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6380' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* ============================================================
   HEADER / TABS Ã¢â‚¬â€ Clean tabbed interface
   ============================================================ */
.top-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    align-items: flex-end;
    height: auto;
}

.tabs-container { display: flex; gap: 4px; }

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 18px;
    border-radius: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--ease-fast);
    display: flex; align-items: center; gap: 8px;
}
.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}
.tab-btn.active {
    color: var(--accent-primary-light);
    border-bottom-color: var(--accent-primary);
    font-weight: 600;
}

/* ============================================================
   KPI CARDS Ã¢â‚¬â€ Stat cards with colored top bar (DuckAds style)
   ============================================================ */
.kpi-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: all var(--ease-normal);
}
.kpi-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--accent-primary);
    opacity: 0.6;
}
.kpi-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-md);
}
.kpi-card .card-title {
    font-size: 11px; color: var(--text-secondary);
    font-weight: 600; margin-bottom: 10px;
    text-transform: uppercase; letter-spacing: 0.04em;
    display: flex; align-items: center; gap: 8px;
}
.kpi-card .card-value {
    font-size: 24px; font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

/* ============================================================
   DATA TABLE Ã¢â‚¬â€ Polished, clean
   ============================================================ */
.table-container {
    flex: 1; min-height: 0;
    overflow: auto; padding: 0;
}

.data-table, .reports-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-secondary);
    min-width: 1200px;
}

.data-table th, .reports-table th,
.data-table td, .reports-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--ease-fast);
}

.data-table th, .reports-table th {
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr:hover td,
.reports-table tbody tr:hover td {
    background: rgba(255,255,255,0.02);
}

.data-table tfoot th, .data-table tfoot td,
.reports-table tfoot th, .reports-table tfoot td {
    background: var(--bg-primary);
    font-weight: 600;
    border-top: 2px solid var(--border-color);
    position: sticky;
    bottom: 0;
}

/* ============================================================
   BADGES Ã¢â‚¬â€ Rounded status pills (DuckAds style)
   ============================================================ */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge-success {
    background: rgba(16,185,129,0.12);
    color: var(--accent-success);
    border: 1px solid rgba(16,185,129,0.2);
}

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

/* ============================================================
   TOGGLE SWITCH Ã¢â‚¬â€ Smooth
   ============================================================ */
.toggle-switch {
    position: relative; display: inline-block;
    width: 40px; height: 20px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #3f4560;
    transition: 0.3s; border-radius: 34px;
}
.slider:before {
    position: absolute; content: '';
    height: 14px; width: 14px;
    left: 3px; bottom: 3px;
    background: white; transition: 0.3s;
    border-radius: 50%;
}
input:checked + .slider { background: var(--accent-primary-dark); }
input:checked + .slider:before { transform: translateX(20px); }

/* Alt toggle (.switch) */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* ============================================================
   SEARCH / FILTER Ã¢â‚¬â€ Advanced Meta-style filter bar
   ============================================================ */
.search-section {
    padding: 15px 20px;
    position: relative;
    padding-bottom: 20px;
    align-items: flex-start;
}

.advanced-filter-container {
    position: relative; max-width: 100%; flex: 1;
}
.advanced-filter-bar {
    display: flex; align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 8px 16px;
    min-height: 42px;
    flex-wrap: wrap; gap: 8px;
    transition: all var(--ease-fast);
    cursor: text;
}
.advanced-filter-bar.focused {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(129,140,248,0.1);
}
.advanced-filter-bar i.fa-magnifying-glass {
    color: var(--text-muted); font-size: 14px;
}
.filter-tags-area { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 11px;
    display: flex; align-items: center; gap: 6px;
    color: var(--text-primary);
}
.filter-pill .remove-pill {
    cursor: pointer; color: var(--text-muted);
    transition: color var(--ease-fast);
}
.filter-pill .remove-pill:hover { color: var(--accent-danger); }

.adv-filter-input {
    background: transparent; border: none;
    color: var(--text-primary); outline: none;
    flex-grow: 1; min-width: 150px;
    font-size: 13px; font-family: inherit;
}
.adv-filter-input::placeholder { color: var(--text-muted); }

.filter-dropdown-panel {
    position: absolute; top: 110%; left: 0;
    width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color-hover);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100; max-height: 350px;
    overflow-y: auto; padding: 8px 0;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.filter-dropdown-category {
    font-size: 10px; text-transform: uppercase;
    color: var(--text-muted); font-weight: 700;
    padding: 6px 16px; margin-top: 4px;
    letter-spacing: 0.06em;
}
.filter-dropdown-item {
    padding: 8px 16px; cursor: pointer;
    font-size: 13px; display: flex;
    align-items: center; justify-content: space-between;
    transition: background var(--ease-fast);
    border-radius: var(--radius-xs);
    margin: 0 4px;
}
.filter-dropdown-item:hover {
    background: rgba(129,140,248,0.08);
}

.filter-secondary-panel {
    padding: 12px 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   CARDS Ã¢â‚¬â€ General purpose
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all var(--ease-normal);
}
.card:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: rgba(0,0,0,0.15);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 12px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

.meta-icon { color: #1877F2; font-size: 20px; }

.integration-panel { padding: 20px; max-width: 800px; }
.profile-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    display: flex; justify-content: space-between;
    align-items: center; margin-top: 10px;
}

.account-toggle-row {
    display: flex; justify-content: space-between;
    align-items: center; padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.account-toggle-row:last-child { border-bottom: none; }
.col-info { display: flex; flex-direction: column; gap: 4px; }
.col-info strong { font-weight: 500; font-size: 14px; }

/* ============================================================
   MODALS Ã¢â‚¬â€ Spring animation (DuckAds-inspired)
   ============================================================ */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    width: 480px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border-color-hover);
    animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalSlide {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.close-modal {
    position: absolute; top: 15px; right: 15px;
    background: none; border: none;
    color: var(--text-secondary); font-size: 16px; cursor: pointer;
    transition: color var(--ease-fast);
}
.close-modal:hover { color: var(--text-primary); }

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header .logo-text {
    font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}
.modal-body { padding: 24px 28px; }
.modal-body h2 { font-size: 20px; margin-bottom: 10px; }
.modal-body p { color: var(--text-secondary); margin-bottom: 20px; }

.modal-footer {
    padding: 16px 28px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex; justify-content: flex-end;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    gap: 10px;
}

/* Rule builder modal */
.rule-builder-modal {
    width: 650px; max-width: 90vw;
    height: 85vh;
    display: flex; flex-direction: column;
}
.rule-builder-modal .modal-header { background: var(--bg-card); }
.rule-builder-modal .modal-header .logo-text { font-size: 16px; font-weight: 600; }

.scrollable-modal-body {
    padding: 20px 28px;
    overflow-y: auto; flex: 1;
}
.scrollable-modal-body::-webkit-scrollbar { width: 6px; }
.scrollable-modal-body::-webkit-scrollbar-track { background: transparent; }
.scrollable-modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.rule-builder-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 12px;
}

.block { display: block; }
.mr-2 { margin-right: 10px; }
.small { padding: 8px; font-size: 13px; }
.border-top-padding { border-top: 1px solid var(--border-color); padding-top: 20px; margin-top: 30px; }

/* ============================================================
   RULES PANEL
   ============================================================ */
.rules-panel {
    padding: 20px 40px;
    max-width: 1000px;
    height: 100%; overflow-y: auto;
}

.active-rules-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.rule-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--ease-normal);
}
.rule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-hover);
}
.rule-title {
    font-size: 15px; font-weight: 600;
    display: flex; align-items: center; gap: 10px;
}
.rule-logic, .rule-action {
    display: flex; align-items: center;
    gap: 12px; margin-top: 14px; flex-wrap: wrap;
    background: var(--bg-primary);
    padding: 12px 15px; border-radius: var(--radius-sm);
    border: 1px dashed var(--border-color);
}
.logic-badge {
    background: rgba(129,140,248,0.15);
    color: var(--accent-primary-light);
    padding: 4px 10px; border-radius: var(--radius-xs);
    font-weight: 700; font-size: 11px; letter-spacing: 0.5px;
}
.logic-badge.action {
    background: rgba(16,185,129,0.15);
    color: var(--accent-success);
}
.logic-text { font-weight: 600; color: white; }
.logic-operator { color: var(--text-secondary); font-style: italic; }
.logic-value {
    background: var(--bg-elevated);
    padding: 3px 8px; border-radius: var(--radius-xs);
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
}

/* Conditions */
.add-condition-btn {
    background: var(--bg-primary); border: 1px solid var(--border-color);
    color: var(--text-secondary); width: 40px; height: 36px;
    border-radius: var(--radius-xs); cursor: pointer; font-size: 16px;
}
.add-condition-btn:hover { background: var(--bg-card-hover); color: white; }

.condition-row {
    display: flex; gap: 10px; align-items: center;
    background: var(--bg-primary);
    padding: 10px; border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
}
.condition-select { width: 150px; }
.condition-operator { width: 120px; }
.condition-value { width: 100px; }

.highlight-select option:checked {
    background: var(--accent-primary-dark); color: white;
}

/* ============================================================
   TOAST NOTIFICATIONS Ã¢â‚¬â€ DuckAds-style slide + left border
   ============================================================ */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column;
    gap: 10px; z-index: 9999;
}
.toast {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-info);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    display: flex; align-items: center; gap: 12px;
    min-width: 320px;
    transform: translateX(120%);
    animation: slideInRight 0.3s var(--ease-spring) forwards,
               slideOutRight 0.3s ease forwards 3s;
}
.toast.toast-error { border-left-color: var(--accent-danger); }
.toast.toast-success { border-left-color: var(--accent-success); }
.toast i { font-size: 18px; }
.toast.toast-error i { color: var(--accent-danger); }
.toast.toast-success i { color: var(--accent-success); }
.toast.toast-info i { color: var(--accent-info); }
.toast.toast-warning { border-left-color: #f59e0b; }
.toast.toast-warning i { color: #f59e0b; }

/* Toast with undo action */
.toast .toast-undo-btn {
    margin-left: auto;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--accent-primary-light);
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
}
.toast .toast-undo-btn:hover { background: rgba(129,140,248,0.2); }
.toast .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 0 0 0 var(--radius-md);
    animation: toastProgress linear forwards;
}

@keyframes slideInRight { to { transform: translateX(0); } }
@keyframes slideOutRight { to { transform: translateX(120%); display: none; } }
@keyframes toastProgress { from { width: 100%; } to { width: 0%; } }

/* ============================================================
   SKELETON LOADING Ã¢â‚¬â€ Premium shimmer placeholders
   ============================================================ */
.skeleton {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.04) 40%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 60%,
        transparent 100%);
    animation: shimmer 1.5s infinite ease-in-out;
}
.skeleton-line {
    height: 14px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    margin-bottom: 10px;
}
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-30 { width: 30%; }
.skeleton-line.h-lg { height: 24px; }
.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.skeleton-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.04) 40%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 60%,
        transparent 100%);
    animation: shimmer 1.5s infinite ease-in-out;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================================
   COMMAND PALETTE Ã¢â‚¬â€ Cmd+K Quick Search
   ============================================================ */
.cmd-palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: min(20vh, 160px);
    animation: fadeIn 0.15s ease;
}
.cmd-palette {
    background: var(--bg-card);
    border: 1px solid var(--border-color-hover);
    border-radius: var(--radius-xl);
    width: 560px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(129,140,248,0.06);
    overflow: hidden;
    animation: scaleIn 0.2s var(--ease-spring);
}
.cmd-palette-input-wrap {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.cmd-palette-input-wrap i {
    color: var(--text-muted);
    font-size: 18px;
}
.cmd-palette-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
}
.cmd-palette-input::placeholder { color: var(--text-muted); }
.cmd-palette-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 8px;
}
.cmd-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.12s;
    color: var(--text-secondary);
    font-size: 14px;
}
.cmd-palette-item:hover,
.cmd-palette-item.active {
    background: rgba(129,140,248,0.1);
    color: var(--text-primary);
}
.cmd-palette-item i {
    width: 24px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}
.cmd-palette-item .cmd-shortcut {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}
.cmd-palette-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-muted);
}
.cmd-palette-footer kbd {
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    border: 1px solid rgba(255,255,255,0.1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ============================================================
   BULK ACTIONS BAR
   ============================================================ */
.bulk-actions-bar {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color-hover);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 14px 28px;
    z-index: 1000;
    transition: transform var(--ease-spring);
    opacity: 0; pointer-events: none;
}
.bulk-actions-bar.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1; pointer-events: auto;
}
.bulk-actions-content { display: flex; align-items: center; gap: 20px; }
.bulk-info {
    font-weight: 600; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
#bulkSelectCount {
    background: var(--accent-primary-dark);
    color: white; padding: 2px 10px;
    border-radius: 12px; font-size: 13px;
}
.bulk-buttons { display: flex; gap: 8px; }
.bulk-buttons button { font-size: 13px; }

/* ============================================================
   EDIT MODAL
   ============================================================ */
#editInlineModal { z-index: 1050; }
#editInlineModal .modal { width: 400px; }

/* ============================================================
   INPUT COLOR FIX
   ============================================================ */
#customTemplateColorInput::-webkit-color-swatch-wrapper { padding: 0; }
#customTemplateColorInput::-webkit-color-swatch {
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
}
#customTemplateColorInput:hover::-webkit-color-swatch {
    border-color: rgba(255,255,255,0.5);
}

/* ============================================================
   TEMPLATES
   ============================================================ */
.template-item {
    transition: all var(--ease-fast);
    border-radius: var(--radius-sm);
    margin: 2px 10px;
}
.template-item:hover { background: rgba(255,255,255,0.04) !important; }
.icon-btn-small { opacity: 0.4; transition: all var(--ease-fast); background: none; border: none; color: var(--text-secondary); cursor: pointer; }
.template-item:hover .icon-btn-small { opacity: 1; }
.icon-btn-small:hover { color: var(--accent-danger) !important; background: rgba(239,68,68,0.1) !important; border-radius: var(--radius-xs); }

/* ============================================================
   TOOLBAR DROPDOWN MENUS Ã¢â‚¬â€ Polished
   ============================================================ */
.toolbar-menu-item {
    display: flex; align-items: center;
    gap: 10px; width: 100%;
    padding: 9px 14px;
    border: none; background: transparent;
    color: var(--text-secondary);
    cursor: pointer; font-size: 12px;
    border-radius: var(--radius-sm);
    text-align: left;
    transition: all var(--ease-fast);
    font-family: inherit;
}
.toolbar-menu-item:hover {
    background: rgba(129,140,248,0.08);
    color: var(--text-primary);
}
.toolbar-menu-item i {
    min-width: 18px; text-align: center;
    font-size: 13px;
}

/* ============================================================
   RELATÃƒâ€œRIOS INTELIGENTES
   ============================================================ */
@keyframes reportCardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.reports-topbar {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.reports-health-pill {
    display: inline-flex; align-items: center;
    gap: 6px; font-size: 12px; font-weight: 600;
    padding: 5px 14px; border-radius: 20px;
    border: 1px solid; background: rgba(0,0,0,0.2);
}
.btn-compact-toggle {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px; border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; transition: all var(--ease-fast);
}
.btn-compact-toggle:hover { background: rgba(255,255,255,0.08); }

.hourly-chip {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 3px 10px; border-radius: 20px;
    cursor: pointer; font-size: 10px; font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}
.hourly-chip:hover { background: rgba(99,102,241,0.15); color: #a5b4fc; border-color: rgba(99,102,241,0.3); }
.hourly-chip.active { background: rgba(99,102,241,0.2); color: #a5b4fc; border-color: rgba(99,102,241,0.4); }

/* Template selector chips for hourly chart */
.hourly-tpl-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    padding: 4px 10px; border-radius: 20px;
    cursor: pointer; font-size: 10px; font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.hourly-tpl-chip:hover { background: rgba(99,102,241,0.1); color: #c7d2fe; }
.hourly-tpl-chip.active {
    background: rgba(99,102,241,0.18);
    color: #a5b4fc;
    border-color: rgba(99,102,241,0.45);
    box-shadow: 0 0 8px rgba(99,102,241,0.15);
}

.date-chips-row {
    display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end;
}
.date-chip {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 5px 12px; border-radius: 20px;
    cursor: pointer; font-size: 11px; font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.date-chip:hover { background: rgba(99,102,241,0.12); color: #c4b5fd; border-color: rgba(99,102,241,0.25); }
.date-chip.active { background: rgba(99,102,241,0.2); color: #a5b4fc; border-color: rgba(99,102,241,0.4); box-shadow: 0 0 8px rgba(99,102,241,0.15); }
.date-chip i { margin-right: 3px; font-size: 10px; }

.reports-kpi-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 20px;
}
.reports-kpi-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 4px;
}
.kpi-label {
    font-size: 10px; text-transform: uppercase;
    font-weight: 700; color: var(--text-muted);
    letter-spacing: 0.05em;
}
.kpi-val-lg { font-size: 18px; font-weight: 700; color: white; }

.card-kpi-bar {
    display: flex; align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.card-kpi-bar .kpi-value {
    font-size: 20px; font-weight: 700; display: block;
}

.report-account-row {
    display: flex; align-items: center;
    gap: 8px; padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--ease-fast);
}
.report-account-row:last-child { border-bottom: none; }
.report-account-row:hover { background: rgba(255,255,255,0.02) !important; }

/* Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ Copy Tracking States Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.report-account-row.copied {
    border-left: 3px solid rgba(16,185,129,0.5);
    background: rgba(16,185,129,0.03) !important;
    position: relative;
}
.report-account-row.copied .report-acc-name > span:first-child {
    color: rgba(255,255,255,0.55);
}
.report-account-row.last-copied {
    border-left: 3px solid #10b981;
    background: rgba(16,185,129,0.07) !important;
}
.report-account-row.last-copied .report-acc-name > span:first-child {
    color: white;
}

/* Copied badge - green check indicator */
.copied-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(16,185,129,0.2);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    animation: badgePop 0.3s var(--ease-spring);
    pointer-events: none;
}
.report-account-row.last-copied .copied-badge {
    background: rgba(16,185,129,0.35);
    color: #6ee7b7;
    box-shadow: 0 0 8px rgba(16,185,129,0.25);
}
@keyframes badgePop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

.report-acc-reorder { display: flex; flex-direction: column; flex-shrink: 0; }
.report-acc-name { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.report-acc-spend { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.btn-copy-mini {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    padding: 5px 9px; cursor: pointer;
    color: var(--text-muted);
    display: flex; align-items: center;
    min-width: 32px; min-height: 32px;
    justify-content: center;
    transition: all var(--ease-fast);
}
.btn-copy-mini:hover { background: rgba(255,255,255,0.1); color: white; }

.btn-copy-total {
    background: var(--accent-primary-dark);
    border: none; border-radius: var(--radius-sm);
    padding: 7px 14px; cursor: pointer;
    color: white; display: flex;
    align-items: center; gap: 6px;
    font-weight: 500; font-size: 12px;
    transition: all var(--ease-fast);
    min-height: 34px;
}
.btn-copy-total:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-reorder-card {
    background: transparent; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 6px 9px; display: flex;
    align-items: center; border-radius: var(--radius-xs);
    min-width: 32px; min-height: 32px;
    justify-content: center;
    transition: all var(--ease-fast);
}
.btn-reorder-card:hover { background: rgba(255,255,255,0.06); color: white; }

/* Report cards animation */
.template-card-draggable {
    transition: box-shadow var(--ease-fast), opacity var(--ease-fast);
}
@keyframes cardMoved {
    0%   { box-shadow: 0 0 0 2px rgba(129,140,248,0); }
    30%  { box-shadow: 0 0 0 2px rgba(129,140,248,0.5); background: rgba(129,140,248,0.04); }
    100% { box-shadow: 0 0 0 2px rgba(129,140,248,0); background: transparent; }
}
.template-card-draggable.card-just-moved {
    animation: cardMoved 0.5s ease forwards;
}
.template-card-draggable.drag-over {
    box-shadow: 0 0 0 2px var(--accent-primary), 0 8px 24px rgba(129,140,248,0.2) !important;
    opacity: 0.85; transform: scale(1.005);
}

/* ============================================================
   VPS STATUS BAR Ã¢â‚¬â€ Real-time bot health indicator
   ============================================================ */
.vps-status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 6px 20px;
    background: linear-gradient(90deg, rgba(16,185,129,0.08), rgba(16,185,129,0.03), rgba(16,185,129,0.08));
    border-bottom: 1px solid rgba(16,185,129,0.15);
    font-size: 11px;
    color: var(--text-secondary);
    min-height: 32px;
    flex-shrink: 0;
    transition: all 0.4s ease;
    overflow: hidden;
}
.vps-status-bar.offline {
    background: linear-gradient(90deg, rgba(239,68,68,0.08), rgba(239,68,68,0.03), rgba(239,68,68,0.08));
    border-bottom-color: rgba(239,68,68,0.15);
}
.vps-status-bar.loading {
    background: linear-gradient(90deg, rgba(245,158,11,0.08), rgba(245,158,11,0.03), rgba(245,158,11,0.08));
    border-bottom-color: rgba(245,158,11,0.15);
}
.vps-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.vps-status-item i {
    font-size: 10px;
}
.vps-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16,185,129,0.6);
    animation: vpsPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
.vps-status-bar.offline .vps-dot {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239,68,68,0.6);
    animation: none;
}
.vps-status-bar.loading .vps-dot {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245,158,11,0.6);
}
@keyframes vpsPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
.vps-status-label {
    font-weight: 600;
    color: var(--text-primary);
}
.vps-status-bar .vps-close {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}
.vps-status-bar .vps-close:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

/* ============================================================
   SKELETON LOADING Ã¢â‚¬â€ Shimmer pulse animation
   ============================================================ */
.skeleton-row {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    gap: 18px;
}
.skeleton-cell {
    height: 14px;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}
.skeleton-cell.w-40 { width: 40%; }
.skeleton-cell.w-20 { width: 20%; }
.skeleton-cell.w-15 { width: 15%; }
.skeleton-cell.w-10 { width: 10%; min-width: 60px; }
.skeleton-cell.w-8 { width: 8%; min-width: 50px; }
.skeleton-cell.h-10 { height: 10px; }

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton container for table */
.skeleton-table-body .skeleton-row:nth-child(odd) {
    background: rgba(255,255,255,0.01);
}
.skeleton-table-body .skeleton-row:nth-child(1) .skeleton-cell { animation-delay: 0s; }
.skeleton-table-body .skeleton-row:nth-child(2) .skeleton-cell { animation-delay: 0.1s; }
.skeleton-table-body .skeleton-row:nth-child(3) .skeleton-cell { animation-delay: 0.2s; }
.skeleton-table-body .skeleton-row:nth-child(4) .skeleton-cell { animation-delay: 0.15s; }
.skeleton-table-body .skeleton-row:nth-child(5) .skeleton-cell { animation-delay: 0.25s; }
.skeleton-table-body .skeleton-row:nth-child(6) .skeleton-cell { animation-delay: 0.05s; }
.skeleton-table-body .skeleton-row:nth-child(7) .skeleton-cell { animation-delay: 0.18s; }
.skeleton-table-body .skeleton-row:nth-child(8) .skeleton-cell { animation-delay: 0.08s; }

/* Fade-in when data arrives */
.data-table tbody tr,
.reports-table tbody tr {
    animation: tableRowIn 0.3s ease forwards;
    opacity: 0;
}
.data-table tbody tr:nth-child(1) { animation-delay: 0s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.02s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.04s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.06s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(6) { animation-delay: 0.10s; }
.data-table tbody tr:nth-child(7) { animation-delay: 0.12s; }
.data-table tbody tr:nth-child(8) { animation-delay: 0.14s; }
.data-table tbody tr:nth-child(n+9) { animation-delay: 0.16s; }

@keyframes tableRowIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   VIEW TRANSITIONS Ã¢â‚¬â€ Smooth page switch animations
   ============================================================ */
.view-section {
    animation: viewFadeIn 0.25s ease-out;
}
.view-section.hidden {
    animation: none;
}
@keyframes viewFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   SIDEBAR COLLAPSE Ã¢â‚¬â€ Compact icon mode
   ============================================================ */
.sidebar {
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed {
    width: 64px;
}
.sidebar.collapsed .sidebar-header {
    padding: 16px 12px;
}
.sidebar.collapsed .logo span,
.sidebar.collapsed .logo .ms-auto,
.sidebar.collapsed .sidebar-category,
.sidebar.collapsed .nav-link span {
    display: none;
}
.sidebar.collapsed .logo {
    justify-content: center;
}
.sidebar.collapsed .logo-icon {
    font-size: 22px;
}
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
    margin: 2px 6px;
    border-radius: var(--radius-sm);
}
.sidebar.collapsed .nav-link i {
    font-size: 18px;
    margin: 0;
}
.sidebar.collapsed .nav-item.active .nav-link {
    margin: 2px 6px;
    padding: 12px;
}
.sidebar.collapsed .nav-item.active .nav-link::before {
    display: none;
}
/* Tooltip on collapsed sidebar */
.sidebar.collapsed .nav-link {
    position: relative;
}
.sidebar.collapsed .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    transform: translateY(-50%) translateX(4px);
    margin-left: 8px;
    z-index: 1100;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color-hover);
}
.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
/* Sidebar collapse toggle button */
.sidebar-collapse-btn {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.2s;
    opacity: 0;
}
.sidebar:hover .sidebar-collapse-btn {
    opacity: 1;
}
.sidebar-collapse-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}
.sidebar.collapsed .sidebar-collapse-btn {
    opacity: 1;
}
.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}
/* Collapsed sidebar footer */
.sidebar.collapsed div[style*="margin-top: auto"] {
    padding: 12px 6px;
}
.sidebar.collapsed div[style*="margin-top: auto"] button {
    padding: 10px;
    font-size: 0;
    gap: 0;
}
.sidebar.collapsed div[style*="margin-top: auto"] button i {
    font-size: 16px;
}

/* ============================================================
   FOCUS MODE Ã¢â‚¬â€ Full-screen table
   ============================================================ */
body.focus-mode .sidebar,
body.focus-mode .mobile-topbar,
body.focus-mode .page-header,
body.focus-mode .top-header,
body.focus-mode .search-section,
body.focus-mode .vps-status-bar {
    display: none !important;
}
body.focus-mode .main-content {
    margin: 0;
}
body.focus-mode #dashboardView {
    padding: 0;
}
body.focus-mode .table-container {
    border-radius: 0;
}
.focus-mode-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color-hover);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}
.focus-mode-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}
body.focus-mode .focus-mode-btn {
    background: var(--accent-danger);
    color: white;
}
body.focus-mode .focus-mode-btn:hover {
    background: #dc2626;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes budgetPulse {
    0% { transform: scale(1); box-shadow: 0 0 rgba(34,197,94,0.5); }
    30% { transform: scale(1.08); box-shadow: 0 0 8px 2px rgba(34,197,94,0.35); }
    to { transform: scale(1); box-shadow: 0 0 rgba(34,197,94,0); }
}
.spin, .spinning { animation: spin 1s linear infinite; }

/* Status active text */
.status-active { color: var(--text-secondary); font-size: 12px; }

/* Input label */
.input-group label {
    display: block; font-size: 11px;
    color: var(--text-secondary); margin-bottom: 6px;
    font-weight: 500;
}
.info-icon { font-size: 12px; color: var(--text-secondary); cursor: pointer; }

/* Calendar wrapper */
.calendar-select-wrapper select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

/* Ã¢â€â‚¬Ã¢â€â‚¬ Small phones (Ã¢â€°Â¤ 640px) Ã¢â€â‚¬Ã¢â€â‚¬ */
@media (max-width: 640px) {
    .reports-kpi-bar { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .reports-kpi-item { padding: 10px 12px; }
    .kpi-val-lg { font-size: 15px; }
    .card-kpi-bar .kpi-value { font-size: 17px; }
    .report-account-row { padding: 8px 10px; }
    .report-acc-reorder { display: none; }
    .btn-compact-toggle { padding: 7px 10px; font-size: 12px; }

    /* VPS status bar: compact on small screens */
    .vps-status-bar { flex-wrap: wrap; gap: 8px; padding: 6px 12px; font-size: 10px; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Reports view: reduce padding Ã¢â€â‚¬Ã¢â€â‚¬ */
    #reportsView { padding: 12px !important; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Date chips: horizontal scroll on mobile Ã¢â€â‚¬Ã¢â€â‚¬ */
    .date-chips-row {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        max-width: 100%;
    }
    .date-chips-row::-webkit-scrollbar { display: none; }
    .date-chip { padding: 4px 10px; font-size: 10px; flex-shrink: 0; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Custom date range: stack vertically Ã¢â€â‚¬Ã¢â€â‚¬ */
    #customDateRange {
        flex-direction: column !important;
        width: 100%;
    }
    #customDateRange input[type="date"] { width: 100% !important; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Global KPI cards: horizontal scroll Ã¢â€â‚¬Ã¢â€â‚¬ */
    .reports-kpi-bar {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        display: flex !important;
    }
    .reports-kpi-bar::-webkit-scrollbar { display: none; }
    .reports-kpi-bar > div {
        min-width: 110px !important;
        flex: 0 0 auto !important;
        padding: 8px 10px !important;
    }
    .reports-kpi-bar > div:first-child {
        min-width: 140px !important;
    }
    .reports-kpi-bar > div > div:last-child {
        font-size: 14px !important;
    }
    /* Hide secondary metrics on small phones */
    .reports-kpi-bar .kpi-extra {
        display: none !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Hourly chart: smaller on mobile Ã¢â€â‚¬Ã¢â€â‚¬ */
    #reportsContainer [id^="hourlySpendChart_"] {
        height: 200px !important;
    }
    .hourly-chip { padding: 3px 7px; font-size: 9px; }
    .hourly-tpl-chip { padding: 3px 8px; font-size: 9px; }
    #hourlyFilterChips {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    #hourlyTplChips {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    #hourlyTplChips::-webkit-scrollbar { display: none; }
    #hourlyFilterChips::-webkit-scrollbar { display: none; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Template card header: tighter Ã¢â€â‚¬Ã¢â€â‚¬ */
    #reportsContainer .card-header { padding: 10px 12px !important; }
    #reportsContainer .card-header h3 { font-size: 13px !important; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Account row: stack name and spend vertically Ã¢â€â‚¬Ã¢â€â‚¬ */
    .report-account-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    .report-acc-name {
        max-width: 100% !important;
    }
    .report-acc-spend {
        justify-content: flex-start !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Casa pills: scroll horizontal Ã¢â€â‚¬Ã¢â€â‚¬ */
    .report-acc-name > div:last-child {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
    }
    .report-acc-name > div:last-child::-webkit-scrollbar { display: none; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Reports topbar: wrap Ã¢â€â‚¬Ã¢â€â‚¬ */
    .reports-topbar {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 8px 12px !important;
    }
    .reports-topbar > div {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Gerar/Atualizar button: full-width Ã¢â€â‚¬Ã¢â€â‚¬ */
    #reportsView .page-header .btn-primary {
        width: 100% !important;
        align-self: stretch !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Distribution bar labels: stack vertically Ã¢â€â‚¬Ã¢â€â‚¬ */
    .dist-bar-labels {
        flex-direction: column !important;
        gap: 2px !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Card KPI bar: stack Ã¢â€â‚¬Ã¢â€â‚¬ */
    .card-kpi-bar {
        flex-direction: column !important;
        gap: 6px !important;
    }
    .card-kpi-bar > div:last-child {
        align-self: flex-start !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Casa pills in template header: smaller Ã¢â€â‚¬Ã¢â€â‚¬ */
    #reportsContainer .card-header [style*="display:flex"][style*="gap:8px"] {
        gap: 4px !important;
    }
    #reportsContainer .card-header [style*="display:flex"][style*="gap:8px"] > div {
        padding: 3px 7px !important;
        font-size: 10px !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Hourly chart: compact on small phones Ã¢â€â‚¬Ã¢â€â‚¬ */
    .hourly-chart-body {
        height: 200px !important;
        padding: 8px 10px !important;
    }
    .hourly-chart-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    .hourly-chart-header > div:first-child {
        flex-wrap: wrap;
    }
    .hourly-chart-header > div:first-child span:nth-child(2) {
        font-size: 12px !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Spend value in row: slightly smaller Ã¢â€â‚¬Ã¢â€â‚¬ */
    .report-acc-spend span:first-child {
        font-size: 13px !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ btn-copy-mini: bigger touch target on mobile Ã¢â€â‚¬Ã¢â€â‚¬ */
    .btn-copy-mini {
        min-width: 36px !important;
        min-height: 36px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    .btn-copy-total {
        min-height: 36px !important;
        padding: 6px 14px !important;
    }

    /* Unmapped accounts: stack on mobile */
    [data-unmapped-row] {
        flex-wrap: wrap !important;
    }
    [data-unmapped-row] > div:first-of-type {
        flex-basis: calc(100% - 60px) !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Control Center: single column everything Ã¢â€â‚¬Ã¢â€â‚¬ */
    #controlCenterView [style*="grid-template-columns:1fr 380px"],
    #controlCenterView [style*="grid-template-columns: 1fr 380px"] {
        grid-template-columns: 1fr !important;
    }
    #controlCenterView [style*="grid-template-columns:repeat(auto-fill,minmax(320px,1fr))"],
    #controlCenterView [style*="grid-template-columns: repeat(auto-fill, minmax(320px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    /* CC header: stack vertically */
    #controlCenterView > div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    /* CC body: reduce padding */
    #controlCenterView > div:nth-child(2) {
        padding: 12px !important;
    }
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Tablets & phones (Ã¢â€°Â¤ 768px) Ã¢â€â‚¬Ã¢â€â‚¬ */
@media (max-width: 768px) {
    /* FIX: Allow body scroll on mobile */
    html { overflow: auto !important; overflow-x: hidden !important; }
    body, body.dark-theme {
        overflow: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        min-height: 100vh;
    }

    .app-container {
        flex-direction: column;
        height: auto !important;
        min-height: 100vh;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Mobile Topbar Ã¢â€â‚¬Ã¢â€â‚¬ */
    .mobile-topbar.hidden-desktop {
        display: flex !important;
        align-items: center; justify-content: space-between;
        height: 56px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        padding: 0 16px; width: 100%; z-index: 1050;
        position: sticky; top: 0;
        flex-shrink: 0;
    }
    .hamburger-btn {
        background: transparent; border: none;
        color: white; font-size: 20px;
        cursor: pointer; padding: 10px;
    }
    .mobile-topbar .logo { display: flex; align-items: center; gap: 8px; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Sidebar Ã¢â‚¬â€ slide-in drawer with backdrop Ã¢â€â‚¬Ã¢â€â‚¬ */
    .sidebar {
        position: fixed; display: flex;
        flex-direction: column;
        top: 0; left: -300px;
        width: 270px; height: 100vh; height: 100dvh;
        z-index: 2000; padding-top: 0;
        transition: left var(--ease-normal);
        box-shadow: none;
        background: var(--bg-secondary);
    }
    .sidebar.show {
        left: 0;
        box-shadow: 8px 0 32px rgba(0,0,0,0.5);
    }
    .sidebar-header {
        display: flex !important;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
    }
    .sidebar-divider, .user-profile, .logout-btn { display: flex !important; }

    /* Sidebar collapse button: hide on mobile */
    .sidebar-collapse-btn { display: none !important; }
    .sidebar.collapsed { width: 270px; }
    .sidebar.collapsed .sidebar-category,
    .sidebar.collapsed .nav-link span,
    .sidebar.collapsed .logo span,
    .sidebar.collapsed .logo .ms-auto { display: initial !important; }

    /* Sidebar backdrop overlay */
    .sidebar-backdrop {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 1999;
        animation: fadeIn 0.2s ease;
    }
    .sidebar-backdrop.show {
        display: block;
    }

    .nav-list { flex-direction: column; display: block; height: auto; }
    .nav-item { display: block; }
    .nav-link {
        flex-direction: row; justify-content: flex-start;
        padding: 12px 20px; font-size: 14px;
    }
    .nav-link i { font-size: 16px; min-width: 22px; text-align: center; }
    .nav-item.active .nav-link {
        margin: 2px 10px; padding: 12px 14px;
        background: linear-gradient(135deg, rgba(129,140,248,0.14), rgba(99,102,241,0.06));
        color: var(--accent-primary-light);
        border-radius: var(--radius-sm);
    }
    .nav-item.active .nav-link::before { display: none; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Main content Ã¢â‚¬â€ scrollable on mobile Ã¢â€â‚¬Ã¢â€â‚¬ */
    .main-content {
        height: auto !important;
        min-height: calc(100vh - 56px);
        min-height: calc(100dvh - 56px);
        overflow: visible !important;
        flex: 1;
        padding-bottom: 72px; /* Space for mobile bottom nav */
    }

    /* Show hidden-desktop elements on mobile */
    .hidden-desktop {
        display: initial !important;
    }
    /* But the mobile-bottom-nav needs flex specifically */
    .mobile-bottom-nav.hidden-desktop {
        display: flex !important;
    }
    /* And the topbar needs flex too */
    .mobile-topbar.hidden-desktop {
        display: flex !important;
    }

    /* Horizontal scroll indicator for CC tables */
    .table-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }
    .table-scroll-wrapper::after {
        content: '';
        position: absolute;
        top: 0; right: 0; bottom: 0;
        width: 30px;
        background: linear-gradient(90deg, transparent, var(--bg-card));
        pointer-events: none;
        opacity: 0.8;
    }

    /* Dashboard view needs scroll */
    #dashboardView {
        height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }

    /* View sections need natural flow */
    #settingsView, #reportsView, #chatView, #adminView {
        height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }

    /* Control Center Ã¢â‚¬â€ needs natural flow on mobile */
    #controlCenterView {
        height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }

    /* Smart Alerts Ã¢â‚¬â€ needs natural flow on mobile */
    #smartAlertsView {
        height: auto !important;
        overflow: visible !important;
    }

    /* WhatsApp view Ã¢â‚¬â€ needs natural flow on mobile */
    #whatsappConfigView {
        height: auto !important;
        overflow: visible !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Page header Ã¢â‚¬â€ stack vertically Ã¢â€â‚¬Ã¢â€â‚¬ */
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    .page-header > div:last-child {
        flex-wrap: wrap;
        gap: 8px;
    }
    .page-header h1 { font-size: 20px !important; }

    /* Account multi-select Ã¢â‚¬â€ fit mobile width */
    .custom-multi-select.hierarchy-select,
    #accountMultiSelect {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Tabs & top header Ã¢â€â‚¬Ã¢â€â‚¬ */
    .top-header {
        height: auto; padding: 10px 12px;
        flex-direction: column; align-items: stretch; gap: 10px;
    }
    .tabs-container {
        overflow-x: auto; padding-bottom: 5px;
        white-space: nowrap; padding-right: 15px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tabs-container::-webkit-scrollbar { display: none; }
    .tab-btn { padding: 10px 14px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Search section Ã¢â€â‚¬Ã¢â€â‚¬ */
    .search-section {
        flex-direction: column; align-items: stretch; gap: 10px;
        padding: 10px 12px !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Table Ã¢â‚¬â€ horizontal scroll Ã¢â€â‚¬Ã¢â€â‚¬ */
    .table-container {
        padding: 0 8px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .data-table th, .data-table td { padding: 10px 8px; font-size: 12px; }
    .data-table { min-width: 900px; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Modals Ã¢â‚¬â€ full-width on mobile Ã¢â€â‚¬Ã¢â€â‚¬ */
    .modal {
        width: 95% !important; max-width: 95% !important;
        margin: 2.5% auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-body { max-height: 60vh; padding: 16px; overflow-y: auto; }
    .rule-builder-modal {
        width: 95% !important; max-width: 95% !important;
        height: 90vh !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Buttons Ã¢â€â‚¬Ã¢â€â‚¬ */
    .btn { padding: 8px 12px; font-size: 13px; white-space: nowrap; }

    /* Date select in header */
    .calendar-select-wrapper { width: 100%; }
    .calendar-select-wrapper select { width: 100%; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Reports Ã¢â€â‚¬Ã¢â€â‚¬ */
    #reportsView { padding: 16px !important; }
    #reportsContainer .card-header h3 { font-size: 14px !important; flex-wrap: wrap; }
    #reportsContainer .card-header > div { flex-direction: column !important; align-items: flex-end !important; gap: 5px; }
    .d-none.d-sm-inline { display: none !important; }

    /* Reports header stacking */
    #reportsView > .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    #reportsView > .page-header > div:last-child {
        align-items: stretch !important;
        width: 100%;
    }
    .date-chips-row {
        justify-content: flex-start !important;
    }

    /* Hourly chart wrapper */
    .hourly-chart-wrapper {
        padding: 12px !important;
    }
    .hourly-chart-wrapper canvas {
        max-height: 220px;
    }

    /* Distribution bar inside card headers */
    .distribution-bar-wrap {
        width: 100% !important;
        margin-top: 6px;
    }

    /* Account row mobile layout */
    .report-account-row {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 10px !important;
    }

    /* Copy buttons Ã¢â‚¬â€ compact on mobile */
    .report-acc-copy { padding: 3px 6px !important; font-size: 10px !important; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Auth overlays Ã¢â‚¬â€ proper mobile sizing Ã¢â€â‚¬Ã¢â€â‚¬ */
    #loginOverlay { padding: 16px !important; }
    #loginOverlay .auth-box {
        width: 100% !important;
        max-width: 420px !important;
        padding: 28px 20px !important;
    }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Toast Ã¢â‚¬â€ full-width on mobile, above bottom nav Ã¢â€â‚¬Ã¢â€â‚¬ */
    .toast-container {
        left: 12px !important;
        right: 12px !important;
        bottom: 76px !important;
    }
    .toast { min-width: unset !important; width: 100%; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Bulk actions bar Ã¢â‚¬â€ above bottom nav Ã¢â€â‚¬Ã¢â€â‚¬ */
    .bulk-actions-bar {
        left: 12px !important;
        right: 12px !important;
        bottom: 76px !important;
        transform: translateX(0) translateY(100%) !important;
        width: auto !important;
        padding: 12px 16px;
    }
    .bulk-actions-bar.show {
        transform: translateX(0) translateY(0) !important;
    }
    .bulk-actions-content { flex-wrap: wrap; gap: 10px; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Command palette Ã¢â€â‚¬Ã¢â€â‚¬ */
    .cmd-palette { width: 95vw !important; }

    /* Ã¢â€â‚¬Ã¢â€â‚¬ Control center Ã¢â‚¬â€ responsive grids Ã¢â€â‚¬Ã¢â€â‚¬ */
    .rules-panel { padding: 16px !important; }
    #controlCenterView [style*="grid-template-columns:1fr 380px"],
    #controlCenterView [style*="grid-template-columns: 1fr 380px"] {
        grid-template-columns: 1fr !important;
    }
    #controlCenterView [style*="grid-template-columns:repeat(auto-fill,minmax(320px,1fr))"] {
        grid-template-columns: 1fr !important;
    }
    /* CC header */
    #controlCenterView > div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 16px !important;
    }
    #controlCenterView > div:first-child > div:last-child {
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
    /* CC body */
    #controlCenterView > div:nth-child(2) {
        padding: 12px !important;
    }
    /* CC pacing table scroll */
    #controlCenterView table {
        min-width: 500px;
    }
    /* CC Comparison analysis selects */
    #controlCenterView select {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Integration panel */
    .integration-panel { padding: 16px; }

    /* Focus mode  */
    .focus-mode-btn { bottom: 76px; right: 12px; width: 38px; height: 38px; }

    /* Ã¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢Â
       MOBILE BOTTOM NAV BAR
       Quick access to main views without opening sidebar
       Ã¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢Â */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        z-index: 1060;
        justify-content: space-around;
        align-items: center;
        padding: 0 4px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    .mobile-bottom-nav .bnav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 10px;
        border-radius: var(--radius-sm);
        color: var(--text-muted);
        font-size: 9px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        transition: all var(--ease-fast);
        background: transparent;
        border: none;
        font-family: inherit;
        flex: 1;
        max-width: 80px;
        min-width: 0;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-bottom-nav .bnav-item i {
        font-size: 18px;
        transition: all var(--ease-fast);
    }
    .mobile-bottom-nav .bnav-item.active {
        color: var(--accent-primary-light);
    }
    .mobile-bottom-nav .bnav-item.active i {
        text-shadow: 0 0 12px rgba(129,140,248,0.5);
    }
    .mobile-bottom-nav .bnav-item:active {
        transform: scale(0.92);
    }
}

.filters-section {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.filters-left, .filters-right {
    display: flex; align-items: center; gap: 10px;
}

/* ============================================================
   DASHBOARD CARDS Ã¢â‚¬â€ DuckAds Style
   ============================================================ */

/* Ã¢â€â‚¬Ã¢â€â‚¬ Chips Row (Template & Date) Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.dc-chips-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
}
.dc-chips-row::-webkit-scrollbar { display: none; }

.dc-chip {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    white-space: nowrap;
    display: flex;
    align-items: center;
}
.dc-chip:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.dc-chip.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}
.dc-chip-date { font-size: 11px; padding: 5px 14px; }

.dc-chip-sm {
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 14px;
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ KPI Grid Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.dc-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.dc-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.dc-kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-md);
}
.dc-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.dc-kpi-spend::before { background: linear-gradient(90deg, #ef4444, #f97316); }
.dc-kpi-traffic::before { background: linear-gradient(90deg, #3b82f6, #06b6d4); }
.dc-kpi-ftd::before { background: linear-gradient(90deg, #22c55e, #10b981); }
.dc-kpi-cac::before { background: linear-gradient(90deg, #8b5cf6, #a855f7); }

.dc-kpi-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
    font-size: 16px;
}
.dc-kpi-spend .dc-kpi-icon { background: rgba(239,68,68,0.12); color: #ef4444; }
.dc-kpi-traffic .dc-kpi-icon { background: rgba(59,130,246,0.12); color: #3b82f6; }
.dc-kpi-ftd .dc-kpi-icon { background: rgba(34,197,94,0.12); color: #22c55e; }
.dc-kpi-cac .dc-kpi-icon { background: rgba(139,92,246,0.12); color: #8b5cf6; }

.dc-kpi-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.dc-kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 4px;
}
.dc-kpi-value-plain { color: #22c55e; }
.dc-kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Section Card Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.dc-section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 16px;
}
.dc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.dc-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}
.dc-section-right {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Distribution Bar Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.dc-dist-bar {
    display: flex;
    height: 14px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 10px;
    background: var(--bg-elevated);
}
.dc-dist-traffic {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 20px 0 0 20px;
    min-width: 4px;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.dc-dist-conv {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 0 20px 20px 0;
    min-width: 4px;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.dc-dist-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
}
.dc-dist-label-t { color: #60a5fa; }
.dc-dist-label-c { color: #a78bfa; }

/* Ã¢â€â‚¬Ã¢â€â‚¬ Hourly Chart Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.dc-hourly-filters {
    display: flex;
    gap: 4px;
}
.dc-hourly-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Account Cards Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.dc-account-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.dc-account-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid rgba(255,255,255,0.03);
    transition: all 0.2s;
}
.dc-account-card:hover {
    border-color: var(--border-color-hover);
    background: var(--bg-card-hover);
}
.dc-acc-info { flex: 1; min-width: 0; }
.dc-acc-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.dc-acc-sub {
    font-size: 11px;
    font-weight: 600;
    color: #ef4444;
}
.dc-acc-imp { color: var(--text-muted); font-weight: 400; margin-left: 4px; font-size: 10px; }
.dc-acc-traffic { font-size: 10px; color: #60a5fa; margin-top: 2px; }
.dc-acc-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}
.dc-acc-ftd {
    font-size: 12px;
    font-weight: 800;
    color: #22c55e;
}
.dc-acc-cac {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Top Ads Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
.dc-ads-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dc-ad-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid rgba(255,255,255,0.03);
    transition: all 0.2s;
}
.dc-ad-row:hover {
    border-color: var(--border-color-hover);
    background: var(--bg-card-hover);
}
.dc-ad-thumb {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dc-ad-info { flex: 1; min-width: 0; }
.dc-ad-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.dc-ad-sub {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dc-ad-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}
.dc-ad-ftd {
    font-size: 12px;
    font-weight: 800;
    color: #22c55e;
}
.dc-ad-cac {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Dashboard Cards Container Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
#dashboardCardsContainer {
    padding: 0 25px 20px;
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Mobile Responsive Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬Ã¢â€â‚¬ */
@media (max-width: 768px) {
    #dashboardCardsContainer { padding: 0 12px 16px; }

    .dc-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .dc-kpi-card { padding: 14px 12px; }
    .dc-kpi-value { font-size: 18px; }
    .dc-kpi-icon { width: 30px; height: 30px; font-size: 13px; margin-bottom: 8px; }

    .dc-account-list { grid-template-columns: 1fr; }

    .dc-hourly-chart { height: 180px !important; }

    .dc-section-header { flex-direction: column; align-items: flex-start; gap: 6px; }
    .dc-hourly-filters { flex-wrap: wrap; }
}


/* ============================================================
   DASHBOARD KPI SUMMARY CARDS
   ============================================================ */
.dash-kpi-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--ease-normal);
    cursor: default;
    position: relative;
    overflow: hidden;
}
.dash-kpi-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--glow-gradient);
    opacity: 0;
    transition: opacity var(--ease-normal);
}
.dash-kpi-card:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.dash-kpi-card:hover::before { opacity: 1; }

.dash-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.dash-kpi-data {
    display: flex;
    flex-direction: column;
    gap: 1px;
    position: relative;
    z-index: 1;
    min-width: 0;
}
.dash-kpi-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-kpi-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* BOTTOM NAV NOTIFICATION DOTS */
.bnav-item { position: relative; }
.bnav-badge {
    position: absolute;
    top: 2px; right: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid var(--bg-secondary);
    animation: badgePulse 2s ease-in-out infinite;
    display: none;
}
.bnav-badge.show { display: block; }
@keyframes badgePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* LAST-UPDATED TIMESTAMP BADGE */
.last-updated-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(129,140,248,0.06);
    border: 1px solid rgba(129,140,248,0.12);
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.last-updated-badge i { font-size: 9px; color: var(--accent-primary); }

/* MOBILE: KPI responsive + Touch targets */
@media (max-width: 768px) {
    #dashKpiBar {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 0 12px 8px !important;
    }
    .dash-kpi-card { padding: 10px 12px; gap: 8px; }
    .dash-kpi-icon { width: 32px; height: 32px; font-size: 13px; }
    .dash-kpi-value { font-size: 15px; }
    .dash-kpi-label { font-size: 9px; }
    [data-unmapped-camp] button,
    [data-config-camp] button,
    [data-config-pixel] button {
        min-height: 32px !important;
        min-width: 40px !important;
        padding: 4px 10px !important;
        font-size: 11px !important;
    }
    #globalUnmappedAlert {
        top: 56px !important;
        font-size: 11px !important;
        padding: 6px 12px !important;
    }
}

/* ============================================================
   LOGIN PAGE — Animated Gradient Orbs + Card Entry
   ============================================================ */
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}
@keyframes loginCardEntry {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   SKELETON TABLE ROWS
   ============================================================ */
.skeleton-table-body {
    padding: 8px 16px;
}
.skeleton-row {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.skeleton-cell {
    height: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}
.skeleton-cell.w-8 { width: 30px; flex-shrink: 0; }
.skeleton-cell.w-10 { width: 70px; flex-shrink: 0; }
.skeleton-cell.w-40 { flex: 1; min-width: 120px; }
.skeleton-cell.h-10 { height: 10px; }
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Table loading overlay animation */
.data-table.is-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ============================================================
   GLOBAL ERROR BOUNDARY TOAST
   ============================================================ */
.error-boundary-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(239,68,68,0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10000;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(239,68,68,0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    max-width: 90vw;
    pointer-events: none;
}
.error-boundary-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================================
   PULL-TO-REFRESH (Mobile Only)
   ============================================================ */
#pullRefreshIndicator {
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: none;
    opacity: 0;
}
.ptr-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}
.ptr-arrow {
    font-size: 16px;
    transition: transform 0.25s ease;
    color: #818cf8;
}
.ptr-ready .ptr-content {
    color: #818cf8;
}
.ptr-ready .ptr-arrow {
    color: #10b981;
}
.ptr-refreshing .ptr-arrow {
    color: #818cf8;
}
.ptr-refreshing .ptr-content {
    color: var(--text-secondary);
}

/* ============================================================
   FLOATING ACTION BUTTON (Mobile Only)
   ============================================================ */
#fabContainer {
    position: fixed;
    right: 16px;
    bottom: 80px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
}
.fab-main {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99,102,241,0.45);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.fab-main:active {
    transform: scale(0.92);
}
.fab-main.fab-open {
    transform: rotate(45deg);
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-radius: 50%;
}
.fab-main.fab-open i::before {
    content: "\f00d";
}
.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.8);
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.fab-menu.fab-menu-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.fab-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateX(20px);
}
.fab-menu-open .fab-action {
    opacity: 1;
    transform: translateX(0);
}
.fab-action:active {
    transform: scale(0.95);
    background: rgba(99,102,241,0.15);
}
.fab-action i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    color: #818cf8;
}
.fab-action[data-action="report"] i { color: #25d366; }
.fab-action[data-action="unmapped"] i { color: #f59e0b; }
.fab-action[data-action="top"] i { color: #64748b; }

/* ============================================================
   TABLE ROW HOVER GLOW (Enhanced)
   ============================================================ */
.data-table tbody tr,
.reports-table tbody tr {
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.data-table tbody tr:hover td,
.reports-table tbody tr:hover td {
    background: rgba(99,102,241,0.04) !important;
}
.data-table tbody tr:hover,
.reports-table tbody tr:hover {
    box-shadow: inset 0 0 0 1px rgba(99,102,241,0.08);
}

/* ============================================================
   COUNTDOWN BADGE (CC Templates)
   ============================================================ */
.cc-countdown-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(99,102,241,0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.15);
    margin-top: 6px;
}
.cc-countdown-badge.cc-countdown-urgent {
    background: rgba(239,68,68,0.1);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.2);
}
.cc-countdown-badge i {
    font-size: 9px;
}

/* ============================================================
   HOURLY CHART FIX (Mobile)
   ============================================================ */
@media (max-width: 768px) {
    .chart-container canvas,
    [id*="hourlyChart"] {
        min-height: 200px !important;
    }
    #reportsContainer .card-header h3 { font-size: 12px !important; }
    #reportsContainer .card-header h3 span { max-width: 130px; }
    #chatView .rules-header h2 { font-size: 16px !important; }
    #chatView .chat-msg > div:last-child > div:first-child { font-size: 12px !important; }
    .reports-kpi-bar > div { min-width: 95px !important; padding: 6px 8px !important; }
    .reports-kpi-bar > div > div:last-child { font-size: 12px !important; }
}

/* ============================================================
   OPTIMIZER MODULE
   ============================================================ */
.opt-controls {
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.opt-loading, .opt-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px; text-align: center;
}
.opt-loading p, .opt-empty p {
    color: var(--text-secondary); margin-top: 12px; font-size: 13px;
}
.opt-kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px; margin-bottom: 24px;
}
.opt-kpi {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 16px; text-align: center;
    transition: all var(--ease-normal);
}
.opt-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.opt-kpi-val { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.opt-kpi-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }
.opt-kpi-danger .opt-kpi-val { color: var(--accent-danger); }
.opt-kpi-warning .opt-kpi-val { color: var(--accent-warning); }
.opt-section { margin-bottom: 28px; }
.opt-section h3 {
    font-size: 15px; font-weight: 600; margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.opt-suggestions { display: flex; flex-direction: column; gap: 10px; }
.opt-suggestion {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 14px 18px;
    transition: all var(--ease-normal);
}
.opt-suggestion:hover { border-color: var(--border-color-hover); box-shadow: var(--shadow-sm); }
.sug-urgent { border-left: 3px solid var(--accent-danger); }
.sug-rec { border-left: 3px solid var(--accent-warning); }
.sug-info { border-left: 3px solid var(--accent-info); }
.sug-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sug-badge {
    font-size: 11px; font-weight: 700; padding: 2px 10px;
    border-radius: 12px; background: rgba(255,255,255,0.06);
}
.sug-type { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sug-target { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.sug-account { font-size: 11px; color: var(--text-muted); }
.sug-reason { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.sug-impact { font-size: 12px; color: var(--accent-primary-light); margin-top: 4px; font-weight: 500; }
.sug-actions { display: flex; gap: 8px; margin-top: 10px; }
.opt-adset-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden;
    transition: all var(--ease-normal);
}
.opt-adset-card:hover { border-color: var(--border-color-hover); }
.opt-adset-card.has-issues { border-left: 3px solid var(--accent-warning); }
.opt-adset-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
}
.opt-adset-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.opt-adset-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-copy-id {
    background: none; border: 1px solid var(--border-color); color: var(--text-muted);
    padding: 2px 8px; border-radius: 6px; font-size: 10px; cursor: pointer;
    font-family: monospace; transition: all var(--ease-fast);
}
.btn-copy-id:hover { color: var(--accent-primary-light); border-color: var(--accent-primary); }
.opt-adset-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.opt-stat { font-size: 12px; color: var(--text-secondary); }
.opt-stat strong { color: var(--text-primary); }
.opt-creatives-section, .opt-placements-section, .opt-demo-section { padding: 14px 20px; }
.opt-creatives-section h4, .opt-placements-section h4, .opt-demo-section h4 {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px;
}
.opt-creative-list { display: flex; flex-direction: column; gap: 6px; }
.opt-creative {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    border-radius: var(--radius-sm); transition: background var(--ease-fast);
}
.opt-creative:hover { background: rgba(255,255,255,0.02); }
.opt-creative-good { border-left: 2px solid var(--accent-success); }
.opt-creative-warning { border-left: 2px solid var(--accent-warning); }
.opt-creative-bad { border-left: 2px solid var(--accent-danger); background: rgba(239,68,68,0.04); }
.opt-creative-neutral { border-left: 2px solid var(--border-color); }
.opt-creative-icon { font-size: 14px; flex-shrink: 0; }
.opt-creative-info { flex: 1; min-width: 0; }
.opt-creative-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.opt-creative-id { font-size: 10px; color: var(--text-muted); cursor: pointer; font-family: monospace; }
.opt-creative-id:hover { color: var(--accent-primary-light); }
.opt-paused { font-size: 9px; background: rgba(255,255,255,0.06); color: var(--text-muted); padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.opt-creative-metrics { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.opt-creative-metrics strong { color: var(--text-primary); }
.opt-placement-bars { display: flex; flex-direction: column; gap: 8px; }
.opt-placement {
    display: grid; grid-template-columns: 160px 1fr 90px 60px;
    align-items: center; gap: 10px; font-size: 12px;
}
.opt-pl-label { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-pl-bar { height: 8px; background: var(--bg-primary); border-radius: 4px; overflow: hidden; }
.opt-pl-fill { height: 100%; background: var(--accent-primary); border-radius: 4px; transition: width 0.4s ease; }
.placement-best .opt-pl-fill { background: var(--accent-success); }
.placement-bad .opt-pl-fill { background: var(--accent-danger); }
.opt-pl-cpa { color: var(--text-primary); font-weight: 500; text-align: right; }
.opt-pl-ftd { color: var(--text-muted); text-align: right; }
.opt-demo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-demo-chip {
    font-size: 11px; padding: 5px 12px; border-radius: 16px;
    border: 1px solid var(--border-color); background: var(--bg-primary);
}
.demo-good { border-color: rgba(16,185,129,0.3); color: var(--accent-success); }
.demo-bad { border-color: rgba(239,68,68,0.3); color: var(--accent-danger); }
@media (max-width: 768px) {
    .opt-controls { flex-direction: column; }
    .opt-controls select, .opt-controls button { max-width: 100% !important; width: 100%; }
    .opt-kpis { grid-template-columns: repeat(2, 1fr); }
    .opt-adset-header { flex-direction: column; }
    .opt-creative { flex-wrap: wrap; }
    .opt-creative-metrics { width: 100%; justify-content: space-between; margin-top: 4px; }
    .opt-placement { grid-template-columns: 100px 1fr 70px 40px; gap: 6px; }
}

/* ============================================================
   MODAL TABLE OVERFLOW FIX (Mobile)
   ============================================================ */
@media (max-width: 768px) {
    .modal-body table,
    .modal table,
    .scrollable-modal-body table {
        min-width: unset !important;
        width: 100% !important;
        font-size: 12px;
    }
    .modal-body .table-responsive,
    .modal .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        border: 1px solid var(--border-color);
    }
    /* Pacing monitor table fix */
    .modal-body table td,
    .modal-body table th {
        padding: 6px 8px !important;
        white-space: nowrap;
    }
}

/* ============================================================
   MISC UX POLISH
   ============================================================ */
/* Smooth scroll for all views */
#reportsView, #controlCenterView, #settingsView,
#whatsappConfigView, #smartAlertsView, #launcherView, #creativesView {
    scroll-behavior: smooth;
}

/* Better scrollbar for dark theme */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ============================================================
   MOBILE RESPONSIVE FIX - Major overhaul
   Chat IA, Reports Cards, Overall polish
   ============================================================ */
@media (max-width: 768px) {

    /* -- CHAT / IA VIEW: Stack panels vertically -- */
    #chatView {
        height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }
    #chatView > div:nth-child(2) {
        flex-direction: column !important;
        overflow: visible !important;
        height: auto !important;
    }
    #chatView #rulesPanel {
        flex: none !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        padding: 16px !important;
        max-height: none !important;
        overflow: visible !important;
    }
    #chatView .rules-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    #chatView .rules-header > div:last-child {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }
    #chatView .rules-header h2 {
        font-size: 18px !important;
    }
    #chatView > div:nth-child(2) > div:last-child {
        flex: none !important;
        margin: 12px !important;
        min-height: 350px;
        max-height: 60vh;
    }
    #chatView > .page-header {
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 14px 16px !important;
    }
    #chatView > .page-header h1 {
        font-size: 18px !important;
    }
    #chatView > .page-header button {
        margin-left: 0 !important;
    }
    #chatView .chat-messages {
        padding: 14px !important;
        gap: 14px !important;
    }
    #chatView .chat-msg {
        max-width: 95% !important;
    }
    #chatView .chat-msg > div:last-child > div:first-child {
        padding: 12px !important;
        font-size: 13px !important;
    }
    #chatView .chat-input-container {
        padding: 12px !important;
    }
    #chatView .chat-input-container > div {
        padding: 6px 10px !important;
    }
    #chatView .chat-input-container input {
        font-size: 14px !important;
    }

    /* -- REPORTS: Template card header fix -- */
    .card-kpi-bar {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    .card-kpi-bar > div:first-child {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .card-kpi-bar > div:last-child {
        align-self: flex-start !important;
    }
    .card-kpi-bar .kpi-label {
        font-size: 10px !important;
        white-space: nowrap;
    }
    .card-kpi-bar .kpi-value {
        font-size: 20px !important;
        font-weight: 800 !important;
    }

    #reportsContainer .card-header > div:first-child {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    #reportsContainer .card-header h3 {
        font-size: 14px !important;
        max-width: calc(100vw - 120px);
    }
    #reportsContainer .card-header h3 span {
        display: inline-block;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
    }

    .btn-reorder-card {
        padding: 6px 8px !important;
        min-width: 32px;
        min-height: 32px;
    }
    .btn-copy-total {
        min-height: 38px !important;
        padding: 6px 16px !important;
        font-size: 13px !important;
    }

    /* -- REPORTS: Page header stacking -- */
    #reportsView .page-header > div:first-child {
        width: 100%;
    }
    #reportsView .page-header > div:first-child > div {
        flex-wrap: wrap !important;
    }
    #reportsView .page-header > div:last-child {
        width: 100%;
        align-items: stretch !important;
    }
    #reportsView .page-header > div:last-child > div:last-child {
        flex-direction: column !important;
        width: 100%;
    }
    #reportsTaxToggle {
        width: 100%;
        justify-content: center !important;
    }

    /* -- REPORTS: Account row polish -- */
    .report-account-row {
        padding: 10px 12px !important;
    }
    .report-acc-name {
        font-size: 12px !important;
    }
    .report-acc-name > div:first-child {
        font-size: 13px !important;
        font-weight: 600;
    }

    /* -- LAUNCHER and CREATIVES: Fix mobile -- */
    #launcherView,
    #creativesView {
        height: auto !important;
        overflow: visible !important;
    }

    /* -- GENERAL: Fix view padding -- */
    #reportsView,
    #controlCenterView,
    #settingsView,
    #whatsappConfigView,
    #smartAlertsView {
        padding: 12px !important;
    }

    /* -- FAB: Above bottom nav -- */
    .fab-container {
        bottom: 80px !important;
    }

    /* -- Template card: tighter spacing -- */
    .template-card-draggable {
        margin-bottom: 14px !important;
    }
    .template-card-draggable .card-header {
        padding: 12px 14px !important;
    }
}

/* -- Extra small phones -- */
@media (max-width: 380px) {
    .card-kpi-bar .kpi-value { font-size: 17px !important; }
    .card-kpi-bar .kpi-label { font-size: 9px !important; }
    #reportsContainer .card-header h3 { font-size: 12px !important; }
    #reportsContainer .card-header h3 span { max-width: 130px; }
    #chatView .rules-header h2 { font-size: 16px !important; }
    #chatView .chat-msg > div:last-child > div:first-child { font-size: 12px !important; }
    .reports-kpi-bar > div { min-width: 95px !important; padding: 6px 8px !important; }
    .reports-kpi-bar > div > div:last-child { font-size: 12px !important; }
}
