
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7fb;
    font-family: Arial, Helvetica, sans-serif;
    color: #1f2937;
}

/* =========================================
   SIDEBAR
========================================= */

.crm-sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: #111827;
    color: #fff;
    z-index: 1040;
    overflow-y: auto;
}

.crm-logo {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.crm-logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 18px;
}

.crm-logo strong {
    font-size: 18px;
}

.crm-nav {
    padding: 18px 12px;
}

.crm-nav-title {
    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 15px 10px 8px;
}

.crm-nav a {
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 14px;
}

.crm-nav a:hover,
.crm-nav a.active {
    background: #1e40af;
    color: #fff;
}

.crm-nav a i {
    width: 20px;
    font-size: 16px;
}

/* =========================================
   MAIN
========================================= */

.crm-main {
    margin-left: 250px;
    min-height: 100vh;
}

/* =========================================
   TOP HEADER
========================================= */

.crm-topbar {
    height: 72px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.crm-page-title h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.crm-page-title span {
    font-size: 12px;
    color: #6b7280;
}

.crm-top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crm-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    position: relative;
}

.notification-dot {
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    right: 8px;
}

.crm-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-avatar {
    width: 40px;
    height: 40px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.crm-user-info strong {
    display: block;
    font-size: 13px;
}

.crm-user-info small {
    color: #6b7280;
}

/* =========================================
   CONTENT
========================================= */

.crm-content {
    padding: 25px;
}

/* =========================================
   STAT CARDS
========================================= */

.crm-stat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    height: 100%;
}

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

.crm-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
}

.stat-blue {
    background: #dbeafe;
    color: #2563eb;
}

.stat-green {
    background: #dcfce7;
    color: #16a34a;
}

.stat-orange {
    background: #ffedd5;
    color: #ea580c;
}

.stat-purple {
    background: #ede9fe;
    color: #7c3aed;
}

.crm-stat h3 {
    margin: 15px 0 3px;
    font-size: 27px;
    font-weight: 700;
}

.crm-stat p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

.stat-change {
    font-size: 12px;
    margin-top: 10px;
}

.up {
    color: #16a34a;
}

/* =========================================
   CARD
========================================= */

