:root {
    --primary: #635bff;
    --ink: #182230;
    --muted: #6b7280;
    --bg: #f6f7fb;
    --card: #fff
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 20% 10%, #e7e6ff, transparent 35%), var(--bg)
}

.login-card {
    background: #fff;
    padding: 42px;
    width: min(430px, 92vw);
    border-radius: 24px
}

.brand {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -.6px
}

.brand small {
    font-size: 11px;
    color: #8b91a1;
    font-weight: 700
}

.brand-dot {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--primary);
    margin-right: 7px;
    box-shadow: 0 0 0 5px #ecebff
}

.app-shell {
    display: flex;
    min-height: 100vh
}

.sidebar {
    width: 245px;
    background: #111827;
    color: #aeb7c7;
    padding: 24px 15px;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0
}

.sidebar .brand {
    color: #fff;
    padding: 0 12px 30px
}

.sidebar nav {
    display: grid;
    gap: 6px
}

.sidebar a {
    color: #aeb7c7;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: center
}

.sidebar a:hover,
.sidebar a.active {
    background: #252c3b;
    color: #fff
}

.sidebar-bottom {
    margin-top: auto
}

.main {
    margin-left: 245px;
    width: calc(100% - 245px)
}

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

.content {
    padding: 30px;
    max-width: 1700px
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px
}

.page-title h1 {
    font-size: 29px;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 5px 0
}

.page-title p {
    margin: 0;
    color: var(--muted)
}

.card,
.stat-card {
    background: var(--card);
    border: 1px solid #e9ebf0;
    border-radius: 16px;
    box-shadow: 0 3px 15px rgba(20, 30, 50, .03)
}

.stat-card {
    padding: 17px;
    min-height: 150px;
    transition: .25s
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(20, 30, 50, .08)
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    margin-bottom: 14px
}

.stat-icon.primary {
    background: #eeedff;
    color: #635bff
}

.stat-icon.info {
    background: #e8f7ff;
    color: #1592c4
}

.stat-icon.success {
    background: #e8f8ef;
    color: #169b57
}

.stat-icon.warning {
    background: #fff5dd;
    color: #c98300
}

.stat-icon.danger {
    background: #ffebee;
    color: #df304d
}

.stat-card span {
    font-size: 12px;
    color: var(--muted)
}

.stat-card h3 {
    font-weight: 800;
    margin: 5px 0;
    font-size: 23px
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ecebff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 700
}

.badge {
    padding: .48em .7em
}

.status-new {
    background: #eef1f5;
    color: #5d6675
}

.status-contacted {
    background: #eaf4ff;
    color: #2677c9
}

.status-qualified {
    background: #f0eaff;
    color: #7454d8
}

.status-proposal {
    background: #fff2d8;
    color: #ae7000
}

.status-negotiation {
    background: #e9f8ef;
    color: #188b50
}

.status-won {
    background: #dff8e9;
    color: #08783f
}

.status-lost {
    background: #ffe7ea;
    color: #c22d48
}

.priority-low {
    color: #7b8493
}

.priority-medium {
    color: #2677c9
}

.priority-high {
    color: #e08b00
}

.priority-urgent {
    color: #db3150
}

.table {
    --bs-table-bg: transparent
}

.table thead th {
    font-size: 11px;
    text-transform: uppercase;
    color: #8a92a1;
    letter-spacing: .5px;
    border-bottom: 1px solid #e9ebf0
}

.table td {
    border-color: #f0f1f4
}

.source-list {
    display: grid;
    gap: 9px;
    margin-top: 12px
}

.source-list div,
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f1f4
}

.pipeline {
    display: grid;
    grid-template-columns: repeat(7, minmax(220px, 1fr));
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px
}

.pipeline-col {
    min-height: 500px;
    background: #eef0f5;
    border-radius: 14px;
    padding: 12px
}

.pipeline-head {
    display: flex;
    justify-content: space-between
}

.pipeline-head span {
    background: #fff;
    border-radius: 8px;
    padding: 2px 7px;
    font-size: 12px
}

.pipeline-card {
    display: block;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    border-radius: 12px;
    padding: 13px;
    margin-top: 10px;
    border: 1px solid #e6e8ed;
    transition: .2s
}

.pipeline-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px #0001
}

.timeline-item {
    position: relative;
    padding: 0 0 20px 30px
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 3px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--primary)
}

