:root {
    --primary: #b00000;
    --primary-dark: #8f0000;
    --primary-soft: #fff2f2;
    --primary-line: #f2caca;
    --primary-rgb: 176,0,0;
    --bg: #f5f7fa;
    --panel: #fff;
    --text: #1c2430;
    --muted: #242424;
    --mutelight: #c6c6c6;
    --line: #e7ebf0;
    --green: #169b62;
    --orange: #d98a19;
    --blue: #2674c7;
    --danger: #d52b3b;
    --shadow: 0 10px 30px rgba(25,35,50,.07)
}

* {
    box-sizing: border-box
}

html,body {
    margin: 0;
    min-height: 100%;
    font-family: Inter,Arial,sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px
}

body {
    overflow-x: hidden
}

a {
    text-decoration: none;
    color: inherit
}

button,input,select,textarea {
    font: inherit
}

button {
    cursor: pointer
}

.app-shell {
    min-height: 100vh
}

.main {
    margin-left: 258px;
    padding-top: 88px;
    min-height: 100vh;
    transition: .25s
}

.content {
    padding: 15px;
    max-width: 1700px;
    margin: auto
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px
}

.page-head h2 {
    margin: 3px 0 5px;
    font-size: 28px;
    letter-spacing: -.4px
}

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

.eyebrow {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: var(--primary)
}

.head-actions {
    display: flex;
    gap: 10px
}

.btn {
    border: 0;
    border-radius: 9px;
    padding: 10px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    transition: .2s
}

.btn.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(var(--primary-rgb),.18)
}

.btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px)
}

.btn.secondary {
    background: #fff;
    color: #475569;
    border: 1px solid var(--line)
}

.btn.secondary:hover {
    border-color: var(--primary-line);
    color: var(--primary)
}

.btn.wide {
    width: 100%
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 20px;
    
}

.panel+.panel {
    margin-top: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px
}

.panel-head h3 {
    margin: 0;
    font-size: 17px
}

.panel-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px
}

.panel-head a {
    color: var(--primary);
    font-size: 14px;
    font-weight: 700
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5,1fr);
    gap: 16px;
    margin-bottom: 18px
}

.stats-grid.compact {
    grid-template-columns: repeat(5,1fr)
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-top: 3px solid var(--primary);
    border-radius: 14px;
    padding: 19px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
    min-height: 104px
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 20px;
    background: var(--primary-soft);
    color: var(--primary)
}

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

.stat-card strong {
    display: block;
    font-size: 25px;
    margin: 3px 0
}

.stat-card small {
    color: #272727;
    font-size: 14px
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px
}

.pipeline {
    display: grid;
    gap: 16px
}

.pipeline>div {
    display: grid;
    grid-template-columns: 95px 45px 1fr;
    align-items: center;
    gap: 10px
}

.pipeline span {
    font-size: 14px;
    color: #64748b
}

.pipeline strong {
    text-align: right
}

.pipeline i {
    height: 7px;
    background: #f0f2f5;
    border-radius: 20px;
    overflow: hidden
}

.pipeline i:before {
    content: '';
    display: block;
    height: 100%;
    width: var(--w,100%);
    background: var(--primary);
    border-radius: 20px
}

.mini-list {
    display: grid;
    gap: 10px
}

.mini-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border: 1px solid #edf0f4;
    border-radius: 10px
}

.mini-item>div:nth-child(2) {
    min-width: 0;
    flex: 1
}

.mini-item strong,.mini-item span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.mini-item span {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px
}

.date-pill {
    width: 42px;
    height: 46px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 9px;
    display: grid;
    place-items: center;
    align-content: center
}

.date-pill b {
    font-size: 17px
}

.date-pill small {
    font-size: 10px;
    text-transform: uppercase
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    background: #f2f4f7;
    color: #667085
}

.badge.new,.badge.scheduled,.badge.upcoming {
    background: #fff2df;
    color: #a76200
}

.badge.contacted {
    background: #eaf3ff;
    color: #2674c7
}

.badge.converted,.badge.completed,.badge.active {
    background: #eaf8f1;
    color: #137c4d
}

.badge.closed,.badge.cancelled,.badge.inactive {
    background: #fff0f1;
    color: #c4263b
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px
}

.search {
    position: relative;
    flex: 1;
    min-width: 240px
}

.search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa4b2;
    font-size: 14px
}

.search input {
    padding-left: 34px
}

.toolbar select,.toolbar input,.form-grid input,.form-grid select,.form-grid textarea {
    border: 1px solid #838383;
    border-radius: 8px;
    background: #fff;
    padding: 10px 11px;
    outline: none;
    color: #263242;
    width: 100%
}

.toolbar>select {
    width: auto;
    min-width: 145px
}

.toolbar input:focus,.toolbar select:focus,.form-grid input:focus,.form-grid select:focus,.form-grid textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.08)
}

.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 340px);
    min-height: 170px
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px
}

.table-wrap th {
    text-align: left;
    padding: 11px 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #8b96a5;
    background: #fafbfc;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1
}

.table-wrap td {
    padding: 13px 12px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
    vertical-align: middle
}

.table-wrap tbody tr:hover {
    background: #fffafa
}

.table-wrap td small {
    display: block;
    color: #8d97a5;
    margin-top: 3px;
    font-size: 14px
}

.actions {
    white-space: nowrap;
    text-align: right
}

.icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    color: #667085
}

.icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary-line)
}

.icon-btn.danger:hover {
    color: #d52b3b;
    border-color: #f2c4ca;
    background: #fff6f7
}

.empty {
    text-align: center!important;
    color: #98a2b3;
    padding: 40px!important
}

.person {
    display: flex;
    align-items: center;
    gap: 9px
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.48);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000
}

.modal.show {
    display: flex
}

.modal-card {
    width: min(700px,100%);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(15,23,42,.25)
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--line)
}

.modal-head h3 {
    margin: 3px 0 0;
    font-size: 20px
}

.modal form {
    padding: 20px
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px
}

.form-grid label {
    font-size: 13px;
    font-weight: 700;
    color: #475569
}

.form-grid label input,.form-grid label select,.form-grid label textarea {
    display: block;
    margin-top: 6px;
    font-weight: 400
}

.form-grid .full {
    grid-column: 1/-1
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #172033;
    color: #fff;
    padding: 12px 15px;
    border-radius: 9px;
    z-index: 99999
}

.toast.success {
    background: #137c4d
}

.toast.error {
    background: #b42318
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg,#fff,#fff3f3)
}

.login-wrap {
    width: min(430px,92%)
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px
}

.login-brand strong {
    display: block;
    font-size: 20px
}

.login-brand small {
    color: var(--muted)
}

.login-card {
    background: #fff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--primary);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 25px 70px rgba(25,35,50,.1)
}

.login-card h1 {
    margin: 6px 0;
    font-size: 28px
}

.login-card form {
    display: grid;
    gap: 15px;
    margin-top: 22px
}

