/* 
 * CCMS - Call Center Management System Stylesheet
 * 
 * TABLE OF CONTENTS
 * 1.  CSS Variables (:root)
 * 2.  Animations
 * 3.  Base & Resets
 * 4.  Layout & Shell
 * 5.  Sidebar Navigation
 * 6.  Mobile Layout
 * 7.  Typography & Utilities
 * 8.  Components (Buttons, Forms, Badges)
 * 9.  Cards & Glassmorphism
 * 10. Dashboard
 * 11. Call Lists
 * 12. Contacts & Data Tables
 * 13. Dialer Interface
 * 14. Timeline
 * 15. Reports
 * 16. Upload & Generic
 * 17. Pagination
 */

/* ==========================================================================
   1. CSS Variables
   ========================================================================== */
:root {
    /* Color Palette */
    --c-primary: #6366f1;
    --c-primary-hover: #4f46e5;
    --c-primary-light: #e0e7ff;
    --c-primary-rgb: 99, 102, 241;
    
    --c-secondary: #8b5cf6;
    --c-secondary-hover: #7c3aed;
    --c-secondary-light: #ede9fe;
    --c-secondary-rgb: 139, 92, 246;

    --c-success: #10b981;
    --c-success-hover: #059669;
    --c-success-light: #d1fae5;
    --c-success-rgb: 16, 185, 129;

    --c-warning: #f59e0b;
    --c-warning-hover: #d97706;
    --c-warning-light: #fef3c7;
    --c-warning-rgb: 245, 158, 11;

    --c-danger: #ef4444;
    --c-danger-hover: #dc2626;
    --c-danger-light: #fee2e2;
    --c-danger-rgb: 239, 68, 68;

    --c-info: #0ea5e9;
    --c-info-hover: #0284c7;
    --c-info-light: #e0f2fe;

    --c-gray-50: #f8fafc;
    --c-gray-100: #f1f5f9;
    --c-gray-200: #e2e8f0;
    --c-gray-300: #cbd5e1;
    --c-gray-400: #94a3b8;
    --c-gray-500: #64748b;
    --c-gray-600: #475569;
    --c-gray-700: #334155;
    --c-gray-800: #1e293b;
    --c-gray-900: #0f172a;

    /* Theme Variables */
    --app-bg: var(--c-gray-50);
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.7);
    --border: var(--c-gray-200);
    --text: var(--c-gray-800);
    --muted: var(--c-gray-500);

    /* Sidebar Variables */
    --sidebar-bg-start: var(--c-gray-900);
    --sidebar-bg-end: var(--c-gray-800);
    --sidebar-text: var(--c-gray-300);
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.1);
    
    /* Layout & Sizes */
    --sidebar-width: 228px;
    --header-height: 64px;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-pill: 9999px;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. Animations
   ========================================================================== */
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseLive {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(var(--c-danger-rgb), 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(var(--c-danger-rgb), 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(var(--c-danger-rgb), 0); }
}

@keyframes progressLoad {
    from { width: 0; }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* ==========================================================================
   3. Base & Resets
   ========================================================================== */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--app-bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body > .container-fluid,
body > .container {
    animation: pageFadeIn var(--transition-slow) forwards;
}

footer {
    display: none !important;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--c-gray-100); }
::-webkit-scrollbar-thumb { background: var(--c-gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-gray-400); }

/* ==========================================================================
   4. Layout & Shell
   ========================================================================== */
.content-shell {
    min-height: 100vh;
    padding-bottom: 3rem !important;
    min-width: 0;
    overflow-x: hidden;
}

/* Admin/User specific visibility */
.admin-only,
.user-only {
    display: initial;
}

/* Modals */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.modal-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}
.modal-footer {
    background: var(--c-gray-50);
    border-top: 1px solid var(--border);
}

/* ==========================================================================
   5. Sidebar Navigation
   ========================================================================== */
.sidebar {
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    min-height: 100vh;
    color: var(--sidebar-text);
    position: relative;
    z-index: 10;
    transition: all var(--transition-base);
}

.sidebar-desktop {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Glass effect on sidebar overlay */
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: -1;
    pointer-events: none;
}

.sidebar-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-top {
    flex: 1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 1rem;
    color: #fff;
    font-size: 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

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

.brand-text {
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #fff, var(--c-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 0.75rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.68rem 0.8rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-base);
    position: relative;
}

.menu-link i {
    font-size: 1.1rem;
    opacity: 0.8;
    transition: all var(--transition-base);
}

.menu-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
    transform: translateX(4px);
}