.timeline-item:not(:last-child):after {
    content: "";
    position: absolute;
    left: 5px;
    top: 14px;
    width: 1px;
    height: calc(100% - 8px);
    background: #ddd
}

.form-control,
.form-select {
    border-color: #dfe3ea;
    border-radius: 9px
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary)
}

label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px
}

.login-card .form-control {
    background: #fafbfc
}

@media(max-width:1100px) {
    .pipeline {
        grid-template-columns: repeat(7, 240px)
    }
}

@media(max-width:991px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 30;
        transition: .25s
    }

    .sidebar.open {
        transform: none
    }

    .main {
        margin-left: 0;
        width: 100%
    }

    .content {
        padding: 20px
    }

    .topbar {
        padding: 0 20px
    }
}

.progress {
    background: #edf0f5;
    border-radius: 20px
}

.progress-bar {
    border-radius: 20px
}

.card {
    animation: fadeUp .35s ease both
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(5px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.btn {
    transition: transform .15s ease, box-shadow .15s ease
}

.btn:hover {
    transform: translateY(-1px)
}

.table tbody tr:hover {
    background: #fafbff
}

.dragging {
    opacity: .45
}

.global-search-wrap {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0 0 18px
}

.global-search {
    max-width: 620px;
    position: relative
}

.global-search>i {
    position: absolute;
    left: 15px;
    top: 13px;
    color: #8a91a1
}

.global-search input {
    width: 100%;
    border: 1px solid #e1e5ee;
    background: #fff;
    border-radius: 12px;
    padding: 11px 16px 11px 42px;
    box-shadow: 0 5px 18px rgba(40, 50, 80, .05);
    outline: none
}

.global-search input:focus {
    border-color: #6256f5;
    box-shadow: 0 0 0 3px rgba(98, 86, 245, .12)
}

.search-results {
    display: none;
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e4e7ef;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(25, 35, 60, .12);
    overflow: hidden
}

.search-results.show {
    display: block
}

.search-results a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #172033;
    border-bottom: 1px solid #f0f1f5
}

.search-results a:hover {
    background: #f7f7ff
}

.search-results small {
    display: block;
    color: #8a91a1;
    margin-top: 2px
}

.empty-search {
    padding: 15px;
    color: #8a91a1
}

.score-box {
    background: #f7f7ff;
    border: 1px solid #ecebff;
    padding: 14px;
    border-radius: 12px
}

.leads-table {
    min-width: 1180px
}

.leads-table th {
    white-space: nowrap;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #7c8495
}

.lead-id {
    font-weight: 700;
    color: #6b7280
}

.inline-form {
    margin: 0
}

.inline-form .form-select {
    min-width: 125px;
    font-size: .82rem
}

.leads-table td {
    font-size: .9rem
}

.stat-card {
    transition: transform .18s ease, box-shadow .18s ease
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(40, 50, 80, .08)
}

body:before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 88% 8%, rgba(99, 91, 255, .08), transparent 24%), radial-gradient(circle at 15% 92%, rgba(37, 181, 255, .05), transparent 25%);
    z-index: -1
}

.sidebar {
    background: linear-gradient(180deg, #101522 0%, #171d2c 100%);
    box-shadow: 10px 0 35px rgba(15, 20, 35, .08)
}

.sidebar .brand {
    font-size: 22px
}

.sidebar .brand small {
    display: block;
    margin: 4px 0 0 22px;
    color: #788298;
    letter-spacing: 1px
}

.sidebar nav {
    gap: 7px
}

.sidebar a {
    position: relative;
    transition: .2s
}

.sidebar a.active:before {
    content: "";
    position: absolute;
    left: -15px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: #7c73ff
}

.topbar {
    box-shadow: 0 5px 25px rgba(30, 40, 70, .04)
}

.content {
    padding-top: 28px
}

.page-title h1 {
    font-size: 31px
}

.card {
    box-shadow: 0 7px 25px rgba(25, 35, 60, .035);
    backdrop-filter: blur(2px)
}

.stat-card {
    position: relative;
    overflow: hidden
}

.stat-card:after {
    content: "";
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    right: -30px;
    top: -30px;
    background: rgba(99, 91, 255, .04)
}

.btn-primary {
    box-shadow: 0 7px 16px rgba(99, 91, 255, .18)
}

.table-responsive {
    border-radius: 12px
}

.modal-content {
    box-shadow: 0 25px 70px rgba(15, 20, 35, .18)
}

@media(max-width:991px) {
    .content {
        padding-top: 20px
    }

    .page-title {
        gap: 12px;
        align-items: flex-start
    }

    .page-title .btn {
        white-space: nowrap
    }
}

.chart-wrap {
    position: relative;
    width: 100%;
    min-height: 300px
}

.pie-chart-wrap {
    height: 320px
}

.pie-chart-wrap canvas {
    max-height: 320px
}

.notification-wrap {
    position: relative
}

.notification-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f6f5ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    text-decoration: none;
    position: relative;
    transition: .2s
}