.login-card label {
    font-size: 13px;
    font-weight: 700;
    color: #475569
}

.login-card input {
    display: block;
    width: 100%;
    margin-top: 6px;
    border: 1px solid #dfe4ea;
    border-radius: 9px;
    padding: 12px
}

.login-footer {
    text-align: center;
    color: #98a2b3;
    font-size: 13px;
    margin-top: 15px
}

.alert.error {
    padding: 10px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: #b42318;
    font-size: 14px
}

.muted {
    color: var(--muted)
}

.eyebrow {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1.2px;
    color: var(--primary)
}

@media(max-width: 1100px) {
    .stats-grid,.stats-grid.compact {
        grid-template-columns:repeat(2,1fr)
    }

    .grid-2 {
        grid-template-columns: 1fr
    }

    .main {
        margin-left: 90px
    }

    .sidebar {
        width: 78px
    }

    .brand-text,.sidebar .nav-link span,.sidebar .nav-chevron,.sidebar .user-mini-copy,.sidebar .logout-icon {
        display: none
    }

    .sidebar .nav-link {
        justify-content: center
    }

    .submenu {
        position: fixed;
        left: 84px;
        width: 180px;
        background: #fff;
        border: 1px solid var(--line);
        box-shadow: var(--shadow);
        border-radius: 10px;
        padding: 6px
    }

    .submenu.show {
        display: grid
    }

    .submenu-link {
        color: #64748b
    }
}

@media(max-width: 991px) {
    .sidebar {
        transform:translateX(-100%);
        width: 260px
    }

    .sidebar.mobile-open {
        transform: translateX(0)
    }

    .sidebar .brand-text,.sidebar .nav-link span,.sidebar .nav-chevron,.sidebar .user-mini-copy,.sidebar .logout-icon {
        display: block
    }

    .sidebar .nav-link {
        justify-content: flex-start
    }

    .main {
        margin-left: 0
    }

    .sidebar-overlay {
        display: block
    }

    .content {
        padding: 20px
    }

    .page-head {
        flex-direction: column
    }

    .topbar-search {
        max-width: none
    }

    .topbar-user-info {
        display: none
    }
}

@media(max-width: 700px) {
    .stats-grid,.stats-grid.compact {
        grid-template-columns:1fr
    }

    .form-grid {
        grid-template-columns: 1fr
    }

    .form-grid .full {
        grid-column: auto
    }

    .toolbar>select {
        flex: 1
    }

    .search {
        min-width: 100%
    }

    .head-actions {
        width: 100%
    }

    .head-actions .btn {
        flex: 1
    }
}

.calendar-panel {
    overflow: hidden
}

.calendar-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px
}

.calendar-head h3 {
    margin: 0;
    flex: 1;
    text-align: center;
    font-size: 16px
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7,1fr);
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line)
}

.calendar-cell {
    min-height: 115px;
    padding: 9px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff
}

.calendar-cell>b {
    font-size: 13px
}

.muted-day {
    background: #fafbfc
}

.calendar-event {
    display: block;
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
    padding: 5px 6px;
    margin-top: 7px;
    border-radius: 5px
}

.calendar-event span,.calendar-event small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.calendar-event span {
    font-size: 11px;
    font-weight: 700;
    color: #7d1515
}

.calendar-event small {
    font-size: 10px;
    color: #9b5a5a;
    margin-top: 2px
}

.more-events {
    display: block;
    margin-top: 5px;
    color: var(--primary);
    font-size: 11px
}

.scroll-loader {
    text-align: center;
    padding: 12px;
    color: #98a2b3;
    font-size: 14px;
    display: none
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 20px
}

.detail-grid>div {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px
}

.detail-grid .full {
    grid-column: 1/-1
}

.detail-grid span {
    display: block;
    color: #98a2b3;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px
}

.detail-grid strong {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    line-height: 1.5
}

.notification-page-list {
    max-height: calc(100vh - 250px);
    overflow: auto
}

.notification-page-list .notification-item {
    display: flex;
    align-items: flex-start
}

.date-filter {
    display: block;
    min-width: 145px
}

@media(max-width: 700px) {
    .calendar-grid {
        min-width:700px
    }

    .calendar-panel {
        overflow: auto
    }

    .detail-grid {
        grid-template-columns: 1fr
    }

    .detail-grid .full {
        grid-column: auto
    }
}

.link {
    color: var(--primary);
    font-weight: 700;
    font-size: 13px
}

.small {
    width: 30px;
    height: 30px;
    font-size: 14px
}

/* =========================================================
   GridLabs CRM - Readability / Larger Typography
   ========================================================= */
html, body {
    font-size: 16px;
}

body {
    line-height: 1.5;
}

.page-head h2 {
    font-size: 28px;
}

.page-head p {
    font-size: 15px;
    line-height: 1.5;
}

.eyebrow {
    font-size: 12px;
}

.btn {
    font-size: 14px;
    padding: 11px 16px;
}

.panel-head h3 {
    font-size: 17px;
}

.panel-head p,
.panel-head a {
    font-size: 14px;
}

.stat-card span {
    font-size: 13px;
}

.stat-card strong {
    font-size: 25px;
}

.stat-card small {
    font-size: 12px;
}

.pipeline span,
.pipeline strong {
    font-size: 14px;
}

.mini-item strong {
    font-size: 15px;
}

.mini-item span {
    font-size: 13px;
}

.badge {
    font-size: 12px;
    padding: 6px 10px;
}

.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea {
    font-size: 14px;
    padding: 11px 12px;
}

.table-wrap th {
    font-size: 12px;
}

.table-wrap td {
    font-size: 14px;
}

.table-wrap td small {
    font-size: 12px;
}

.form-grid label {
    font-size: 13px;
}

.form-grid label input,
.form-grid label select,
.form-grid label textarea {
    font-size: 14px;
}

.modal-head h3 {
    font-size: 20px;
}

.login-card h1 {
    font-size: 28px;
}

.login-card label {
    font-size: 13px;
}

.login-card input {
    font-size: 15px;
}

.login-footer {
    font-size: 12px;
}

.alert.error {
    font-size: 14px;
}

.calendar-head h3 {
    font-size: 18px;
}

.calendar-cell > b {
    font-size: 13px;
}

.calendar-event span {
    font-size: 11px;
}

.calendar-event small {
    font-size: 10px;
}

.more-events {
    font-size: 11px;
}

.scroll-loader {
    font-size: 12px;
}

.detail-grid span {
    font-size: 11px;
}

.detail-grid strong {
    font-size: 14px;
}

.link {
    font-size: 13px;
}

.small {
    font-size: 12px;
}

/* Better mobile readability */
@media (max-width: 700px) {
    html, body {
        font-size: 15px;
    }

    .content {
        padding: 18px;
    }

    .page-head h2 {
        font-size: 24px;
    }

    .stat-card strong {
        font-size: 25px;
    }

    .table-wrap td {
        font-size: 14px;
    }
}
/* =========================================================
   Search icon alignment fix
   ========================================================= */