.menu-link:hover i {
    opacity: 1;
    transform: scale(1.1);
}

.menu-link.active {
    background: rgba(var(--c-primary-rgb), 0.15);
    color: var(--sidebar-text-active);
    font-weight: 700;
}

.menu-link.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: var(--c-primary);
    border-radius: 0 4px 4px 0;
}

.menu-link.active i {
    color: var(--c-primary-light);
    opacity: 1;
}

/* Sidebar User Bottom */
.sidebar-user-card {
    padding: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
    position: relative;
}

.sidebar-bottom-user {
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-user-summary {
    display: flex;
    align-items: center;
    cursor: pointer;
    list-style: none;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.sidebar-user-summary::-webkit-details-marker {
    display: none;
}

.sidebar-user-summary:hover {
    background: var(--sidebar-hover-bg);
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sidebar-user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.sidebar-user-meta {
    color: var(--sidebar-text);
    font-size: 0.7rem;
    margin-top: 0.15rem;
}

.sidebar-user-dropdown-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-user-dropdown-arrow i {
    transition: transform var(--transition-base);
    display: block;
}

.sidebar-user-card[open] .sidebar-user-dropdown-arrow i {
    transform: rotate(180deg);
}

.sidebar-user-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    color: var(--c-danger-light);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    background: rgba(var(--c-danger-rgb), 0.1);
    transition: all var(--transition-base);
}

.sidebar-user-logout:hover {
    background: rgba(var(--c-danger-rgb), 0.2);
    color: #fff;
}

/* ==========================================================================
   6. Mobile Layout
   ========================================================================== */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    height: 48px;
    padding: 0 0.75rem;
    background: var(--surface);
    margin: 0;
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: var(--c-gray-900);
    border: none;
    border-radius: var(--radius-md);
}

.mobile-topbar-title {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-sidebar {
    width: 280px !important;
}

@media (max-width: 991.98px) {
    .sidebar-desktop {
        display: none !important;
    }
    .mobile-topbar {
        display: flex;
    }
    body {
        padding-top: 48px;
    }
    .content-shell {
        padding: 1rem !important;
    }
}

@media (min-width: 992px) {
    .sidebar-desktop {
        flex: 0 0 var(--sidebar-width);
        max-width: var(--sidebar-width);
    }

    .content-shell {
        flex: 0 0 calc(100% - var(--sidebar-width));
        height: 100vh;
        margin-left: var(--sidebar-width);
        max-width: calc(100% - var(--sidebar-width));
        overflow-y: auto;
    }
}

/* ==========================================================================
   7. Typography & Utilities
   ========================================================================== */
.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

/* Flash Toast */
.flash-toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1050;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight var(--transition-base) forwards;
    border-radius: var(--radius-md);
    border: none;
}

.flash-toast .alert {
    margin: 0;
    border: none;
}

/* ==========================================================================
   8. Components (Forms, Inputs, Buttons)
   ========================================================================== */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border-color: var(--border);
    padding: 0.6rem 0.75rem;
    transition: all var(--transition-base);
}

.form-control:focus, .form-select:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--c-primary-rgb), 0.25);
}

.btn {
    border-radius: var(--radius-md);
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    transition: all var(--transition-base);
}

.btn-primary {
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    border: none;
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--c-primary-hover), var(--c-secondary-hover));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--c-primary-rgb), 0.3);
}

/* Readonly fields */
.readonly-field {
    background-color: var(--c-gray-100);
    opacity: 0.8;
}

/* Progress Bars */
.progress {
    border-radius: var(--radius-pill);
    background-color: var(--c-gray-200);
    overflow: hidden;
}
.progress-bar {
    background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
    transition: width 1s ease-in-out;
}

/* Sticky Headers */
.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}
.table-responsive thead th {
    position: sticky;
    top: 0;
    background: var(--surface) !important;
    z-index: 2;
    box-shadow: inset 0 -1px 0 var(--border);
}

/* ==========================================================================
   9. Cards & Glassmorphism
   ========================================================================== */
.card, .calllist-card, .chart-card, .contact-detail-card, .contact-response-card, .upload-card {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
    transition: all var(--transition-base);
}

.card:hover, .calllist-card:hover, .chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

/* ==========================================================================
   10. Dashboard
   ========================================================================== */
.card-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 0.7rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: 1px solid var(--border);
    border-left: 3px solid var(--stat-color, var(--c-primary));
    border-radius: var(--radius-md);
    text-align: left;
}