.notification-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 18px rgba(99, 91, 255, .12)
}

.notification-count {
    position: absolute;
    right: -5px;
    top: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 20px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid #fff
}

.notification-count:not(.has-count) {
    background: #b9bec9
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink)
}

.user-chip strong,
.user-chip small {
    display: block
}

.user-chip strong {
    font-size: 13px
}

.user-chip small {
    font-size: 11px;
    color: var(--muted);
    margin-top: 1px
}

.avatar {
    overflow: hidden;
    flex: none
}

.avatar img,
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.profile-avatar-wrap {
    display: flex;
    justify-content: center
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    background: #ecebff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 42px;
    font-weight: 800;
    border: 5px solid #f4f3ff;
    box-shadow: 0 10px 30px rgba(40, 50, 80, .08)
}

.profile-avatar-fallback {
    margin: auto
}

.info-banner {
    background: #f8f8ff;
    border: 1px solid #e8e6ff;
    border-radius: 14px;
    padding: 13px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.info-banner>div {
    display: flex;
    align-items: center;
    gap: 12px
}

.info-banner i {
    color: var(--primary);
    font-size: 20px
}

.info-banner small {
    display: block;
    color: var(--muted);
    margin-top: 2px
}

.mini-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: #eeedff;
    padding: 7px 10px;
    border-radius: 9px
}

.mini-stat {
    border: 1px solid #e7e9f2;
    background: #fafbff;
    border-radius: 12px;
    padding: 10px 12px;
    height: 100%;
    min-width: 110px
}

.mini-stat span {
    display: block;
    font-size: .72rem;
    color: #7b8194;
    font-weight: 600
}

.mini-stat strong {
    display: block;
    font-size: 1.2rem;
    margin-top: 2px
}

.chat-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 620px
}

.chat-people {
    border-right: 1px solid #e9ebf0;
    background: #fff
}

.chat-people-list {
    max-height: 560px;
    overflow: auto
}

.chat-person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid #f0f1f4
}

.chat-person:hover,
.chat-person.active {
    background: #f6f5ff
}

.chat-person small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px
}

.chat-unread {
    background: #ef4444;
    color: #fff;
    border-radius: 20px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 800
}

.chat-window {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fafbff
}

.chat-head {
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e9ebf0
}

.chat-head strong {
    display: block
}

.chat-head small {
    color: var(--muted);
    font-size: 11px
}