.crm-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.crm-card-header {
    padding: 17px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crm-card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.crm-card-body {
    padding: 20px;
}

/* =========================================
   LEAD PIPELINE
========================================= */

.pipeline {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.pipeline-box {
    min-width: 150px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 15px;
    background: #fff;
}

.pipeline-box small {
    color: #6b7280;
    display: block;
}

.pipeline-box strong {
    display: block;
    font-size: 23px;
    margin-top: 5px;
}

/* =========================================
   TABLE
========================================= */

.crm-table {
    margin: 0;
}

.crm-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.crm-table td {
    vertical-align: middle;
    font-size: 13px;
    white-space: nowrap;
}

.lead-name {
    font-weight: 600;
}

.lead-company {
    font-size: 11px;
    color: #6b7280;
}

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-fresh {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-interested {
    background: #dcfce7;
    color: #15803d;
}

.status-callback {
    background: #fef3c7;
    color: #b45309;
}

.status-cold {
    background: #f1f5f9;
    color: #475569;
}

.status-no {
    background: #fee2e2;
    color: #b91c1c;
}

/* =========================================
   ACTIVITY
========================================= */

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-text {
    font-size: 13px;
}

.activity-text small {
    display: block;
    color: #94a3b8;
    margin-top: 3px;
}

/* =========================================
   FILTERS
========================================= */

.filter-box {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-box .form-control,
.filter-box .form-select {
    min-height: 40px;
    font-size: 13px;
}

/* =========================================
   MOBILE BUTTON
========================================= */

.mobile-menu-btn {
    display: none;
}

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

@media (max-width: 991px) {

    .crm-sidebar {
        display: none;
    }

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

    .mobile-menu-btn {
        display: flex;
    }

    .crm-content {
        padding: 18px;
    }

    .crm-topbar {
        padding: 0 15px;
    }

    .crm-user-info {
        display: none;
    }
}

@media (max-width: 576px) {

    .crm-page-title h1 {
        font-size: 17px;
    }

    .crm-page-title span {
        display: none;
    }

    .crm-content {
        padding: 12px;
    }

    .crm-topbar {
        height: 64px;
    }

    .crm-stat {
        padding: 15px;
    }

    .crm-stat h3 {
        font-size: 23px;
    }

    .crm-card-header {
        padding: 14px;
    }

    .crm-card-body {
        padding: 14px;
    }

    .crm-top-actions {
        gap: 6px;
    }
}
    
/* =========================================
   EXTRA (new pages / call popup)
========================================= */
.status-contacted{background:#cffafe;color:#0e7490}
.status-converted{background:#ede9fe;color:#6d28d9}
.status-wrong{background:#f3f4f6;color:#6b7280}
a{text-decoration:none}
.crm-stat-link{display:block;color:inherit;height:100%}
.crm-stat-link:hover .crm-stat,.pipeline-box:hover{border-color:#2563eb;box-shadow:0 4px 14px rgba(37,99,235,.12)}
.crm-stat,.pipeline-box{transition:all .2s}
a.pipeline-box{color:inherit;display:block}
a.pipeline-box.active{border-color:#2563eb;background:#eff6ff}
.crm-table td{white-space:normal}
.crm-table td.nw,.crm-table th{white-space:nowrap}
.lead-name a{color:#1f2937}.lead-name a:hover{color:#2563eb}
.btn-call-pulse{box-shadow:0 0 0 0 rgba(22,163,74,.5)}
.outcome-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}
.outcome-grid input{display:none}
.outcome-grid label{border:2px solid #e5e7eb;border-radius:10px;padding:10px;cursor:pointer;font-size:13px;font-weight:600;display:flex;align-items:center;gap:8px;transition:all .15s;margin:0}
.outcome-grid label:hover{border-color:#93c5fd}
.outcome-grid input:checked+label{border-color:#2563eb;background:#eff6ff;color:#1d4ed8}
.timeline{position:relative;padding-left:22px}
.timeline:before{content:"";position:absolute;left:6px;top:4px;bottom:4px;width:2px;background:#e5e7eb}
.tl-item{position:relative;padding-bottom:16px}
.tl-item:before{content:"";position:absolute;left:-22px;top:4px;width:14px;height:14px;border-radius:50%;background:#2563eb;border:3px solid #dbeafe}
.mini-bar{height:8px;border-radius:6px;background:#e5e7eb;overflow:hidden}
.mini-bar span{display:block;height:100%;background:#2563eb}
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:#111827;padding:15px}
.login-card{width:100%;max-width:400px;background:#fff;border-radius:14px;padding:32px}
.notif-unread{background:#eff6ff}
.search-pop{position:absolute;right:0;top:48px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;padding:10px;width:280px;box-shadow:0 8px 24px rgba(0,0,0,.12);display:none;z-index:1100}
.search-pop.show{display:block}
.crm-nav .badge-count{margin-left:auto;background:#ef4444;color:#fff;border-radius:20px;font-size:10px;padding:2px 7px}
.table-hover tbody tr:hover{background:#f8fafc}
.empty-state{padding:40px 15px;text-align:center;color:#94a3b8}
.empty-state i{font-size:34px;display:block;margin-bottom:8px}
@media print{.crm-sidebar,.crm-topbar,.no-print{display:none!important}.crm-main{margin:0}}


/* Clickability safeguards: keep navigation above decorative layers. */
.crm-sidebar { z-index: 1045; pointer-events: auto; }
.crm-sidebar .crm-nav, .crm-sidebar .crm-nav a { pointer-events: auto; }
.crm-main, .crm-content { position: relative; }
.crm-nav a, .crm-stat-link, .pipeline-box { cursor: pointer; }
.offcanvas { z-index: 1060; }
.offcanvas-backdrop { z-index: 1055; }


/* Clear clickable feedback for dashboard cards and pipeline links */
.crm-stat-link {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 100%;
    border-radius: 12px;
}
.crm-stat-link .crm-stat,
.pipeline-box {
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.crm-stat-link:hover .crm-stat,
.pipeline-box:hover {
    transform: translateY(-2px);
    border-color: #93b4ff;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .10);
}
.crm-stat-link:focus-visible,
.pipeline-box:focus-visible,
.crm-nav a:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}
.crm-nav a { cursor: pointer; }

/* Owner panel: clear, high-contrast, human-designed dashboard */
.owner-theme .crm-content{font-size:16px}.owner-theme .crm-page-title h1{font-size:25px;font-weight:800}.owner-theme .crm-nav a{font-size:15px;min-height:46px}.owner-theme .crm-sidebar{background:#101b33}.owner-theme .crm-logo strong{font-size:18px}.staff-theme .crm-content{font-size:15px}