.card-stat::before {
    display: none;
}

.card-stat:hover::before {
    display: none;
}

.card-stat-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.card-stat-label {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0;
    text-transform: uppercase;
}

.card-stat-label::after {
    display: none;
}

.card-stat-icon {
    width: auto;
    height: auto;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1.25rem;
    line-height: 1;
    background: transparent;
    border: none;
    color: var(--stat-color, var(--c-primary)) !important;
    margin-bottom: 0;
    margin-left: 0.75rem;
    opacity: 0.45;
    align-self: center;
}

.card-stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: var(--stat-bg, rgba(var(--c-primary-rgb), 0.1));
    color: var(--stat-color, var(--c-primary));
}

.card-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0;
    margin-top: 0.2rem;
    color: var(--text);
}

.dashboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.6rem;
    position: relative;
}

.dashboard-head::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 3px;
    left: 0;
    bottom: -0.55rem;
    border-radius: var(--radius-pill);
    background: var(--c-primary);
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.6rem;
}

.dashboard-stat-col {
    padding: 0.5rem;
}

.chart-wrap {
    padding: 1.5rem;
    min-height: 320px;
}

/* Stat colors */
.dashboard-stat-call { --stat-bg: var(--c-primary-light); --stat-color: var(--c-primary); }
.dashboard-stat-whatsapp { --stat-bg: var(--c-success-light); --stat-color: var(--c-success); }
.dashboard-stat-interested { --stat-bg: var(--c-info-light); --stat-color: var(--c-info); }
.dashboard-stat-followup { --stat-bg: var(--c-secondary-light); --stat-color: var(--c-secondary); }
.dashboard-stat-overdue { --stat-bg: var(--c-danger-light); --stat-color: var(--c-danger); }

/* Dashboard Contacts Card */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.dashboard-stat-card {
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    color: #fff;
    text-align: center;
    text-decoration: none;
    transition: transform var(--transition-base);
}

.dashboard-stat-card:hover {
    transform: translateY(-3px);
}

.dashboard-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 0.3rem;
}

.dashboard-stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.dashboard-stat-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.dashboard-stat-action {
    margin-top: 0.35rem;
}

.dashboard-stat-call-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 0.25rem 0.45rem;
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-decoration: none;
    transition: background var(--transition-base);
}
.dashboard-stat-call-btn:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
    text-decoration: none;
}

.stat-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.stat-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-gray { background: linear-gradient(135deg, #64748b, #475569); }

/* ==========================================================================
   11. Call Lists
   ========================================================================== */
.calllist-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.calllist-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.calllist-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.calllist-card-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--c-success-light);
    color: var(--c-success-hover);
    font-weight: 700;
}

.calllist-card-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--c-gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.calllist-metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
}

.calllist-metric-label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.calllist-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.calllist-card-actions .btn {
    flex: 1;
}

/* ==========================================================================
   12. Contacts & Data Tables
   ========================================================================== */
.compact-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 700;
    padding: 0.7rem 0.75rem;
    border-bottom: 2px solid var(--border);
}

.compact-table td {
    padding: 0.7rem 0.75rem;
    vertical-align: middle;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.contact-row-overdue td {
    background-color: var(--c-warning-light) !important;
}

.contact-row-actions {
    display: flex;
    gap: 0.5rem;
}

.contact-dialer-btn {
    padding: 0.22rem 0.45rem;
    min-width: 0;
    line-height: 1;
    border-radius: var(--radius-sm);
}

.contact-dialer-btn i {
    font-size: 0.82rem;
}

/* Badges */
.category-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    display: inline-block;
    width: fit-content;
}
.category-badge-new { background: var(--c-info); }
.category-badge-followup { background: var(--c-secondary); }
.category-badge-retry { background: var(--c-warning); }
.category-badge-converted { background: var(--c-success); }
.category-badge-closed { background: var(--c-gray-500); }

.contact-response-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.contact-response-muted {
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1.15;
    width: fit-content;
}

.contact-source-text {
    font-size: 0.85rem;
    color: var(--muted);
}