.chat-messages {
    flex: 1;
    min-height: 480px;
    max-height: 560px;
    overflow: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.chat-row {
    display: flex;
    justify-content: flex-start
}

.chat-row.mine {
    justify-content: flex-end
}

.chat-bubble {
    max-width: min(72%, 620px);
    padding: 10px 13px;
    border-radius: 15px 15px 15px 4px;
    background: #fff;
    border: 1px solid #e5e7ee;
    box-shadow: 0 4px 12px rgba(30, 40, 70, .04);
    word-break: break-word
}

.chat-row.mine .chat-bubble {
    background: #635bff;
    color: #fff;
    border-color: #635bff;
    border-radius: 15px 15px 4px 15px
}

.chat-bubble small {
    display: block;
    font-size: 9px;
    margin-top: 5px;
    opacity: .65
}

.chat-compose {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: #fff;
    border-top: 1px solid #e9ebf0
}

.chat-compose textarea {
    resize: none
}

.chat-compose .btn {
    align-self: stretch;
    min-width: 90px
}

.chat-empty {
    color: #8a91a1;
    text-align: center;
    margin: auto;
    padding: 30px
}

.chat-empty.full {
    min-height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center
}

.chat-empty i {
    font-size: 40px;
    color: #635bff;
    margin-bottom: 10px
}

.chat-empty p {
    margin: 0
}

.notification-btn .notification-count:not(.has-count) {
    background: #b9bec9
}

.notification-btn .notification-count {
    display: grid
}

@media(max-width:800px) {
    .chat-layout {
        grid-template-columns: 1fr
    }

    .chat-people {
        border-right: 0;
        border-bottom: 1px solid #e9ebf0
    }

    .chat-people-list {
        max-height: 240px
    }

    .chat-messages {
        min-height: 400px
    }

    .chat-bubble {
        max-width: 85%
    }
}

/* Company logo + floating chat */
.sidebar .brand {
    padding-top: 2px
}

.company-logo {
    display: block;
    width: 100%;
    max-width: 210px;
    height: 58px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    padding: 5px 7px
}

.sidebar .brand small {
    display: block;
    margin: 5px 0 0 8px
}

.login-brand {
    text-align: center
}

.login-company-logo {
    display: block;
    width: 100%;
    max-width: 340px;
    height: 86px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    padding: 7px;
    margin: 0 auto 8px
}

.login-brand small {
    display: block;
    font-size: 11px;
    color: #8b91a1;
    font-weight: 700;
    letter-spacing: 1px
}

.floating-chat {
    position: fixed;
    right: 26px;
    bottom: 80px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    text-decoration: none;
    box-shadow: 0 12px 28px rgba(99, 91, 255, .32);
    z-index: 1000;
    transition: transform .2s ease, box-shadow .2s ease
}

.floating-chat:hover {
    color: #fff;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 16px 34px rgba(99, 91, 255, .4)
}

.floating-chat>i {
    font-size: 23px
}

.floating-chat-count {
    position: absolute;
    right: -3px;
    top: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 20px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid #fff
}

.floating-chat-count:not(.has-count) {
    background: #b9bec9
}

.floating-chat-label {
    position: absolute;
    right: 66px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    opacity: 0;
    pointer-events: none;
    background: #182230;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 9px;
    border-radius: 7px;
    white-space: nowrap;
    transition: .18s ease
}

.floating-chat:hover .floating-chat-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0)
}

@media(max-width:700px) {
    .floating-chat {
        right: 18px;
        bottom: 70px;
        width: 52px;
        height: 52px
    }

    .floating-chat-label {
        display: none
    }

    .company-logo {
        max-width: 195px
    }
}

.avatar-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 42px
}

.avatar-wrap .avatar {
    width: 42px;
    height: 42px
}

.presence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
    vertical-align: middle
}

.avatar-wrap .presence-dot {
    position: absolute;
    right: -1px;
    bottom: -1px
}

.presence-dot.online {
    background: #22c55e
}

.presence-dot.offline {
    background: #ef4444
}

.chat-head strong .presence-dot {
    width: 9px;
    height: 9px;
    margin-right: 7px;
    border-width: 1px
}

/* Presence is shown beside the employee name in Chat. */
.chat-person strong .presence-dot {
    width: 9px;
    height: 9px;
    margin-left: 5px;
    border-width: 1px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}

.chat-person strong {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-person .avatar-wrap .presence-dot {
    display: none;
}

/* v27: visible Chat presence indicators and dashboard performance chart */
.chat-person strong .presence-dot,
.chat-head strong .presence-dot {
    display: inline-block !important;
    width: 11px !important;
    height: 11px !important;
    min-width: 11px !important;
    min-height: 11px !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, .10) !important;
    vertical-align: middle !important
}

.presence-dot.online {
    background: #16a34a !important
}

.presence-dot.offline {
    background: #dc2626 !important
}

.presence-text.online-text {
    color: #16a34a !important;
    font-weight: 700
}

.presence-text.offline-text {
    color: #dc2626 !important;
    font-weight: 700
}

.chat-person strong {
    display: flex;
    align-items: center;
    gap: 7px
}

.chat-person .presence-dot {
    position: static !important;
    margin-left: 0 !important
}

.chat-head strong {
    display: flex !important;
    align-items: center !important;
    gap: 8px
}

.chat-head .presence-dot {
    margin: 0 !important
}

.performance-chart-wrap {
    height: 330px;
    position: relative
}

.performance-chart-wrap canvas {
    max-height: 100%
}