.search {
    position: relative;
}

.search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #8b96a5;
    font-size: 15px;
    line-height: 1;
    pointer-events: none;
}

.search input,
.toolbar .search input,
#leadSearch,
#meetingSearch,
#userSearch {
    padding-left: 42px !important;
}

.search input:focus + i {
    color: var(--primary);
}
.badge.assigned{background:#eaf8f1;color:#137c4d}.badge.unassigned{background:#fff2df;color:#a76200}.csv-help{padding:12px;border:1px dashed var(--line);border-radius:10px;background:#fafbfc}.csv-help p{margin:6px 0 12px;color:var(--muted);font-size:13px}.import-result{margin:0 20px 20px;padding:12px;border-radius:9px;background:#f8fafc;border:1px solid var(--line);font-size:13px}.import-result ul{margin:8px 0 0;padding-left:20px}.notification-page-list .notification-link{color:inherit}
.remember-row{display:flex!important;align-items:center;gap:8px;font-size:13px!important;font-weight:500!important;color:#475569}.remember-row input{width:auto!important;margin:0!important}.notification-page-list .notification-link{display:flex}.notification-page-list .notification-link:hover{text-decoration:none;background:#fffafa}

/* =========================================================
   GridLabs CRM 4.4 - Readability / Tools / Dark Mode
   ========================================================= */
.topbar-tool-btn{
    position:relative;
    min-width:42px;
    height:42px;
    padding:0 10px;
    border:1px solid #e5e7eb;
    border-radius:12px;
    background:#fff;
    color:#667085;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    cursor:pointer;
    transition:.2s ease;
}
.topbar-tool-btn:hover{color:var(--primary);border-color:var(--primary-line);background:var(--primary-soft)}
.topbar-tool-btn span{font-size:10px;font-weight:700;line-height:1}

.notification-item.unread{
    background:var(--primary-soft) !important;
    border-left:4px solid var(--primary);
    padding-left:11px;
}
.notification-item.unread .notify-icon{background:var(--primary);color:#fff;box-shadow:0 0 0 4px rgba(var(--primary-rgb),.08)}
.notification-item.unread .notify-title h6{font-weight:800;color:#7f0000}
.notify-unread{display:inline-flex;align-items:center;gap:4px;padding:3px 6px;border-radius:20px;background:var(--primary);color:#fff;font-size:8px;font-weight:800;letter-spacing:.4px;white-space:nowrap}
.notify-unread::before{content:"";width:5px;height:5px;border-radius:50%;background:#fff}
.notification-item{transition:background .18s ease,transform .18s ease}
.notification-item:hover{transform:translateX(1px)}

.stat-link{display:flex;text-decoration:none;color:inherit;cursor:pointer}
.stat-link:hover{text-decoration:none;color:inherit}
.stat-link:focus-visible{outline:3px solid rgba(var(--primary-rgb),.18);outline-offset:2px}
.dashboard-clickable{display:block;text-decoration:none;color:inherit}
.dashboard-clickable:hover{text-decoration:none;color:inherit}
.dashboard-clickable .dashboard-card{cursor:pointer}

/* Larger, more readable CRM typography */
body{font-size:16px}
.sidebar .nav-link{font-size:15px}
.sidebar .submenu-link{font-size:14px}
.sidebar .brand-text strong{font-size:21px}
.sidebar .brand-text small{font-size:12px}
.topbar-search input{font-size:16px}
.topbar-user-info strong{font-size:14px}
.topbar-user-info span{font-size:11px}
.notification-header strong{font-size:15px}
.notification-header span{font-size:11px}
.notification-item .notify-title h6{font-size:13px}
.notification-item .notify-content p{font-size:12px}
.notification-item .notify-time{font-size:10px}

/* Dark mode */
body.dark-mode{
    --body-bg:#0f1115;
    --white:#171a21;
    --text-primary:#f3f4f6;
    --text-secondary:#c3c9d4;
    --text-muted:#8b95a7;
    --border-color:#2a303b;
    background:#0f1115 !important;
    color:#f3f4f6;
}
body.dark-mode .sidebar,
body.dark-mode .crm-topbar,
body.dark-mode .panel,
body.dark-mode .stat-card,
body.dark-mode .dashboard-card,
body.dark-mode .modal-card,
body.dark-mode .notification-dropdown,
body.dark-mode .user-dropdown,
body.dark-mode .login-card{
    background:#171a21 !important;
    border-color:#2a303b !important;
    color:#f3f4f6;
}
body.dark-mode .sidebar{box-shadow:4px 0 18px rgba(0,0,0,.25)}
body.dark-mode .brand{border-color:#2a303b}
body.dark-mode .nav-link,
body.dark-mode .submenu-link{color:#c3c9d4}
body.dark-mode .nav-link:hover,
body.dark-mode .nav-link.active,
body.dark-mode .submenu-link:hover,
body.dark-mode .submenu-link.active{background:#2a1718;color:#ffb4b4}
body.dark-mode .nav-link i:first-child{color:#a9b1bf}
body.dark-mode .topbar-search input,
body.dark-mode .toolbar input,
body.dark-mode .toolbar select,
body.dark-mode .form-grid input,
body.dark-mode .form-grid select,
body.dark-mode .form-grid textarea,
body.dark-mode .date-filter input,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea{
    background:#11151b !important;
    border-color:#343b48 !important;
    color:#f3f4f6 !important;
}
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder{color:#737d8e}
body.dark-mode .topbar-tool-btn,
body.dark-mode .notification-btn{background:#222731;border-color:#343b48;color:#d5d9e1}
body.dark-mode .notification-item{border-color:#2a303b;color:#f3f4f6}
body.dark-mode .notification-item.unread{background:#2b1719 !important}
body.dark-mode .notification-item:not(.unread){background:#171a21}
body.dark-mode .notification-footer{background:#12151a;border-color:#2a303b}
body.dark-mode .notification-header{border-color:#2a303b}
body.dark-mode .notification-header span,
body.dark-mode .notify-time,
body.dark-mode .notification-empty{color:#8b95a7}
body.dark-mode .notify-content p{color:#b5bdca}
body.dark-mode .table-wrap th{background:#11151b;color:#9fa8b7;border-color:#2a303b}
body.dark-mode .table-wrap td{border-color:#2a303b;color:#dce1e8}
body.dark-mode .table-wrap tr:hover{background:#1e222a}
body.dark-mode .panel-head h3,
body.dark-mode .page-head h2,
body.dark-mode .dashboard-title h1{color:#f3f4f6}
body.dark-mode .panel-head p,
body.dark-mode .page-head p,
body.dark-mode .dashboard-title p{color:#9da7b6}
body.dark-mode .modal-head{border-color:#2a303b}
body.dark-mode .modal-actions{border-color:#2a303b}
body.dark-mode .user-dropdown>a{color:#c3c9d4}
body.dark-mode .user-dropdown>a:hover{background:#2a1718;color:#ffb4b4}
body.dark-mode .user-dropdown-divider{background:#2a303b}
body.dark-mode .brand-text small,
body.dark-mode .user-mini-copy small{color:#8b95a7}
body.dark-mode .sidebar-bottom{border-color:#2a303b}
body.dark-mode .dashboard-card-icon,
body.dark-mode .stat-icon{background:#2a1718}
body.dark-mode .badge{filter:saturate(.9)}

@media(max-width:700px){
    .topbar-tool-btn{min-width:38px;height:38px;padding:0 8px}
    .topbar-tool-btn span{display:none}
}

/* =========================================================
   GridLabs CRM 4.5 - Final QA UI
   ========================================================= */
.notification-dropdown{overflow-x:hidden!important;width:430px;max-width:min(430px,calc(100vw - 24px))}
.notification-list{overflow-x:hidden!important;overflow-y:auto}
.notification-item{max-width:100%;box-sizing:border-box}
.notification-item .notify-content{min-width:0}
.notification-item .notify-content p{white-space:normal;overflow-wrap:anywhere}
.notification-item.unread{box-shadow:inset 4px 0 0 var(--primary)}
.notification-item:not(.unread){opacity:.82}
.notify-unread{font-size:9px;padding:4px 7px}
.bulk-toolbar{display:flex;align-items:center;gap:10px;padding:12px 14px;margin-top:10px;background:var(--primary-light);border:1px solid var(--border-color);border-radius:10px}
.bulk-toolbar[hidden]{display:none!important}
.bulk-toolbar span{margin-right:auto;color:var(--text-secondary)}
.bulk-toolbar select{min-width:210px;padding: 12px 12px;border-radius: 10px;}
.check-col{width:42px;text-align:center}
.check-col input{width:16px;height:16px;accent-color:var(--primary)}
.source-pill{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;background:#f1f5f9;color:#475569;font-size:12px;font-weight:700;white-space:nowrap}
.date-filter{min-width:145px}
.date-filter input{width:100%;box-sizing:border-box}
.flatpickr-calendar{font-family:Inter,sans-serif;border-radius:14px;box-shadow:0 16px 45px rgba(15,23,42,.18)}
.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange{background:var(--primary);border-color:var(--primary)}
.flatpickr-day.today{border-color:var(--primary)}
.flatpickr-time input{font-size:15px!important}
/* Premium dark theme */
body.dark-mode{--primary:#8ea7ff;--primary-dark:#718df0;--primary-light:#18223a;--body-bg:#090c12;--white:#11161f;--text-primary:#eef2f8;--text-secondary:#aab4c4;--text-muted:#78859a;--border-color:#252d3a;background:radial-gradient(circle at 78% -10%,rgba(92,118,220,.13),transparent 34%),radial-gradient(circle at 10% 20%,rgba(50,70,120,.08),transparent 30%),#090c12!important;color:#eef2f8}
body.dark-mode .sidebar,body.dark-mode .crm-topbar{background:rgba(14,18,26,.96)!important;border-color:#252d3a!important}
body.dark-mode .panel,body.dark-mode .stat-card,body.dark-mode .modal-card,body.dark-mode .notification-dropdown,body.dark-mode .user-dropdown{background:linear-gradient(180deg,#151b25,#11161f)!important;border-color:#293342!important;box-shadow:0 18px 50px rgba(0,0,0,.24)}
body.dark-mode .nav-link:hover,body.dark-mode .nav-link.active,body.dark-mode .submenu-link:hover,body.dark-mode .submenu-link.active{background:#1a2438!important;color:#b9c7ff!important}
body.dark-mode .nav-link.active i:first-child,body.dark-mode .submenu-link.active i{color:#8ea7ff!important}
body.dark-mode .stat-card{border-top-color:#526aa9}
body.dark-mode .stat-icon{background:#1a2438!important;color:#a9bbff!important}
body.dark-mode .source-pill{background:#1b2433;color:#c8d2e3}
body.dark-mode .bulk-toolbar{background:#121b2b;border-color:#2b374b}
body.dark-mode .flatpickr-calendar{background:#151b25;color:#eaf0f8}
body.dark-mode .flatpickr-day{color:#cbd5e1}
body.dark-mode .flatpickr-day:hover{background:#202c42}
body.dark-mode .flatpickr-day.selected{background:#da000b;border-color:#da000b;color:#fff}
body.dark-mode .notification-item.unread{background:#172039!important;box-shadow:inset 4px 0 0 #8ea7ff}
body.dark-mode .notification-item.unread .notify-icon{background:#26385f;color:#a9bbff;box-shadow:none}
body.dark-mode .notification-item.unread .notify-title h6{color:#dce5ff}
body.dark-mode .notify-unread{background:#8ea7ff;color:#08101f}
body.dark-mode .notification-item:not(.unread){background:#11161f}
body.dark-mode .notification-item:hover{background:#1a2230!important}
body.dark-mode .btn.primary{background:#da000b;color:#fff;box-shadow:0 8px 22px rgba(76,100,190,.22)}
body.dark-mode .btn.primary:hover{background:#829af5}
body.dark-mode .topbar-tool-btn:hover{color:#a9bbff;border-color:#4a5f91;background:#18223a}
.permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;max-height:58vh;overflow:auto;padding-right:4px}.permission-group{border:1px solid var(--line);border-radius:12px;padding:14px;background:var(--panel,#fff)}.permission-group h4{margin:0 0 10px;font-size:14px}.permission-check{display:flex;align-items:center;gap:9px;margin:8px 0;font-size:13px;color:var(--text,#263242)}.permission-check input{width:16px;height:16px;accent-color:var(--primary)}.notification-footer-link{display:flex;align-items:center;justify-content:center;gap:8px;padding:12px 16px;border-top:1px solid var(--line);font-size:12px;font-weight:700;color:var(--primary);background:var(--panel,#fff);text-decoration:none}.notification-footer-link:hover{background:var(--primary-soft,var(--primary-soft))}@media(max-width:700px){.permission-grid{grid-template-columns:1fr}}
.permission-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 12px;padding:10px 12px;border:1px solid var(--line,#e5e7eb);border-radius:12px;background:var(--panel-soft,#f8fafc)}
.permission-module{display:flex;align-items:center;gap:9px;cursor:pointer;font-weight:800}
.permission-module input{width:16px;height:16px;accent-color:var(--primary)}
.user-access-btn{white-space:nowrap;padding:7px 10px!important;font-size:12px!important}
body.dark-mode .permission-toolbar{background:#101722;border-color:#2a3444}
body.dark-mode .permission-group{background:#111923;border-color:#2a3444}
body.dark-mode .permission-check{color:#cbd5e1}

.calendar-cell.calendar-past{background:var(--primary-soft);color:#c62828;opacity:.82}
.calendar-cell.calendar-past>b{color:#c62828}
.calendar-cell.calendar-today{background:#f0fff5;box-shadow:inset 0 3px 0 #16a34a}
.calendar-cell.calendar-today>b{color:#15803d}
.calendar-cell.calendar-upcoming{background:#fffaf0}
.calendar-cell.calendar-upcoming>b{color:#c26a00}
.calendar-event.disabled-event{pointer-events:none;opacity:.55;filter:grayscale(.25)}
.calendar-past .calendar-event span,.calendar-past .calendar-event small{color:#b91c1c}
.calendar-today .calendar-event{border-left-color:#16a34a;background:#f3fff7}
.calendar-upcoming .calendar-event{border-left-color:#f59e0b;background:#fff8e8}
.notification-page-actions{display:flex;align-items:center;gap:10px}

/* =========================================================
   Dashboard Pipeline + Upcoming Meetings UI Fix
   v4.5.9
   ========================================================= */

.grid-2 {
    align-items: stretch;
}

.grid-2 > .panel {
    min-width: 0;
    min-height: 100%;
}

.pipeline {
    display: grid;
    gap: 14px;
    margin-top: 4px;
}

.pipeline-link {
    display: grid;
    grid-template-columns: minmax(105px, auto) 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 38px;
    padding: 5px 0;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
}

.pipeline-link:hover {
    text-decoration: none;
    color: inherit;
}

.pipeline-link span {
    min-width: 0;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.pipeline-link strong {
    display: block;
    text-align: right;
    color: #1c2430;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.pipeline-link i {
    display: block;
    position: relative;
    width: 100%;
    height: 9px;
    margin: 0;
    background: #edf1f5;
    border-radius: 999px;
    overflow: hidden;
}

.pipeline-link i::before {
    display: none;
}

.pipeline-link i b {
    display: block;
    width: var(--w, 0%);
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width .35s ease;
}

.pipeline-link:hover span,
.pipeline-link:hover strong {
    color: var(--primary);
}

.mini-list {
    display: grid;
    gap: 10px;
    margin-top: 2px;
}

.mini-item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 10px 12px;
    border: 1px solid #e9edf2;
    border-radius: 12px;
    background: #fff;
    transition: .2s ease;
}

.mini-item:hover {
    border-color: var(--primary-line);
    box-shadow: 0 6px 18px rgba(15,23,42,.05);
    transform: translateY(-1px);
}

.mini-item > div:nth-child(2) {
    min-width: 0;
}

.mini-item strong,
.mini-item span {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-item strong {
    color: #1c2430;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.mini-item span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.mini-item .date-pill {
    width: 46px;
    height: 50px;
    flex-shrink: 0;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 10px;
}

.mini-item .date-pill b {
    font-size: 17px;
    line-height: 1;
}

.mini-item .date-pill small {
    margin-top: 3px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.mini-item > .badge {
    white-space: nowrap;
}

.mini-item > .fa-chevron-right {
    color: #94a3b8;
    font-size: 13px;
    transition: transform .2s ease, color .2s ease;
}

.mini-item:hover > .fa-chevron-right {
    color: var(--primary);
    transform: translateX(2px);
}

@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .pipeline-link {
        grid-template-columns: 92px 34px minmax(0, 1fr);
        gap: 9px;
    }

    .mini-item {
        grid-template-columns: 46px minmax(0, 1fr) 16px;
    }

    .mini-item > .badge {
        display: none;
    }
}


/* =========================================================
   Reports Page UI
   ========================================================= */
.reports-page .reports-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 680px;
    margin-bottom: 20px;
}

.reports-page .reports-stats .stat-card {
    min-height: 112px;
    padding: 20px;
}

.reports-page .reports-stats .stat-card > div:last-child {
    min-width: 0;
}

.reports-page .grid-2 {
    align-items: stretch;
    gap: 20px;
}

.reports-page .grid-2 > .panel {
    min-width: 0;
    min-height: 310px;
    padding: 22px;
}

.reports-page .panel-head {
    margin-bottom: 18px;
}

.reports-page .panel-head h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary, #182536);
}

.reports-page .panel-head p {
    margin: 5px 0 0;
    color: var(--muted, #7b8798);
    font-size: 13px;
}

.reports-page .report-bars {
    display: grid;
    gap: 17px;
}

.reports-page .report-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.1fr) 42px minmax(120px, 2fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.reports-page .report-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.reports-page .report-row > strong {
    text-align: right;
    color: #172033;
    font-size: 13px;
    font-weight: 800;
}

.reports-page .report-row > i {
    display: block;
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef1f5;
    font-size: 0;
}

.reports-page .report-row > i > b {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: var(--primary, var(--primary));
    transition: width .3s ease;
}

.reports-page .report-bars:empty::after {
    content: 'No report data available';
    display: block;
    padding: 30px 10px;
    text-align: center;
    color: #98a2b3;
    font-size: 13px;
}

@media (max-width: 900px) {
    .reports-page .grid-2 {
        grid-template-columns: 1fr;
    }

    .reports-page .grid-2 > .panel {
        min-height: auto;
    }
}

@media (max-width: 600px) {
    .reports-page .reports-stats {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .reports-page .report-row {
        grid-template-columns: minmax(90px, 1fr) 35px minmax(90px, 1.5fr);
        gap: 9px;
    }
}


/* =========================================================
   Global CRM Page Loader
   ========================================================= */
.crm-page-loader{
    position:fixed;
    inset:0;
    z-index:999999;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:14px;
    background:rgba(245,247,250,.96);
    opacity:1;
    visibility:visible;
    transition:opacity .25s ease,visibility .25s ease;
}
.crm-page-loader.is-ready{
    opacity:0;
    visibility:hidden;
    pointer-events:none;
}
.crm-loader-spinner{
    width:46px;
    height:46px;
    border:4px solid var(--primary-line);
    border-top-color:var(--primary);
    border-right-color:var(--primary);
    border-radius:50%;
    animation:crmLoaderSpin .8s linear infinite;
    box-shadow:0 5px 18px rgba(var(--primary-rgb),.10);
}
.crm-loader-text{
    color:var(--primary);
    font-size:13px;
    font-weight:800;
    letter-spacing:.5px;
}
@keyframes crmLoaderSpin{
    to{transform:rotate(360deg)}
}
body.dark-mode .crm-page-loader{
    background:rgba(15,23,42,.97);
}


/* =========================================================
   GridLabs CRM - Global Readability Pass
   Larger typography + darker neutral text
   ========================================================= */
:root{
    --text-primary:#172033;
    --text-secondary:#3f4d60;
    --text-muted:#5b6879;
}

body{
    font-size:16px !important;
    color:#172033 !important;
}

body,
button,
input,
select,
textarea{
    font-family:inherit;
}

/* Sidebar */
.sidebar .nav-link{
    font-size:16px !important;
    color:#344256 !important;
}
.sidebar .submenu-link{
    font-size:15px !important;
    color:#465468 !important;
}
.sidebar .nav-link.active,
.sidebar .nav-link:hover,
.sidebar .submenu-link.active,
.sidebar .submenu-link:hover{
    color:#343434 !important;
}
.sidebar .brand-text strong{
    font-size:22px !important;
    color:#172033 !important;
}
.sidebar .brand-text small{
    font-size:13px !important;
    color:#59677a !important;
}

/* Topbar */
.topbar-search input{
    font-size:17px !important;
    color:#172033 !important;
}
.topbar-search input::placeholder{
    color:#667387 !important;
    opacity:1 !important;
}
.topbar-user-info strong{
    font-size:15px !important;
    color:#172033 !important;
}
.topbar-user-info span{
    font-size:12px !important;
    color:#5b6879 !important;
}

/* General headings / descriptive text */
.page-title,
.page-title h1{
    color:#172033 !important;
}
.page-subtitle,
.page-title p{
    color:#4e5d70 !important;
}
.panel-title,
.panel h2,
.panel h3{
    color:#172033 !important;
}
.panel p,
.panel small,
.muted,
.text-muted{
    color:#0a0a0a!important;
    font-size:13px
}

/* Forms */
label{
    font-size:15px !important;
    color:#344256 !important;
}
input,
select,
textarea{
    font-size:15px !important;
    color:#263448 !important;
}
input::placeholder,
textarea::placeholder{
    color:#667387 !important;
    opacity:1 !important;
}
select{
    color:#263448 !important;
}

/* Tables */
table th{
    font-size:14px !important;
    color:#465468 !important;
}
table td{
    font-size:15px !important;
    color:#263448 !important;
}
table td strong{
    color:#172033 !important;
}

/* Buttons */
.btn,
button{
    font-size:15px !important;
}
.btn-sm{
    font-size:14px !important;
}

/* Status / badges */
.badge,
.status-badge,
.status,
.pill{
    font-size:12px !important;
}

/* Cards and common list content */
.card-title,
.panel-title{
    font-size:17px !important;
}
.card-text,
.panel-text{
    font-size:14px !important;
    color:#4e5d70 !important;
}

/* Notifications */
.notification-header strong{
    font-size:16px !important;
    color:#172033 !important;
}
.notification-header span{
    font-size:12px !important;
    color:#5b6879 !important;
}
.notification-item .notify-title h6{
    font-size:14px !important;
    color:#263448 !important;
}
.notification-item .notify-content p{
    font-size:13px !important;
    color:#4e5d70 !important;
}
.notification-item .notify-time{
    font-size:11px !important;
    color:#667387 !important;
}

/* User dropdown shown in the screenshot */
.user-dropdown,
.user-dropdown *{
    color:#263448;
}
.user-dropdown .user-name,
.user-dropdown strong{
    font-size:15px !important;
    color:#172033 !important;
}
.user-dropdown .user-email,
.user-dropdown small{
    font-size:13px !important;
    color:#5b6879 !important;
}
.user-dropdown a,
.user-dropdown button{
    font-size:15px !important;
    color:#3f4d60 !important;
}
.user-dropdown a:hover,
.user-dropdown button:hover{
    color:#343434 !important;
}

/* Search / toolbar text */
.search input{
    font-size:16px !important;
}
.toolbar input,
.toolbar select{
    font-size:15px !important;
}

/* Keep mobile readable too */
@media(max-width:575px){
    body{font-size:15px !important;}
    .sidebar .nav-link{font-size:15px !important;}
    .sidebar .submenu-link{font-size:14px !important;}
    .topbar-search input{font-size:15px !important;}
    label{font-size:14px !important;}
    input,select,textarea{font-size:14px !important;}
    table th{font-size:13px !important;}
    table td{font-size:14px !important;}
    .btn,button{font-size:14px !important;}
}


/* Separate CRM logos for desktop and mobile */
.brand-logo .crm-logo-desktop,
.brand-logo .crm-logo-mobile{
    width:100%;
    height:100%;
    object-fit:contain;
    display:block;
}
.brand-logo .crm-logo-mobile{display:none;}
@media(max-width:991px){
    .brand-logo .crm-logo-desktop{display:none;}
    .brand-logo .crm-logo-mobile{display:block;}
}

/* =========================================================
   CRM BRAND LOGOS - IMAGE ONLY
   Desktop expanded = Desktop Logo
   Sidebar collapsed = Mobile Logo
   Mobile/tablet = Mobile Logo
   ========================================================= */

.brand {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 18px 20px;
    min-height: 92px;
    box-sizing: border-box;
}

.brand .crm-logo {
    display: block;
    object-fit: contain;
    object-position: left center;
    transition: all .2s ease;
}

.brand .crm-logo-desktop {
    width: 190px;
    max-width: 100%;
    height: 58px;
}

.brand .crm-logo-mobile {
    display: none;
}

.crm-logo-fallback {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
}

/* Support the CRM's common collapsed sidebar class names. */
.sidebar.collapsed .brand,
aside.sidebar.collapsed .brand {
    justify-content: center;
    padding: 18px 10px;
}

.sidebar.collapsed .crm-logo-desktop,
aside.sidebar.collapsed .crm-logo-desktop {
    display: none;
}

.sidebar.collapsed .crm-logo-mobile,
aside.sidebar.collapsed .crm-logo-mobile {
    display: block;
    width: 48px;
    height: 48px;
}

/* If the project uses a data/state class for collapse. */
body.sidebar-collapsed .crm-logo-desktop {
    display: none;
}

body.sidebar-collapsed .crm-logo-mobile {
    display: block;
    width: 48px;
    height: 48px;
}

@media (max-width: 991px) {
    .brand {
        justify-content: center;
        padding: 16px 12px;
    }

    .brand .crm-logo-desktop {
        display: none;
    }

    .brand .crm-logo-mobile {
        display: block;
        width: 52px;
        height: 52px;
    }
}

/* GRIDLABS THEME HOVER FIX */
.sidebar .sidebar-nav .nav-link,
.sidebar .sidebar-nav .nav-parent,
.sidebar .sidebar-nav a.nav-link,
.sidebar .sidebar-nav button.nav-link{
    color:var(--text)!important;
}
.sidebar .sidebar-nav .nav-link i,
.sidebar .sidebar-nav .nav-parent i{
    color:var(--muted)!important;
    transition:color .18s ease,background-color .18s ease;
}
.sidebar .sidebar-nav .nav-link:hover,
.sidebar .sidebar-nav .nav-link:focus-visible,
.sidebar .sidebar-nav .nav-parent:hover,
.sidebar .sidebar-nav .nav-parent:focus-visible{
    color:var(--primary)!important;
    background:var(--primary-soft)!important;
}
.sidebar .sidebar-nav .nav-link:hover i,
.sidebar .sidebar-nav .nav-link:focus-visible i,
.sidebar .sidebar-nav .nav-parent:hover i,
.sidebar .sidebar-nav .nav-parent:focus-visible i{
    color:var(--primary)!important;
}
.sidebar .sidebar-nav .nav-link.active,
.sidebar .sidebar-nav .nav-parent.open,
.sidebar .sidebar-nav .nav-parent.active{
    color:var(--primary)!important;
    background:var(--primary-soft)!important;
    border-color:var(--primary-line)!important;
}
.sidebar .sidebar-nav .nav-link.active i,
.sidebar .sidebar-nav .nav-parent.open i,
.sidebar .sidebar-nav .nav-parent.active i{
    color:var(--primary)!important;
}
.sidebar .sidebar-nav .nav-submenu .nav-link:hover,
.sidebar .sidebar-nav .nav-submenu .nav-link:focus-visible,
.sidebar .sidebar-nav .nav-submenu .nav-link.active{
    color:var(--primary)!important;
    background:var(--primary-soft)!important;
}
.sidebar .sidebar-nav .nav-submenu .nav-link:hover i,
.sidebar .sidebar-nav .nav-submenu .nav-link:focus-visible i,
.sidebar .sidebar-nav .nav-submenu .nav-link.active i{
    color:var(--primary)!important;
}
body.dark-mode .sidebar .sidebar-nav .nav-link:hover,
body.dark-mode .sidebar .sidebar-nav .nav-link:focus-visible,
body.dark-mode .sidebar .sidebar-nav .nav-parent:hover,
body.dark-mode .sidebar .sidebar-nav .nav-parent:focus-visible{
    color:var(--primary)!important;
    background:var(--primary-soft)!important;
}

/* =========================================================
   GLOBAL FILTER SYSTEM - compact, hidden by default
   Applies to Leads, Meetings, Projects, Invoices,
   Payments, Users and Manage Clients.
   ========================================================= */
.filter-toggle-btn{white-space:nowrap;min-width:112px;justify-content:center}
.filter-toggle-btn .filter-hide-label{display:none}
.filter-toggle-btn.is-open .filter-show-label{display:none}
.filter-toggle-btn.is-open .filter-hide-label{display:inline}
.filter-panel-fields[hidden]{display:none!important}
.filter-panel-fields:not([hidden]){display:grid!important}
.filter-panel-fields{width:100%;order:20;grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:10px;align-items:center;margin-top:0;padding:10px;border:1px solid var(--line,#e5e7eb);border-radius:10px;background:var(--panel-soft,#fafbfc);box-sizing:border-box}
.filter-panel-fields select,.filter-panel-fields input{width:100%;min-width:0;box-sizing:border-box}
.filter-panel-fields .date-filter{min-width:0;width:100%}
.filter-panel-fields .btn{width:max-content;min-width:100px}
.crm-filter-toolbar,.client-toolbar{align-items:center}
.payments-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.payments-toolbar .search{flex:1;min-width:240px}
.payments-toolbar .filter-panel-fields{order:20}
.payments-toolbar .filter-toggle-btn{order:10}
.payments-toolbar .search{order:1}
@media(max-width:900px){.filter-panel-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.filter-panel-fields .btn{width:100%}}
@media(max-width:600px){.filter-panel-fields{grid-template-columns:1fr}.filter-panel-fields .btn{width:100%}.filter-toggle-btn{min-width:100px}}

/* =========================================================
   FILTER TOGGLE SAFETY FIX
   Some module handlers toggle only .show while the HTML
   hidden attribute remains present.  The .show state must
   always win so every CRM filter can open consistently.
   ========================================================= */
.filter-panel-fields.show {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100%;
  box-sizing: border-box;
}
.filter-panel-fields:not(.show) {
  visibility: hidden;
}
.filter-panel-fields[hidden]:not(.show) {
  display: none !important;
}

/* Keep toolbar/filter layout stable when the panel expands. */
.toolbar,
.payments-toolbar,
.client-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.filter-panel-fields {
  flex-basis: 100%;
  order: 50;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
/* =========================================================
   SUBSCRIPTION FILTER UI — match the existing Leads filter
   ========================================================= */
.subscription-register-card .subscription-filter-toolbar{
    width:100%;
    margin:0;
    align-items:center;
}
.subscription-register-title{
    flex:1 1 auto;
    min-width:250px;
}
.subscription-register-card .filter-toggle-btn{
    order:2;
    height:46px;
    box-sizing:border-box;
}
.subscription-register-card .sa-count{
    order:3;
    white-space:nowrap;
}
.subscription-register-card .filter-panel-fields{
    order:10;
    grid-template-columns:repeat(6,minmax(150px,1fr));
    gap:10px;
    padding:10px;
    margin-top:0;
    border:1px solid #e1e6ee;
    border-radius:10px;
    background:#fafbfc;
}
.subscription-register-card .filter-panel-fields .subscription-filter-search{
    grid-column:1/-1;
    min-width:0;
    width:100%;
}
.subscription-register-card .subscription-filter-search input{
    height:46px!important;
    min-height:46px!important;
    width:100%!important;
    box-sizing:border-box!important;
    border:1px solid #838383!important;
    border-radius:8px!important;
    background:#fff!important;
    padding:10px 12px 10px 38px!important;
    font-size:14px!important;
    color:#263242!important;
}
.subscription-register-card .subscription-filter-search input:focus{
    border-color:var(--primary)!important;
    box-shadow:0 0 0 3px rgba(var(--primary-rgb),.08)!important;
}
.subscription-register-card .filter-panel-fields select,
.subscription-register-card .filter-panel-fields input{
    height:46px!important;
    min-height:46px!important;
    width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    border:1px solid #838383!important;
    border-radius:8px!important;
    background:#fff!important;
    padding:10px 11px!important;
    outline:none;
    color:#263242!important;
    font-size:14px!important;
}
.subscription-register-card .filter-panel-fields input::placeholder{
    color:#7b8798;
    opacity:1;
}
.subscription-register-card .filter-panel-fields select:focus,
.subscription-register-card .filter-panel-fields input:focus{
    border-color:var(--primary)!important;
    box-shadow:0 0 0 3px rgba(var(--primary-rgb),.08)!important;
}
.subscription-register-card .filter-panel-fields .date-filter{
    display:block;
    position:relative;
    min-width:0;
    width:100%;
}
.subscription-register-card .filter-panel-fields .date-filter .flatpickr-input{
    width:100%!important;
}
.subscription-register-card .filter-panel-fields .date-filter input:not(.flatpickr-input){
    width:100%!important;
    height:46px!important;
    min-height:46px!important;
    box-sizing:border-box!important;
    border:1px solid #838383!important;
    border-radius:8px!important;
    background:#fff!important;
    padding:10px 40px 10px 11px!important;
    color:#263242!important;
    font-size:14px!important;
    cursor:pointer;
}
.subscription-register-card .filter-panel-fields .date-filter:after{
    content:'\f133';
    font-family:'Font Awesome 6 Free';
    font-weight:900;
    position:absolute;
    right:13px;
    top:50%;
    transform:translateY(-50%);
    color:#667085;
    pointer-events:none;
}
.subscription-register-card .filter-panel-fields .btn{
    width:100%;
    min-width:0;
    height:46px;
    justify-content:center;
    box-sizing:border-box;
}
@media(max-width:1250px){
    .subscription-register-title{width:100%;}
    .subscription-register-card .filter-toggle-btn{order:3;}
    .subscription-register-card .sa-count{order:4;margin-left:auto;}
    .subscription-register-card .filter-panel-fields{grid-template-columns:repeat(3,minmax(0,1fr));}
}
@media(max-width:800px){
    .subscription-register-card .filter-panel-fields{grid-template-columns:repeat(2,minmax(0,1fr));}
    .subscription-register-card .subscription-filter-search{min-width:100%;}
}
@media(max-width:600px){
    .subscription-register-card .filter-panel-fields{grid-template-columns:1fr;}
    .subscription-register-card .sa-count{width:100%;margin-left:0;}
}

/* =========================================================
   GridLabs CRM v1.3.1 - Responsive / Dark Mode / Dashboard
   Final UI correction
   ========================================================= */

/* Prevent flex/grid children from creating page-wide overflow. */
.main,
.content,
.panel,
.stats-grid,
.grid-2,
.lead-analytics-grid,
.dashboard-clickable,
.stat-card,
.analytics-card {
    min-width: 0;
}

/* Dashboard two-column panels: always keep a visible gutter. */
.grid-2 {
    column-gap: 24px !important;
    row-gap: 24px !important;
}

.lead-analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 24px !important;
    row-gap: 24px !important;
    padding: 18px !important;
}

.lead-analytics-grid .analytics-card {
    width: 100%;
    min-width: 0;
}

/* Dashboard cards should never force horizontal scrolling. */
.stats-grid.dashboard-stats {
    width: 100%;
    min-width: 0;
}

.dashboard-clickable {
    display: block;
    width: 100%;
}

.stat-card {
    width: 100%;
    min-width: 0;
}

/* Dark mode: dashboard analytics contains inline light-theme colors,
   so explicitly map every important text/surface to the dark palette. */
body.dark-mode .lead-analytics-panel,
body.dark-mode .lead-analytics-grid .analytics-card {
    background: #151b25 !important;
    border-color: #293342 !important;
    color: #eef2f8 !important;
}

body.dark-mode .lead-analytics-summary,
body.dark-mode .lead-analytics-summary span,
body.dark-mode .analytics-card-title span,
body.dark-mode .status-legend-row,
body.dark-mode .status-legend-row span,
body.dark-mode .source-row-head,
body.dark-mode .analytics-empty {
    color: #aab4c4 !important;
}

body.dark-mode .lead-analytics-summary b,
body.dark-mode .analytics-card-title strong,
body.dark-mode .status-donut strong,
body.dark-mode .status-legend-row b,
body.dark-mode .source-row-head b {
    color: #eef2f8 !important;
}

body.dark-mode .lead-analytics-summary a,
body.dark-mode .lead-analytics-panel .panel-head a {
    color: #9eb2ff !important;
}

body.dark-mode .status-donut:after {
    background: #151b25 !important;
}

body.dark-mode .status-donut small,
body.dark-mode .status-legend-row small {
    color: #8995a8 !important;
}

body.dark-mode .source-track {
    background: #252d3a !important;
}

body.dark-mode .stat-card span,
body.dark-mode .stat-card small,
body.dark-mode .pipeline span,
body.dark-mode .panel-head p,
body.dark-mode .muted {
    color: #aab4c4 !important;
}

body.dark-mode .stat-card strong,
body.dark-mode .panel-head h3,
body.dark-mode .page-head h2,
body.dark-mode .dashboard-title h1 {
    color: #eef2f8 !important;
}

body.dark-mode .pipeline i {
    background: #252d3a !important;
}

body.dark-mode .pipeline i b {
    background: var(--primary) !important;
}

/* Dark-mode form/table readability across module pages. */
body.dark-mode .panel,
body.dark-mode .stat-card,
body.dark-mode .analytics-card,
body.dark-mode .table-wrap,
body.dark-mode .form-card,
body.dark-mode .card {
    color: #eef2f8;
}

body.dark-mode label,
body.dark-mode .form-label,
body.dark-mode .field-label,
body.dark-mode .table-wrap td,
body.dark-mode .table-wrap th {
    color: #d8deea !important;
}

body.dark-mode .table-wrap th {
    background: #11161e !important;
}

body.dark-mode .table-wrap td {
    background: transparent !important;
}

body.dark-mode .empty,
body.dark-mode .help-text,
body.dark-mode .field-help {
    color: #8f9bad !important;
}

/* ---------------------------------------------------------
   Mobile: no horizontal card clipping / no desktop grids.
   --------------------------------------------------------- */
@media (max-width: 767px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
    }

    .main {
        width: 100%;
        max-width: 100%;
        margin-left: 0 !important;
        padding-top: 76px;
    }

    .content {
        width: 100%;
        max-width: 100%;
        padding: 14px !important;
        overflow: hidden;
    }

    .page-head {
        width: 100%;
        gap: 14px;
        margin-bottom: 18px;
    }

    .page-head h2 {
        font-size: 24px;
        line-height: 1.2;
    }

    .page-head p {
        font-size: 14px;
        line-height: 1.5;
    }

    .head-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .head-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .stats-grid.dashboard-stats,
    .stats-grid,
    .stats-grid.compact {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
        margin-bottom: 14px;
    }

    .dashboard-clickable,
    .stat-card {
        width: 100% !important;
        max-width: 100%;
    }

    .stat-card {
        padding: 15px;
        min-height: 94px;
    }

    .grid-2 {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 16px !important;
        margin-bottom: 16px;
    }

    .lead-analytics-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 16px !important;
        padding: 12px !important;
    }

    .analytics-card {
        width: 100%;
        padding: 14px !important;
    }

    .status-chart-wrap {
        flex-direction: column;
        gap: 20px;
        min-height: 0;
        align-items: center;
    }

    .status-legend {
        width: 100%;
    }

    .panel {
        padding: 16px !important;
    }

    .panel-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .panel-head > a {
        margin-left: auto;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 10px !important;
    }

    .panel {
        border-radius: 12px;
        padding: 13px !important;
    }

    .stat-card {
        padding: 13px;
    }

    .stat-card strong {
        font-size: 23px;
    }

    .lead-analytics-grid {
        padding: 10px !important;
    }
}

/* Tablet: two dashboard stat columns, but no overflow. */
@media (min-width: 768px) and (max-width: 1100px) {
    .stats-grid.dashboard-stats,
    .stats-grid,
    .stats-grid.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

    .lead-analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 18px !important;
    }
}