.lead-stats-stack {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.lead-score-line {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.lead-attempts-line {
    font-size: 0.72rem;
    color: var(--muted);
}

.score-negative { color: var(--c-danger); }
.summary-count { font-weight: 700; color: inherit; }

.contact-summary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: var(--c-gray-100);
    border: none;
    padding: 0.18rem 0.4rem;
    border-radius: var(--radius-md);
    color: var(--c-gray-700);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
}
.contact-summary-link:hover {
    background: var(--c-primary-light);
    color: var(--c-primary-hover);
    text-decoration: none;
}
.lead-stats-log-btn {
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

/* ==========================================================================
   13. Dialer Interface
   ========================================================================== */
.contact-page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.contact-two-col-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.contact-two-col-row > div {
    flex: 1;
    min-width: 320px;
}

.contact-detail-card, .contact-response-card {
    padding: 0.75rem;
    height: 100%;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
}

.contact-detail-card:hover, .contact-response-card:hover {
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

.contact-summary {
    margin-bottom: 0.75rem;
}

.contact-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.contact-summary-phone {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

.contact-summary-person {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
}

.contact-summary-score {
    text-align: right;
}

.contact-score-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--c-primary);
}

.contact-score-attempts {
    font-size: 0.75rem;
    color: var(--muted);
}

.contact-detail-panel {
    display: grid;
    gap: 0.65rem;
}

.contact-detail-label {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
}

.contact-actions {
    display: flex;
    gap: 0.65rem;
    margin-top: 0.85rem;
}

.btn-call {
    flex: 1;
    background: var(--c-primary);
    color: #fff;
    font-size: 0.95rem;
    padding: 0.55rem 0.75rem;
}
.btn-call:hover { background: var(--c-primary-hover); color: #fff; }

.btn-wa {
    background: var(--c-success);
    color: #fff;
    padding: 0.55rem 0.75rem;
    width: auto;
}
.btn-wa:hover { background: var(--c-success-hover); color: #fff; }

.call-result-text {
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
    margin-top: 0.5rem;
}

.dialer-info-section {
    display: flex;
    gap: 0.65rem;
    padding: 0.7rem;
    background: var(--c-gray-50);
    border-radius: var(--radius-md);
}

.dialer-info-icon {
    font-size: 1.25rem;
    color: var(--c-primary);
}

.dialer-info-content {
    flex: 1;
}

.dialer-info-title {
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.dialer-info-line { margin-bottom: 0; }
.dialer-info-primary { font-weight: 600; }
.dialer-info-category { color: var(--c-secondary); font-weight: 700; }
.dialer-info-meta { font-size: 0.85rem; color: var(--muted); }
.dialer-info-followup { color: var(--c-warning-hover); font-weight: 600; }

.dialer-followup-countdown {
    padding: 0.18rem 0.4rem;
    background: var(--c-warning-light);
    color: var(--c-warning-hover);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
}
.dialer-followup-countdown.is-overdue {
    background: var(--c-danger-light);
    color: var(--c-danger);
}

/* Dialer Modal / Active Call */
.dialer-modal-content {
    background: var(--surface);
    text-align: center;
    padding: 2rem;
}

.dialer-status {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 1rem;
}

.call-live-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--c-danger);
    margin-right: 0.5rem;
    animation: pulseLive 1.5s infinite;
}

.dialer-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.dialer-name {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.dialer-duration-label { font-size: 0.9rem; color: var(--muted); }
.dialer-duration {
    font-size: 2.5rem;
    font-family: monospace;
    font-weight: 700;
    color: var(--c-primary);
    margin-bottom: 2rem;
}

.dialer-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Responses */
.response-field { margin-bottom: 1.5rem; }
.response-button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.response-button-grid-2col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.response-option {
    background: var(--c-gray-50);
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text);
}

.response-card-inactive {
    opacity: 0.55;
    pointer-events: none;
    filter: grayscale(0.15);
}
.response-option:hover {
    background: var(--c-primary-light);
    border-color: var(--c-primary);
}
.response-option.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
    box-shadow: var(--shadow-md);
}

.selected-callback { margin-top: 1rem; padding: 1rem; background: var(--c-info-light); border-radius: var(--radius-md); }
.selected-callback-value { font-weight: 700; color: var(--c-info-hover); }

.remarks-field { margin-bottom: 1.5rem; }
.remarks-textarea { min-height: 100px; resize: vertical; }

.contact-form-actions { text-align: right; margin-top: 2rem; }
.btn-response-submit {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    box-shadow: 0 10px 22px rgba(var(--c-primary-rgb), 0.22);
}
.btn-response-submit:hover,
.btn-response-submit:focus {
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary-hover), var(--c-secondary-hover));
    box-shadow: 0 12px 26px rgba(var(--c-primary-rgb), 0.28);
}

