/* ==========================================================================
   ChatMango Design System & Global Stylesheet
   Modern Glassmorphism, Vibrant Emerald/Green Accents, Sleek Dark-Light Balance
   ========================================================================== */

:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-light: #ecfdf5;
    --primary-glow: rgba(16, 185, 129, 0.25);
    
    --dark: #0f172a;
    --dark-surface: #1e293b;
    --dark-border: #334155;
    
    --bg-page: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 24px -4px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.35);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Layout & Sidebar
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #0b1329;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.logo-text .name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: block;
}

.logo-text .badge {
    font-size: 0.68rem;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.sidebar-wallet {
    margin: 16px 14px;
    padding: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.wallet-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.wallet-balance {
    font-size: 1.5rem;
    font-weight: 800;
    color: #34d399;
    margin: 4px 0 10px 0;
    font-family: 'JetBrains Mono', monospace;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    color: white;
    background: rgba(255,255,255,0.06);
}

.nav-item.active {
    color: white;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-left: 3px solid #10b981;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 6px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: #10b981;
}

.nav-section-badge {
    font-size: 0.62rem;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 2px 6px;
    border-radius: 9999px;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.avatar {
    width: 34px;
    height: 34px;
    background: #3b82f6;
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-info .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .user-email {
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    color: #94a3b8;
    text-decoration: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   Main Content & Topbar
   ========================================================================== */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-body {
    padding: 24px 28px;
    flex: 1;
    width: 100%;
}


/* ==========================================================================
   Modern Meta Cloud Diagnostic Bar (5-Column Full-Width Grid)
   ========================================================================== */
.topbar {
    min-height: 72px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 28px;
    position: sticky;
    top: 0;
    z-index: 30;
    gap: 18px;
    box-sizing: border-box;
}

.meta-diag-bar {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.meta-card-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 16px;
    min-height: 52px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    width: 100%;
    min-width: 0;
}

.meta-card-chip.chip-status {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
}

.meta-card-chip.chip-quality {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
}

.meta-card-chip.chip-limit {
    background: #f0f9ff;
    border: 1.5px solid #bae6fd;
}

.meta-card-chip.chip-neutral {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
}

.meta-chip-icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.meta-chip-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.meta-chip-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    line-height: 1;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

.meta-card-chip.chip-status .meta-chip-label {
    color: #10b981;
}

.meta-card-chip.chip-quality .meta-chip-label {
    color: #94a3b8;
}

.meta-card-chip.chip-limit .meta-chip-label {
    color: #0284c7;
}

.meta-chip-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.meta-card-chip.chip-status .meta-chip-value {
    color: #047857;
}

.meta-card-chip.chip-quality .meta-chip-value {
    color: #047857;
}

.meta-card-chip.chip-limit .meta-chip-value {
    color: #0284c7;
}

.limit-progress-bar-wrap {
    width: 100%;
    height: 3px;
    background: #e0f2fe;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 3px;
}

.limit-progress-bar-fill {
    height: 100%;
    background: #0284c7;
    border-radius: 9999px;
}

.pulse-dot-green {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
}


/* ==========================================================================
   Dashboard Hero Greeting
   ========================================================================== */
.dashboard-hero {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 1px solid #dcfce7;
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px -2px rgba(16, 185, 129, 0.08);
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #047857;
    background: #dcfce7;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    margin-bottom: 8px;
}

.hero-title {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #0f172a;
    margin-bottom: 4px;
}

.hero-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    font-weight: 500;
}

/* ==========================================================================
   4 Quick Action Launcher Cards
   ========================================================================== */
.quick-actions-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px;
    margin-bottom: 24px;
}

.quick-action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-action-card:hover {
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.15);
    color: #047857;
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.quick-action-icon.blue { background: #eff6ff; color: #2563eb; }
.quick-action-icon.green { background: #ecfdf5; color: #059669; }
.quick-action-icon.purple { background: #f5f3ff; color: #7c3aed; }
.quick-action-icon.amber { background: #fffbeb; color: #d97706; }

/* ==========================================================================
   5 KPI Stat Cards with Visual Progress Bars
   ========================================================================== */
.kpi-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 125px;
    transition: all 0.2s ease;
    position: relative;
}

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

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

.kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-corner-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
}

.kpi-corner-icon.green { background: #ecfdf5; color: #10b981; }
.kpi-corner-icon.blue { background: #eff6ff; color: #3b82f6; }
.kpi-corner-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.kpi-corner-icon.amber { background: #fffbeb; color: #f59e0b; }

.kpi-value {
    font-size: 1.55rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: #0f172a;
    line-height: 1.1;
    margin-bottom: 6px;
}

.kpi-progress-track {
    width: 100%;
    height: 5px;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 8px;
}

.kpi-progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-progress-fill.green {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.kpi-progress-fill.purple {
    background: linear-gradient(90deg, #8b5cf6 0%, #6d28d9 100%);
}

.kpi-action-link {
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}

.kpi-action-link.green { color: #059669; }
.kpi-action-link.green:hover { color: #047857; text-decoration: underline; }
.kpi-action-link.amber { color: #d97706; }
.kpi-action-link.amber:hover { color: #b45309; text-decoration: underline; }

/* ==========================================================================
   Cards, Grid & Stats
   ========================================================================== */
.grid {
    display: grid;
    gap: 20px;
}

.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pipeline-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pipeline-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }

.stat-content .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-content .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-outline-success {
    background: transparent;
    border-color: #10b981;
    color: #10b981;
    width: 100%;
}

.btn-outline-success:hover {
    background: #10b981;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-main);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   Tables & Badges
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.table tr:hover td {
    background: #f8fafc;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-status.badge-sending { background: #fef3c7; color: #b45309; font-weight: 700; }
.badge-status.badge-completed { background: #d1fae5; color: #065f46; font-weight: 700; }

/* ==========================================================================
   2-Way Live Chat Interface
   ========================================================================== */
/* ==========================================================================
   2-Way Live Chat & Modern Inbox Interface
   ========================================================================== */
.chat-container, .inbox-container {
    display: flex;
    height: calc(100vh - 120px);
    min-height: 600px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-top: 14px;
}

.chat-sidebar {
    width: 360px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    flex-shrink: 0;
}

.inbox-search-box {
    padding: 12px 14px 8px 14px;
    position: relative;
}

.inbox-search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: var(--text-main);
    transition: all 0.2s;
}

.inbox-search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.inbox-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.82rem;
}

/* Status Filter Tabs (All, Unread, Open, Closed) */
.inbox-tabs-row {
    display: flex;
    gap: 6px;
    padding: 0 14px 8px 14px;
    border-bottom: 1px solid var(--border-light);
}

.inbox-tab-btn {
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.inbox-tab-btn:hover {
    border-color: #cbd5e1;
    color: #0f172a;
}

.inbox-tab-btn.active {
    background: #047857;
    border-color: #047857;
    color: #ffffff;
}

/* Category & Lead Tag Pills */
.inbox-tags-row {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-light);
    background: #fafafa;
}

.inbox-tag-pill {
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.inbox-tag-pill:hover, .inbox-tag-pill.active {
    border-color: #10b981;
    background: #ecfdf5;
    color: #065f46;
}

.chat-threads-list {
    flex: 1;
    overflow-y: auto;
}

.chat-thread-item {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
    align-items: center;
    position: relative;
}

.chat-thread-item:hover {
    background: #f8fafc;
}

.chat-thread-item.active {
    background: #f0fdf4;
    border-left: 3.5px solid #10b981;
}

/* 2-Letter Colorful Rounded Avatars */
.chat-avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.88rem;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.chat-thread-info {
    flex: 1;
    min-width: 0;
}

.chat-thread-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.chat-thread-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-time {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
    flex-shrink: 0;
}

.chat-thread-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.chat-thread-preview {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-unread-badge {
    background: #10b981;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* Right Chat Main Window */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    min-width: 0;
    position: relative;
}

.chat-header-main {
    min-height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    gap: 12px;
    z-index: 10;
}

/* Meta 24-Hour Messaging Window Alert */
.meta-24h-banner {
    background: #fffbeb;
    border-bottom: 1px solid #fef3c7;
    color: #b45309;
    font-size: 0.8rem;
    padding: 9px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

/* Internal Team Notes Expandable Accordion */
.internal-notes-panel {
    background: #fffdfa;
    border-bottom: 1.5px solid #fde68a;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.notes-timeline-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}

.note-item-bubble {
    background: #ffffff;
    border: 1px solid #fef08a;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: #78350f;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notes-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.notes-input-field {
    flex: 1;
    border: 1.5px solid #fde047;
    background: #ffffff;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.82rem;
    color: var(--text-main);
}

.notes-input-field:focus {
    outline: none;
    border-color: #eab308;
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}

/* Chat Message Bubbles & Stream */
.chat-messages-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-date-divider {
    align-self: center;
    background: #ffffff;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    margin: 8px 0;
}

.msg-row {
    display: flex;
    flex-direction: column;
    max-width: 68%;
}

.msg-row.inbound {
    align-self: flex-start;
}

.msg-row.outbound {
    align-self: flex-end;
}

.msg-box {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    position: relative;
    line-height: 1.45;
}

.msg-row.inbound .msg-box {
    background: #ffffff;
    border-top-left-radius: 2px;
    color: #0f172a;
}

.msg-row.outbound .msg-box {
    background: #d9fdd3;
    border-top-right-radius: 2px;
    color: #0f172a;
}

.msg-meta-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 4px;
}

/* Template Search Drawer / Picker */
.template-picker-panel {
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
}

.template-pick-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.15s ease;
}

.template-pick-item:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

.template-item-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-item-snippet {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 480px;
}

.expired-window-footer {
    padding: 14px 20px;
    background: #ffffff;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #64748b;
}

.expired-window-link {
    color: #059669;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.expired-window-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Template Live Preview Phone Mockup
   ========================================================================== */
.template-builder-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 32px;
}

.phone-mockup {
    background: #111827;
    border: 8px solid #374151;
    border-radius: 36px;
    padding: 16px;
    width: 320px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.phone-screen {
    background: #efeae2;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    border-radius: 24px;
    min-height: 480px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.preview-bubble {
    background: white;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preview-header {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.preview-body {
    font-size: 0.88rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.preview-footer {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 8px;
}

/* ==========================================================================
   Bottom Concierge / WhatsApp Support Banner
   ========================================================================== */
.support-concierge-bar {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    margin-top: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.support-concierge-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.support-concierge-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.support-concierge-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
}

.support-concierge-sub {
    font-size: 0.8rem;
    color: #64748b;
}

.btn-whatsapp-dark {
    background: #0f172a;
    color: #ffffff;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-whatsapp-dark:hover {
    background: #1e293b;
    color: #34d399;
    transform: translateY(-1px);
}

@media (max-width: 1200px) {
    .kpi-stats-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .quick-actions-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
    .kpi-stats-grid { grid-template-columns: 1fr !important; }
    .quick-actions-grid { grid-template-columns: 1fr !important; }
    .dashboard-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
    .support-concierge-bar { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ==========================================================================
   Modern Shimmer Skeleton Loading Screens System
   Ultra-smooth linear wave gradients for UI components & page loading
   ========================================================================== */

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

.skeleton,
.skeleton-box,
.skeleton-circle,
.skeleton-line,
.skeleton-avatar,
.skeleton-pill,
.skeleton-btn {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
    border-radius: 6px;
    display: inline-block;
    position: relative;
    overflow: hidden;
    user-select: none;
    pointer-events: none;
}

.skeleton-circle,
.skeleton-avatar {
    border-radius: 50% !important;
    flex-shrink: 0;
}

.skeleton-line {
    height: 12px;
    margin-bottom: 6px;
    border-radius: 4px;
}

.skeleton-line.w-full { width: 100%; }
.skeleton-line.w-3-4 { width: 75%; }
.skeleton-line.w-1-2 { width: 50%; }
.skeleton-line.w-1-3 { width: 33%; }
.skeleton-line.w-1-4 { width: 25%; }
.skeleton-line.w-16 { width: 64px; }
.skeleton-line.w-24 { width: 96px; }
.skeleton-line.w-32 { width: 128px; }

.skeleton-line.h-sm { height: 8px; }
.skeleton-line.h-md { height: 14px; }
.skeleton-line.h-lg { height: 20px; }
.skeleton-line.h-xl { height: 28px; }

/* 1. Skeleton KPI Card (Dashboard, Campaigns, Reports) */
.skeleton-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.skeleton-kpi-card .skeleton-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

/* 2. Skeleton Table Rows (Contacts, Campaigns, Reports, Ledger) */
.skeleton-table-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    gap: 16px;
}

/* 3. Skeleton 2-Way Inbox Contact Thread (Sidebar) */
.skeleton-thread-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #f8fafc;
    background: #ffffff;
}

/* 4. Skeleton Chat Message Bubbles (WhatsApp Live Stream) */
.skeleton-chat-bubble-row {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 8px !important;
}

.skeleton-chat-bubble-row.inbound {
    justify-content: flex-start !important;
}

.skeleton-chat-bubble-row.outbound {
    justify-content: flex-end !important;
}

.skeleton-chat-card {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 60%;
    min-width: 160px;
}

.skeleton-chat-bubble-row.inbound .skeleton-chat-card {
    background: #ffffff;
    border: 1px solid #f0f2f5;
    border-bottom-left-radius: 2px;
}

.skeleton-chat-bubble-row.outbound .skeleton-chat-card {
    background: #ecfdf5;
    border: 1px solid #d1fae5;
    border-bottom-right-radius: 2px;
}

/* 5. Skeleton Template Grid Card */
.skeleton-template-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Smooth Page & Content Transitions */
.content-fade-in {
    animation: contentFadeIn 0.25s ease forwards;
}

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