/* Callback Modal */
.callback-modal .modal-content { padding: 1.5rem; }
.modal-callback-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.modal-callback-option {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-base);
}
.modal-callback-option:hover { background: var(--c-gray-100); }
.modal-callback-option.active {
    background: var(--c-secondary);
    color: #fff;
    border-color: var(--c-secondary);
}
.callback-preview { margin-top: 1rem; font-weight: 700; text-align: center; color: var(--c-primary); }

/* WhatsApp Modal */
.whatsapp-modal-dialog { max-width: 600px; }
.whatsapp-modal-content { border-radius: var(--radius-lg); }
.whatsapp-modal-header { background: var(--c-success); color: #fff; }
.whatsapp-modal-header .btn-close { filter: invert(1); }
.whatsapp-modal-body { padding: 1.5rem; }
.whatsapp-modal-footer { padding: 1rem 1.5rem; }
.whatsapp-templates-wrap { margin-bottom: 1.5rem; }
.whatsapp-template-list { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem; }
.whatsapp-template-option {
    flex: 0 0 auto;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    cursor: pointer;
}
.whatsapp-template-option.active { background: var(--c-success-light); border-color: var(--c-success); color: var(--c-success-hover); font-weight: 700; }

.contact-progress-summary { margin-bottom: 1.5rem; }
.contact-progress-meta { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.5rem; font-weight: 600;}
.contact-progress-track { height: 8px; background: var(--c-gray-200); border-radius: var(--radius-pill); overflow: hidden;}
.contact-progress-fill { height: 100%; background: var(--c-primary); transition: width 0.5s ease; }

.dialer-empty-shell { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.dialer-empty-card { background: var(--surface); padding: 3rem; border-radius: var(--radius-xl); text-align: center; box-shadow: var(--shadow-lg); max-width: 400px; }
.dialer-empty-icon { font-size: 4rem; color: var(--c-success); margin-bottom: 1rem; }
.dialer-empty-copy { font-size: 1.1rem; color: var(--muted); margin-bottom: 2rem; }
.dialer-empty-actions { display: flex; justify-content: center; gap: 1rem; }

.date-part { font-weight: 600; }
.time-part { color: var(--muted); font-size: 0.9em; }

/* ==========================================================================
   14. Timeline
   ========================================================================== */
.timeline-wrap {
    padding: 1rem;
}

.timeline-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.timeline-filter-btn {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all var(--transition-base);
}

.timeline-filter-btn:hover {
    background: var(--c-gray-100);
}

.timeline-filter-btn.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

.timeline-entry {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1.5rem;
}

.timeline-entry::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 24px;
    bottom: -1.5rem;
    width: 2px;
    background: var(--border);
}

.timeline-entry:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--c-gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #fff;
    z-index: 1;
}

.timeline-dot-response { background: var(--c-primary); }
.timeline-dot-call { background: var(--c-warning); }
.timeline-dot-whatsapp { background: var(--c-success); }

.timeline-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.timeline-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.timeline-pill {
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--c-gray-100);
    color: var(--text);
}

.timeline-empty {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
    font-style: italic;
}

/* ==========================================================================
   15. Reports (New elements)
   ========================================================================== */
.report-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.report-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.75rem;
    padding: 0.75rem;
}

.report-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: end;
}

.report-filter-form .form-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.report-filter-actions {
    display: flex;
    gap: 0.4rem;
    min-width: 0;
}

.log-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(120px, 0.7fr) minmax(150px, 0.9fr) minmax(180px, 1.2fr) auto;
    gap: 0.6rem;
    align-items: end;
}

.log-filter-form .form-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.report-period-control {
    position: relative;
}

.report-period-toggle {
    align-items: center;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    border: 1px solid var(--c-primary);
    border-radius: var(--radius-md);
    color: #fff;
    display: flex;
    gap: 0.45rem;
    height: 34px;
    padding: 0 0.75rem;
    width: 100%;
}

.report-period-toggle:hover,
.report-period-toggle:focus {
    background: linear-gradient(135deg, var(--c-primary-hover), var(--c-secondary-hover));
    color: #fff;
}

.report-period-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: min(280px, calc(100vw - 2rem));
    padding: 0.6rem;
}

.report-period-menu-title {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.report-period-option {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text);
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.45rem 0.55rem;
    text-align: left;
    width: 100%;
}

.report-period-option:hover,
.report-period-option.active {
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    color: #fff;
}

.report-period-custom {
    border-top: 1px solid var(--border);
    margin-top: 0.45rem;
    padding-top: 0.45rem;
}

.report-period-custom-fields {
    padding: 0.55rem 0.15rem 0;
}

.report-period-custom-fields .form-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    margin: 0.4rem 0 0.25rem;
    text-transform: uppercase;
}

.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.report-summary-card {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    min-height: 74px;
    padding: 0.7rem;
}

.report-summary-card > i {
    font-size: 1.25rem;
    opacity: 0.45;
}

.report-summary-primary { border-left-color: var(--c-primary); }
.report-summary-success { border-left-color: var(--c-success); }
.report-summary-info { border-left-color: var(--c-info); }
.report-summary-warning { border-left-color: var(--c-warning); }
.report-summary-danger { border-left-color: var(--c-danger); }
.report-summary-primary > i { color: var(--c-primary); }
.report-summary-success > i { color: var(--c-success); }
.report-summary-info > i { color: var(--c-info); }
.report-summary-warning > i { color: var(--c-warning); }
.report-summary-danger > i { color: var(--c-danger); }

.report-table,
.report-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    max-width: 100%;
}

.report-card-head {
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 800;
    padding: 0.55rem 0.75rem;
}

.report-chart-body {
    padding: 0.75rem;
}

.report-chart-wrap {
    height: 220px;
    position: relative;
    width: 100%;
}

.report-side-panel {
    width: min(420px, 100vw) !important;
}

.report-chart-panel {
    width: min(760px, 100vw) !important;
}

.report-side-panel .offcanvas-header {
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1rem;
}

.report-side-panel .offcanvas-title {
    font-size: 1rem;
    font-weight: 800;
}

.report-side-panel .offcanvas-body {
    background: var(--c-gray-50);
    padding: 0.75rem;
}

.report-side-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem;
}

.report-chart-panel .report-chart-card + .report-chart-card {
    margin-top: 0.75rem;
}

.report-metric {
    display: flex;
    flex-direction: column;
}

.report-metric-value {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 0.2rem;
}

.report-metric-label {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.report-performance-table th,
.report-performance-table td {
    padding: 0.55rem 0.65rem;
    white-space: nowrap;
}

.report-table .table-responsive {
    max-height: none;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.report-performance-table {
    min-width: 900px;
}

.report-export-btn {
    padding: 0.18rem 0.42rem;
    line-height: 1;
}

.report-export-btn i {
    font-size: 0.9rem;
}

.report-agent-name {
    font-weight: 700;
    color: var(--c-primary);
}

.report-trend-up {
    color: var(--c-success);
    font-size: 0.85rem;
}
.report-trend-down {
    color: var(--c-danger);
    font-size: 0.85rem;
}

/* ==========================================================================
   16. Upload & Generic
   ========================================================================== */
.upload-card {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
}

/* ==========================================================================
   17. Pagination
   ========================================================================== */
.pagination-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}
.pagination-wrap .pagination {
    margin: 0;
}
.pagination-wrap .page-link {
    border: none;
    color: var(--text);
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin: 0 0.2rem;
    transition: all var(--transition-base);
}
.pagination-wrap .page-item.active .page-link {
    background-color: var(--c-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.pagination-wrap .page-link:hover:not(.active) {
    background-color: var(--c-gray-100);
}

@media (max-width: 575.98px) {
    .contact-two-col-row { flex-direction: column; }
    .contact-two-col-row > div { min-width: 100%; }
    .dashboard-kpi-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-stats { grid-template-columns: 1fr 1fr; }
    .calllist-card-grid { grid-template-columns: 1fr; }
    .report-filter-form { grid-template-columns: 1fr; }
    .log-filter-form { grid-template-columns: 1fr; }
    .report-filter-actions { flex-wrap: wrap; }
    .report-filter-actions .btn-primary,
    .report-filter-actions .btn-outline-primary { flex: 1 1 calc(50% - 0.25rem); }
    .report-filter-actions .btn-outline-secondary { flex: 0 0 auto; }
    .report-summary-cards { grid-template-columns: 1fr 1fr; }
    .report-summary-card { min-height: 66px; padding: 0.6rem; }
    .report-metric-value { font-size: 1.1rem; }
    .report-chart-wrap { height: 190px; }
    .report-performance-table { min-width: 780px; }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .report-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .log-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-filter-actions { grid-column: span 2; }
    .report-filter-actions .btn-primary { flex: 1; }
    .report-summary-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 992px) and (max-width: 1399.98px) {
    .report-summary-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
    .dashboard-kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--c-gray-200) 25%, var(--c-gray-100) 50%, var(--c-gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
