/* ============================================================
   infiHRM — Premium Purple Enterprise Theme
   Brand palette matched to infiHRM logo
   ============================================================ */

:root {
    --crm-primary: #9333ea;
    --crm-primary-hover: #7e22ce;
    --crm-primary-light: #a855f7;
    --crm-primary-deep: #5b21b6;
    --crm-primary-soft: #f5f0fe;
    --crm-primary-muted: #ede9fe;
    --crm-primary-rgb: 147, 51, 234;
    --crm-primary-gradient: linear-gradient(135deg, #5b21b6 0%, #9333ea 55%, #a855f7 100%);
    --crm-sidebar-active: linear-gradient(135deg, #6d28d9 0%, #9333ea 100%);
    --crm-sidebar-active-hover: linear-gradient(135deg, #5b21b6 0%, #7e22ce 100%);
    --crm-sidebar-active-soft: #f5f0fe;
    --crm-sidebar-active-shadow: 0 4px 18px rgba(147, 51, 234, 0.38), 0 2px 6px rgba(91, 33, 182, 0.22);
    --crm-success: #059669;
    --crm-success-soft: #ecfdf5;
    --crm-danger: #dc2626;
    --crm-warning: #d97706;
    --crm-bg: #f8f6fc;
    --crm-surface: #ffffff;
    --crm-text: #1e1b4b;
    --crm-text-secondary: #4c4585;
    --crm-text-muted: #8b85a8;
    --crm-border: #e8e4f3;
    --crm-border-light: #f3f0fa;
    --crm-shadow-sm: 0 1px 2px rgba(30, 27, 75, 0.05);
    --crm-shadow: 0 1px 3px rgba(30, 27, 75, 0.07);
    --crm-shadow-md: 0 4px 6px -1px rgba(30, 27, 75, 0.08);
    --crm-radius: 10px;
    --crm-radius-lg: 12px;
    --crm-sidebar-width: 256px;
    --crm-header-height: 64px;
    --crm-transition: 0.2s ease;
}

/* ---- Base ---- */
body.crm-theme {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background-color: var(--crm-bg) !important;
    color: var(--crm-text);
    -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
body.crm-theme #page-topbar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: var(--crm-sidebar-width) !important;
    height: var(--crm-header-height) !important;
    background: var(--crm-surface) !important;
    border-bottom: 1px solid var(--crm-border) !important;
    box-shadow: none !important;
    z-index: 1002;
}

body.crm-theme .navbar-header {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px;
    width: 100%;
    height: var(--crm-header-height) !important;
    padding: 0 24px !important;
    background: transparent !important;
    margin: 0 !important;
}

body.crm-theme .crm-header-right { margin-left: auto; }

body.crm-theme .navbar-brand-box { display: none !important; }

body.crm-theme #vertical-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--crm-border);
    background: var(--crm-surface);
    color: var(--crm-text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

body.crm-theme .crm-header-left { display: flex; align-items: center; gap: 8px; }

body.crm-theme .crm-header-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--crm-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
    transition: var(--crm-transition);
    text-decoration: none;
}

body.crm-theme .crm-header-icon:hover {
    background: var(--crm-bg);
    color: var(--crm-primary);
}

body.crm-theme .crm-notif-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--crm-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.crm-theme .crm-header-search {
    flex: 1;
    max-width: 420px;
    margin: 0 20px;
}

body.crm-theme .crm-search-wrap { position: relative; }

body.crm-theme .crm-search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--crm-text-muted);
    font-size: 18px;
    pointer-events: none;
}

body.crm-theme .crm-search-wrap input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 42px;
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    background: var(--crm-bg);
    font-size: 14px;
    color: var(--crm-text);
    outline: none;
    transition: var(--crm-transition);
}

body.crm-theme .crm-search-wrap input:focus {
    background: var(--crm-surface);
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 3px rgba(var(--crm-primary-rgb), 0.14);
}

body.crm-theme .crm-header-right { display: flex; align-items: center; gap: 4px; }

body.crm-theme .crm-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--crm-transition);
}

body.crm-theme .crm-user-btn:hover { background: var(--crm-bg); }

body.crm-theme .crm-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--crm-primary-gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.crm-theme .crm-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--crm-text);
}

body.crm-theme .crm-user-role {
    font-size: 12px;
    color: var(--crm-text-muted);
    display: block;
}

body.crm-theme .crm-chevron-down { color: var(--crm-text-muted); }

body.crm-theme .crm-sidebar-overlay {
    display: none;
}

body.crm-theme #page-header-user-dropdown {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* ---- Sidebar ---- */
body.crm-theme .vertical-menu {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: var(--crm-sidebar-width) !important;
    height: 100vh !important;
    background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%) !important;
    border-right: 1px solid var(--crm-border) !important;
    box-shadow: none !important;
    z-index: 1001;
}

body.crm-theme .crm-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 2px 1px 2px;
    border-bottom: 1px solid var(--crm-border);
    min-height: 108px;
    background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
}

body.crm-theme .crm-sidebar-brand a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 12px;
    text-decoration: none;
}

body.crm-theme .crm-sidebar-brand img {
    object-fit: contain;
}

body.crm-theme .crm-sidebar-brand .crm-sidebar-logo {
    display: block;
    width: 100%;
    height: auto;
    max-width: 230px;
    max-height: 88px;
    min-height: 72px;
}

body.crm-theme .crm-sidebar-brand .crm-sidebar-icon {
    display: none;
    width: 48px;
    height: 48px;
    object-fit: contain;
    object-position: center;
}

body.crm-theme .crm-sidebar-brand span {
    display: none;
}

body.crm-theme #sidebar-menu { padding: 12px 8px 24px; }

body.crm-theme #sidebar-menu #side-menu > li,
body.crm-theme #sidebar-menu .sub-menu > li {
    padding: 2px 6px;
}

body.crm-theme #sidebar-menu .menu-title {
    color: var(--crm-text-muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 12px 6px !important;
}

body.crm-theme #sidebar-menu ul li a {
    color: var(--crm-text-secondary) !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
    transition: background-color var(--crm-transition), color var(--crm-transition), box-shadow var(--crm-transition);
    margin-bottom: 2px;
}

body.crm-theme #sidebar-menu ul li a i {
    font-size: 18px !important;
    width: 20px;
    text-align: center;
    color: inherit !important;
}

body.crm-theme #sidebar-menu ul li a span { color: inherit !important; }

body.crm-theme #sidebar-menu ul li a:hover:not(.active) {
    background: var(--crm-primary-soft) !important;
    color: var(--crm-primary-deep) !important;
}

body.crm-theme #sidebar-menu ul li.mm-active > a,
body.crm-theme #sidebar-menu ul li > a.active,
body.crm-theme #sidebar-menu .sub-menu li.mm-active > a,
body.crm-theme #sidebar-menu .sub-menu li a.active {
    background: var(--crm-sidebar-active) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    box-shadow: var(--crm-sidebar-active-shadow) !important;
}

body.crm-theme #sidebar-menu ul li.mm-active > a:hover,
body.crm-theme #sidebar-menu ul li > a.active:hover,
body.crm-theme #sidebar-menu .sub-menu li.mm-active > a:hover,
body.crm-theme #sidebar-menu .sub-menu li a.active:hover {
    background: var(--crm-sidebar-active-hover) !important;
    color: #ffffff !important;
}

body.crm-theme #sidebar-menu ul li.mm-active > a i,
body.crm-theme #sidebar-menu ul li > a.active i,
body.crm-theme #sidebar-menu ul li.mm-active > a span,
body.crm-theme #sidebar-menu ul li > a.active span,
body.crm-theme #sidebar-menu .sub-menu li.mm-active > a i,
body.crm-theme #sidebar-menu .sub-menu li a.active i,
body.crm-theme #sidebar-menu .sub-menu li.mm-active > a span,
body.crm-theme #sidebar-menu .sub-menu li a.active span {
    color: #ffffff !important;
}

body.crm-theme #sidebar-menu .sub-menu {
    background: transparent !important;
    padding-left: 4px;
}

body.crm-theme #sidebar-menu .sub-menu li a {
    padding: 8px 14px 8px 28px !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    border-radius: 8px !important;
}

body.crm-theme #sidebar-menu .has-arrow::after { color: var(--crm-text-muted) !important; }
body.crm-theme #sidebar-menu ul li.mm-active > a.has-arrow::after,
body.crm-theme #sidebar-menu .sub-menu li.mm-active > a.has-arrow::after,
body.crm-theme #sidebar-menu ul li > a.active.has-arrow::after,
body.crm-theme #sidebar-menu .sub-menu li a.active.has-arrow::after {
    color: #ffffff !important;
}

/* ---- Main Content ---- */
body.crm-theme .main-content {
    margin-left: var(--crm-sidebar-width) !important;
    margin-right: 0 !important;
    margin-top: var(--crm-header-height) !important;
    background: var(--crm-bg);
    min-height: calc(100vh - var(--crm-header-height));
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: visible !important;
}

body.crm-theme .page-content {
    padding: 24px !important;
    padding-bottom: 32px !important;
    flex: 1 0 auto;
}

body.crm-theme .footer {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 56px;
    margin-top: auto;
    flex-shrink: 0;
    background: var(--crm-surface) !important;
    border-top: 1px solid var(--crm-border);
    color: var(--crm-text-muted);
    font-size: 13px;
    padding: 16px 24px !important;
    display: flex;
    align-items: center;
}

body.crm-theme .footer .container-fluid {
    width: 100%;
    padding: 0;
}

body.crm-theme .footer .row {
    width: 100%;
    margin: 0;
    align-items: center;
}

body.crm-theme .crm-footer-text {
    font-weight: 500;
    color: var(--crm-text-secondary);
}

body.crm-theme.vertical-collpsed .footer {
    right: auto !important;
}

/* ---- Page Title ---- */
body.crm-theme .page-title-box {
    background: transparent;
    padding: 0 0 20px;
}

body.crm-theme .page-title-box h4 {
    font-size: 22px;
    font-weight: 600;
    color: var(--crm-text);
}

body.crm-theme .breadcrumb-item a { color: var(--crm-text-muted); text-decoration: none; }
body.crm-theme .breadcrumb-item.active { color: var(--crm-text-secondary); }

/* ---- Dashboard ---- */
.crm-dash-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding: 28px 32px;
    background: linear-gradient(135deg, #ffffff 0%, #faf8ff 55%, #f5f0fe 100%);
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    box-shadow: var(--crm-shadow-sm);
    position: relative;
    overflow: hidden;
}

.crm-dash-hero::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(var(--crm-primary-rgb), 0.14) 0%, transparent 70%);
    pointer-events: none;
}

.crm-dash-hero-content { position: relative; z-index: 1; }

.crm-dash-greeting {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.crm-dash-hero h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--crm-text);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    text-transform: capitalize;
}

.crm-dash-hero p {
    font-size: 14px;
    color: var(--crm-text-muted);
    margin: 0;
    max-width: 520px;
}

.crm-dash-hero-meta { position: relative; z-index: 1; flex-shrink: 0; }

.crm-dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.crm-dash-header h4 {
    font-size: 24px;
    font-weight: 600;
    color: var(--crm-text);
    margin: 0 0 4px;
}

.crm-dash-header p { font-size: 14px; color: var(--crm-text-muted); margin: 0; }

.crm-dash-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--crm-text-secondary);
    box-shadow: var(--crm-shadow-sm);
}

.crm-dash-date i { font-size: 18px; color: var(--crm-primary); }

.crm-stat-card {
    position: relative;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: var(--crm-shadow-sm);
    transition: transform var(--crm-transition), box-shadow var(--crm-transition), border-color var(--crm-transition);
    height: 100%;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    overflow: hidden;
}

.crm-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--crm-primary-rgb), 0.1);
    border-color: #ddd6fe;
}

.crm-stat-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 14px 0 0 14px;
}

.crm-stat-card--blue .crm-stat-accent { background: var(--crm-primary); }
.crm-stat-card--green .crm-stat-accent { background: var(--crm-success); }
.crm-stat-card--purple .crm-stat-accent { background: var(--crm-primary-deep); }

.crm-stat-card .stat-info { padding-left: 8px; }

.crm-stat-card .stat-info h6 {
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-text-muted);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.crm-stat-card .stat-info .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--crm-text);
    margin: 0 0 4px;
    line-height: 1;
}

.crm-stat-card .stat-hint {
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.crm-stat-card .stat-icon.blue { background: var(--crm-primary-soft); color: var(--crm-primary); }
.crm-stat-card .stat-icon.green { background: var(--crm-success-soft); color: var(--crm-success); }
.crm-stat-card .stat-icon.purple { background: var(--crm-primary-soft); color: var(--crm-primary-deep); }

.crm-panel-card,
.crm-chart-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    box-shadow: var(--crm-shadow-sm);
    height: 100%;
}

.crm-panel-card { padding: 22px 24px 24px; }
.crm-chart-card { padding: 22px 24px 16px; }

.crm-chart-card--tall { min-height: 100%; }

.crm-panel-card-head,
.crm-chart-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.crm-panel-card-head h6,
.crm-chart-card-head h6 {
    font-size: 16px;
    font-weight: 600;
    color: var(--crm-text);
    margin: 0 0 4px;
}

.crm-panel-card-head p,
.crm-chart-card-head p {
    font-size: 13px;
    color: var(--crm-text-muted);
    margin: 0;
}

.crm-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--crm-text);
    margin: 28px 0 16px;
}

.crm-status-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--crm-shadow-sm);
    transition: transform var(--crm-transition), box-shadow var(--crm-transition), border-color var(--crm-transition);
    cursor: pointer;
    height: 100%;
    min-height: 96px;
}

.crm-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--crm-primary-rgb), 0.08);
    border-color: #ddd6fe;
}

.crm-status-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.crm-status-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.crm-status-count {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.crm-status-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--crm-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-status-card--blue { border-left: 3px solid var(--crm-primary); }
.crm-status-card--blue .crm-status-icon { background: var(--crm-primary-soft); color: var(--crm-primary); }
.crm-status-card--blue .crm-status-count { color: var(--crm-primary); }

.crm-status-card--green { border-left: 3px solid #059669; }
.crm-status-card--green .crm-status-icon { background: #ecfdf5; color: #059669; }
.crm-status-card--green .crm-status-count { color: #059669; }

.crm-status-card--orange { border-left: 3px solid #d97706; }
.crm-status-card--orange .crm-status-icon { background: #fffbeb; color: #d97706; }
.crm-status-card--orange .crm-status-count { color: #d97706; }

.crm-status-card--purple { border-left: 3px solid var(--crm-primary-deep); }
.crm-status-card--purple .crm-status-icon { background: var(--crm-primary-soft); color: var(--crm-primary-deep); }
.crm-status-card--purple .crm-status-count { color: var(--crm-primary-deep); }

.crm-status-card--teal { border-left: 3px solid #0891b2; }
.crm-status-card--teal .crm-status-icon { background: #ecfeff; color: #0891b2; }
.crm-status-card--teal .crm-status-count { color: #0891b2; }

.crm-status-card--rose { border-left: 3px solid #e11d48; }
.crm-status-card--rose .crm-status-icon { background: #fff1f2; color: #e11d48; }
.crm-status-card--rose .crm-status-count { color: #e11d48; }

.crm-status-card--indigo { border-left: 3px solid var(--crm-primary-light); }
.crm-status-card--indigo .crm-status-icon { background: var(--crm-primary-muted); color: var(--crm-primary-light); }
.crm-status-card--indigo .crm-status-count { color: var(--crm-primary-light); }

.crm-status-card--amber { border-left: 3px solid #ca8a04; }
.crm-status-card--amber .crm-status-icon { background: #fefce8; color: #ca8a04; }
.crm-status-card--amber .crm-status-count { color: #ca8a04; }

.crm-status-card .status-label { font-size: 13px; font-weight: 500; color: var(--crm-text-muted); margin-bottom: 8px; }
.crm-status-card .status-value { font-size: 26px; font-weight: 700; color: var(--crm-primary); margin: 0; }

#leadPipelineChart {
    min-height: 260px;
}

.crm-pipeline-chart-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-pipeline-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--crm-border-light);
    max-height: 220px;
    overflow-y: auto;
}

.crm-pipeline-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--crm-text-secondary);
    min-width: 0;
}

.crm-pipeline-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}

.crm-pipeline-legend-label {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.crm-pipeline-legend-count {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--crm-text);
    min-width: 18px;
    text-align: right;
}

@media (max-width: 576px) {
    .crm-pipeline-legend {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991px) {
    .crm-dash-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 22px 20px;
    }

    .crm-dash-hero h2 { font-size: 24px; }
}

/* ---- Cards ---- */
body.crm-theme .card {
    background: var(--crm-surface) !important;
    border: 1px solid var(--crm-border) !important;
    border-radius: var(--crm-radius-lg) !important;
    box-shadow: var(--crm-shadow-sm) !important;
}

body.crm-theme .card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--crm-border) !important;
    padding: 16px 20px !important;
    font-weight: 600;
}

body.crm-theme .card-body { padding: 20px !important; }

/* ---- Buttons ---- */
body.crm-theme .btn {
    border-radius: 8px !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    padding: 8px 16px !important;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

body.crm-theme .btn-primary {
    background: var(--crm-primary-gradient) !important;
    border-color: var(--crm-primary) !important;
    box-shadow: none !important;
}

body.crm-theme .btn-primary:hover {
    background: var(--crm-sidebar-active-hover) !important;
    border-color: var(--crm-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--crm-primary-rgb), 0.28) !important;
}

body.crm-theme .btn-success {
    background-color: var(--crm-success) !important;
    border-color: var(--crm-success) !important;
}

body.crm-theme .btn-danger {
    background-color: var(--crm-danger) !important;
    border-color: var(--crm-danger) !important;
}

/* ---- Table Action Buttons (View / Edit / Delete) ---- */
body.crm-theme #datatable td,
body.crm-theme .table-responsive .table td {
    vertical-align: middle !important;
}

body.crm-theme #datatable td form,
body.crm-theme .table-responsive .table td form {
    display: inline-block;
    margin: 2px 1px;
}

body.crm-theme #datatable td .btn,
body.crm-theme #datatable td a.btn,
body.crm-theme .table-responsive .table td .btn,
body.crm-theme .table-responsive .table td a.btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 32px;
    padding: 6px 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    white-space: nowrap;
    text-decoration: none !important;
}

body.crm-theme #datatable td .btn i,
body.crm-theme .table-responsive .table td .btn i {
    font-size: 14px;
    line-height: 1;
}

body.crm-theme #datatable td .btn:hover,
body.crm-theme #datatable td a.btn:hover,
body.crm-theme .table-responsive .table td .btn:hover,
body.crm-theme .table-responsive .table td a.btn:hover {
    transform: translateY(-1px);
}

/* View */
body.crm-theme #datatable td .btn-info,
body.crm-theme .table-responsive .table td .btn-info,
body.crm-theme #datatable td a.crm-btn-view,
body.crm-theme .table-responsive .table td a.crm-btn-view {
    background: var(--crm-primary-soft) !important;
    color: var(--crm-primary) !important;
    border-color: #d8b4fe !important;
}

body.crm-theme #datatable td .btn-info:hover,
body.crm-theme .table-responsive .table td .btn-info:hover,
body.crm-theme #datatable td a.crm-btn-view:hover,
body.crm-theme .table-responsive .table td a.crm-btn-view:hover {
    background: var(--crm-primary) !important;
    color: #ffffff !important;
    border-color: var(--crm-primary) !important;
    box-shadow: 0 4px 12px rgba(var(--crm-primary-rgb), 0.28) !important;
}

/* Edit */
body.crm-theme #datatable td button.btn-success,
body.crm-theme .table-responsive .table td button.btn-success,
body.crm-theme #datatable td .crm-btn-edit,
body.crm-theme .table-responsive .table td .crm-btn-edit {
    background: var(--crm-primary-muted) !important;
    color: var(--crm-primary-deep) !important;
    border-color: #c4b5fd !important;
}

body.crm-theme #datatable td button.btn-success:hover,
body.crm-theme .table-responsive .table td button.btn-success:hover,
body.crm-theme #datatable td .crm-btn-edit:hover,
body.crm-theme .table-responsive .table td .crm-btn-edit:hover {
    background: var(--crm-primary-deep) !important;
    color: #ffffff !important;
    border-color: var(--crm-primary-deep) !important;
    box-shadow: 0 4px 12px rgba(91, 33, 182, 0.28) !important;
}

/* Delete */
body.crm-theme #datatable td .btn-danger,
body.crm-theme .table-responsive .table td .btn-danger,
body.crm-theme #datatable td .delete-btn,
body.crm-theme .table-responsive .table td .delete-btn,
body.crm-theme #datatable td .crm-btn-delete,
body.crm-theme .table-responsive .table td .crm-btn-delete {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

body.crm-theme #datatable td .btn-danger:hover,
body.crm-theme .table-responsive .table td .btn-danger:hover,
body.crm-theme #datatable td .delete-btn:hover,
body.crm-theme .table-responsive .table td .delete-btn:hover,
body.crm-theme #datatable td .crm-btn-delete:hover,
body.crm-theme .table-responsive .table td .crm-btn-delete:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28) !important;
}

/* Quotation / success links */
body.crm-theme #datatable td a.btn-success:not(.crm-btn-view),
body.crm-theme .table-responsive .table td a.btn-success:not(.crm-btn-view) {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border-color: #6ee7b7 !important;
}

body.crm-theme #datatable td a.btn-success:not(.crm-btn-view):hover,
body.crm-theme .table-responsive .table td a.btn-success:not(.crm-btn-view):hover {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.28) !important;
}

/* Sales order / warning */
body.crm-theme #datatable td .btn-warning,
body.crm-theme .table-responsive .table td .btn-warning,
body.crm-theme #datatable td .crm-btn-sales,
body.crm-theme .table-responsive .table td .crm-btn-sales {
    background: #fffbeb !important;
    color: #d97706 !important;
    border-color: #fcd34d !important;
}

body.crm-theme #datatable td .btn-warning:hover,
body.crm-theme .table-responsive .table td .btn-warning:hover,
body.crm-theme #datatable td .crm-btn-sales:hover,
body.crm-theme .table-responsive .table td .crm-btn-sales:hover {
    background: #d97706 !important;
    color: #ffffff !important;
    border-color: #d97706 !important;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.28) !important;
}

body.crm-theme .crm-action-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* ---- Forms ---- */
body.crm-theme .form-control,
body.crm-theme .form-select,
body.crm-theme select.form-control {
    border: 1px solid var(--crm-border) !important;
    border-radius: 8px !important;
    padding: 9px 14px !important;
    font-size: 14px !important;
    min-height: 40px;
    background-color: var(--crm-surface) !important;
}

body.crm-theme .form-control:focus,
body.crm-theme .form-select:focus {
    border-color: var(--crm-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--crm-primary-rgb), 0.14) !important;
}

body.crm-theme .form-label {
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--crm-text-secondary) !important;
    margin-bottom: 6px !important;
}

body.crm-theme #filterForm {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--crm-shadow-sm);
}

/* ============================================================
   DataTables — preserve #datatable id & full functionality
   ============================================================ */
body.crm-theme .crm-table-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: var(--crm-shadow-sm);
    padding: 0;
    overflow: visible;
}

body.crm-theme .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--crm-radius-lg);
}

body.crm-theme #datatable {
    width: 100% !important;
    margin-bottom: 0 !important;
}

body.crm-theme .dataTables_wrapper {
    width: 100%;
    padding: 16px;
    overflow: visible;
}

body.crm-theme .dataTables_wrapper .row:first-child,
body.crm-theme .dataTables_wrapper .row:last-child {
    align-items: center;
    margin-bottom: 12px;
}

body.crm-theme table.dataTable,
body.crm-theme .table {
    border-collapse: separate !important;
    border-spacing: 0;
}

body.crm-theme table.dataTable thead th,
body.crm-theme .table thead th {
    background: var(--crm-bg) !important;
    color: var(--crm-text-secondary) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--crm-border) !important;
    border-top: none !important;
    padding: 12px 16px !important;
    white-space: nowrap;
    vertical-align: middle;
}

body.crm-theme table.dataTable tbody td,
body.crm-theme .table tbody td {
    padding: 12px 16px !important;
    font-size: 14px;
    color: var(--crm-text);
    border-bottom: 1px solid var(--crm-border-light) !important;
    vertical-align: middle;
}

body.crm-theme table.dataTable tbody tr:hover,
body.crm-theme .table tbody tr:hover {
    background: var(--crm-primary-soft) !important;
}

body.crm-theme table.dataTable.no-footer { border-bottom: 1px solid var(--crm-border) !important; }

body.crm-theme .dataTables_length label,
body.crm-theme .dataTables_filter label,
body.crm-theme .dataTables_info {
    font-size: 13px;
    color: var(--crm-text-muted);
    margin: 0;
}

body.crm-theme .dataTables_filter input {
    border: 1px solid var(--crm-border) !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    margin-left: 8px;
    font-size: 14px;
}

body.crm-theme .dataTables_length select {
    border: 1px solid var(--crm-border) !important;
    border-radius: 8px !important;
    padding: 4px 8px !important;
    margin: 0 6px;
}

body.crm-theme .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    border: 1px solid var(--crm-border) !important;
    padding: 4px 10px !important;
    margin: 0 2px !important;
    font-size: 13px !important;
    background: var(--crm-surface) !important;
    color: var(--crm-text-secondary) !important;
}

body.crm-theme .dataTables_paginate .paginate_button.current {
    background: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #fff !important;
}

body.crm-theme .dataTables_paginate .paginate_button:hover {
    background: var(--crm-primary-soft) !important;
    border-color: var(--crm-primary) !important;
    color: var(--crm-primary) !important;
}

/* ---- Modals ---- */
body.crm-theme .modal-content {
    border: 1px solid var(--crm-border) !important;
    border-radius: var(--crm-radius-lg) !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15) !important;
}

body.crm-theme .modal-header { border-bottom: 1px solid var(--crm-border) !important; padding: 18px 24px !important; }
body.crm-theme .modal-body { padding: 24px !important; }
body.crm-theme .modal-footer { border-top: 1px solid var(--crm-border) !important; padding: 16px 24px !important; }

/* ---- Dropdowns ---- */
body.crm-theme .dropdown-menu {
    border: 1px solid var(--crm-border) !important;
    border-radius: var(--crm-radius) !important;
    box-shadow: var(--crm-shadow-md) !important;
    padding: 6px !important;
}

body.crm-theme .dropdown-item {
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 14px;
}

body.crm-theme .dropdown-item:hover { background: var(--crm-bg) !important; }

body.crm-theme .success-message,
body.crm-theme .add-message { color: var(--crm-success) !important; font-weight: 500; }
body.crm-theme .error-message { color: var(--crm-danger) !important; font-weight: 500; }

body.crm-theme .page-content .table-responsive {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: var(--crm-shadow-sm);
    padding: 16px;
    overflow-x: auto !important;
}

body.crm-theme table.dataTable thead th,
body.crm-theme .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* ---- Login ---- */
.crm-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top right, rgba(var(--crm-primary-rgb), 0.12) 0%, transparent 42%),
        radial-gradient(circle at bottom left, rgba(91, 33, 182, 0.1) 0%, transparent 38%),
        var(--crm-bg);
    padding: 24px;
}

.crm-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: 0 12px 40px rgba(30, 27, 75, 0.1);
    overflow: hidden;
}

.crm-login-brand {
    text-align: center;
    padding: 32px 24px 24px;
    border-bottom: 1px solid var(--crm-border);
    background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
}

.crm-login-brand img {
    width: auto;
    height: auto;
    max-width: min(280px, 100%);
    max-height: 100px;
    object-fit: contain;
    margin-bottom: 16px;
}
.crm-login-brand h5 { display: none; }
.crm-login-brand p { font-size: 14px; color: var(--crm-text-muted); margin: 0; }
.crm-login-body { padding: 28px 28px 32px; }
.crm-login-copy { font-size: 13px; }

/* ---- Collapsed Sidebar ---- */
body.crm-theme.vertical-collpsed .vertical-menu { width: 70px !important; }
body.crm-theme.vertical-collpsed .main-content { margin-left: 70px !important; }
body.crm-theme.vertical-collpsed #page-topbar { left: 70px !important; }
body.crm-theme.vertical-collpsed .crm-sidebar-brand .crm-sidebar-logo { display: none; }
body.crm-theme.vertical-collpsed .crm-sidebar-brand .crm-sidebar-icon { display: block; }
body.crm-theme.vertical-collpsed .crm-sidebar-brand span { display: none; }
body.crm-theme.vertical-collpsed #vertical-menu-btn { display: inline-flex !important; }

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    body.crm-theme {
        overflow-x: hidden;
    }

    body.crm-theme #page-topbar {
        left: 0 !important;
        width: 100% !important;
    }

    body.crm-theme .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    body.crm-theme #vertical-menu-btn {
        display: inline-flex !important;
    }

    body.crm-theme .footer {
        right: auto !important;
        left: auto !important;
    }

    /* Off-canvas sidebar */
    body.crm-theme .vertical-menu {
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 1004 !important;
        box-shadow: none !important;
    }

    body.crm-theme.sidebar-enable .vertical-menu {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(30, 27, 75, 0.18) !important;
    }

    body.crm-theme .crm-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(30, 27, 75, 0.45);
        z-index: 1003;
        -webkit-tap-highlight-color: transparent;
    }

    body.crm-theme.sidebar-enable .crm-sidebar-overlay {
        display: block;
    }

    body.crm-theme.sidebar-enable {
        overflow: hidden;
        touch-action: none;
    }

    body.crm-theme .navbar-header {
        padding: 0 12px !important;
        height: 56px !important;
    }

    body.crm-theme #page-topbar {
        height: 56px !important;
    }

    body.crm-theme .main-content {
        margin-top: 56px !important;
        min-height: calc(100vh - 56px);
    }

    body.crm-theme .crm-header-search {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        max-width: none;
        margin: 0;
        padding: 10px 12px;
        background: var(--crm-surface);
        border-bottom: 1px solid var(--crm-border);
        z-index: 1001;
    }

    body.crm-theme .crm-header-search.is-mobile-open {
        display: block;
    }

    body.crm-theme .page-title-box {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px;
    }

    body.crm-theme .page-title-box h4 {
        font-size: 18px !important;
    }

    body.crm-theme .page-title-right {
        width: 100%;
    }

    body.crm-theme .breadcrumb {
        font-size: 12px;
        flex-wrap: wrap;
    }

    body.crm-theme .dataTables_wrapper .row:first-child,
    body.crm-theme .dataTables_wrapper .row:last-child {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }

    body.crm-theme .dataTables_length,
    body.crm-theme .dataTables_filter {
        text-align: left !important;
        width: 100%;
    }

    body.crm-theme .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 6px;
    }

    body.crm-theme .dataTables_paginate {
        text-align: center !important;
        margin-top: 8px;
    }

    body.crm-theme #filterForm .row > [class*="col-"] {
        margin-bottom: 8px;
    }

    body.crm-theme .card-body {
        padding: 16px !important;
    }

    body.crm-theme .card-header {
        padding: 12px 16px !important;
    }

    body.crm-theme .crm-action-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    body.crm-theme #datatable td .btn,
    body.crm-theme .table-responsive .table td .btn {
        width: 100%;
        justify-content: center;
    }

    body.crm-theme .page-content .table-responsive {
        padding: 10px;
    }

    body.crm-theme .dataTables_wrapper {
        padding: 10px;
    }

    .crm-dash-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .crm-dash-header h4 {
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    body.crm-theme .page-content {
        padding: 12px !important;
        padding-bottom: 20px !important;
    }

    body.crm-theme .footer {
        padding: 12px 16px !important;
        font-size: 12px;
        text-align: center;
    }

    body.crm-theme .footer .col-sm-6 {
        text-align: center !important;
    }

    .crm-dash-hero {
        padding: 18px 16px;
        margin-bottom: 20px;
        border-radius: 12px;
    }

    .crm-dash-hero h2 {
        font-size: 20px;
    }

    .crm-dash-hero p {
        font-size: 13px;
    }

    .crm-dash-date {
        width: 100%;
        justify-content: center;
    }

    .crm-stat-card {
        padding: 16px;
        min-height: 110px;
    }

    .crm-stat-card .stat-info .stat-value {
        font-size: 22px;
    }

    .crm-stat-card .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .crm-panel-card,
    .crm-chart-card {
        padding: 16px;
        border-radius: 12px;
    }

    .crm-status-card {
        min-height: 88px;
        padding: 14px;
    }

    .crm-status-count {
        font-size: 20px;
    }

    body.crm-theme .btn {
        min-height: 40px;
    }

    body.crm-theme .form-control,
    body.crm-theme .form-select {
        font-size: 16px !important; /* prevents iOS zoom on focus */
    }

    body.crm-theme .page-title-box h4 {
        font-size: 17px !important;
    }

    .crm-cell-truncate {
        max-width: 120px;
    }

    body.crm-theme .modal-body {
        padding: 16px !important;
    }

    body.crm-theme .modal-header,
    body.crm-theme .modal-footer {
        padding: 12px 16px !important;
    }

    .crm-login-page {
        padding: 16px;
        align-items: flex-start;
        padding-top: 10vh;
    }

    .crm-login-body {
        padding: 20px;
    }

    .crm-faq-hero {
        padding: 20px 16px;
    }

    .crm-faq-hero-text h4 {
        font-size: 18px;
    }
}

/* ---- FAQ Page ---- */
.crm-faq-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #faf8ff 55%, #f5f0fe 100%);
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: var(--crm-shadow-sm);
}

.crm-faq-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--crm-primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    box-shadow: var(--crm-sidebar-active-shadow);
}

.crm-faq-hero-text h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--crm-text);
    margin: 0 0 8px;
}

.crm-faq-hero-text p {
    margin: 0;
    color: var(--crm-text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

.crm-faq-quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.crm-faq-quick-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    color: var(--crm-text);
    text-decoration: none;
    font-size: 13px;
    transition: var(--crm-transition);
    box-shadow: var(--crm-shadow-sm);
}

.crm-faq-quick-link i {
    font-size: 18px;
    color: var(--crm-primary);
}

.crm-faq-quick-link:hover {
    background: var(--crm-primary-soft);
    border-color: #ddd6fe;
    color: var(--crm-primary-deep);
    transform: translateY(-1px);
}

.crm-faq-section-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--crm-shadow-sm);
}

.crm-faq-section-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--crm-border-light);
}

.crm-faq-section-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.crm-faq-section-head h5 {
    font-size: 18px;
    font-weight: 700;
    color: var(--crm-text);
    margin: 0 0 4px;
}

.crm-faq-section-head p {
    margin: 0;
    font-size: 13px;
    color: var(--crm-text-muted);
}

body.crm-theme .crm-faq-accordion .accordion-item {
    border: 1px solid var(--crm-border) !important;
    border-radius: 12px !important;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: none;
}

body.crm-theme .crm-faq-accordion .accordion-button {
    font-size: 15px;
    font-weight: 700 !important;
    color: var(--crm-text);
    background: var(--crm-bg) !important;
    padding: 16px 20px;
    box-shadow: none !important;
    gap: 10px;
    line-height: 1.45;
}

body.crm-theme .crm-faq-accordion .accordion-button strong {
    font-weight: 700;
    color: inherit;
}

body.crm-theme .crm-faq-accordion .accordion-button:not(.collapsed) {
    color: var(--crm-primary-deep);
    background: var(--crm-primary-soft) !important;
    border-bottom: 1px solid #ddd6fe;
}

body.crm-theme .crm-faq-accordion .accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(var(--crm-primary-rgb), 0.14) !important;
    border-color: transparent;
}

body.crm-theme .crm-faq-accordion .accordion-button::after {
    background-size: 14px;
    flex-shrink: 0;
}

body.crm-theme .crm-faq-accordion .accordion-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--crm-text-secondary);
    padding: 16px 20px 20px;
    background: var(--crm-surface);
}

body.crm-theme .crm-faq-accordion .accordion-body strong {
    font-weight: 700;
    color: var(--crm-text);
}

body.crm-theme .crm-faq-accordion .accordion-body p {
    margin-bottom: 10px;
}

body.crm-theme .crm-faq-accordion .accordion-body p:last-child {
    margin-bottom: 0;
}

body.crm-theme .crm-faq-accordion .accordion-body ul,
body.crm-theme .crm-faq-accordion .accordion-body ol {
    margin: 8px 0 12px;
    padding-left: 20px;
}

body.crm-theme .crm-faq-accordion .accordion-body li {
    margin-bottom: 6px;
}

body.crm-theme .crm-faq-accordion .accordion-body li strong {
    color: var(--crm-primary-deep);
}

.crm-faq-steps {
    counter-reset: faq-step;
    list-style: none;
    padding-left: 0 !important;
    margin: 0 0 12px !important;
}

.crm-faq-steps li {
    position: relative;
    padding-left: 36px;
    margin-bottom: 10px !important;
}

.crm-faq-steps li::before {
    counter-increment: faq-step;
    content: counter(faq-step);
    position: absolute;
    left: 0;
    top: 1px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--crm-primary-gradient);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crm-faq-path {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--crm-primary-soft);
    border: 1px solid #ddd6fe;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--crm-text-secondary);
    margin-bottom: 14px !important;
}

.crm-faq-path i {
    color: var(--crm-primary);
    font-size: 16px;
}

.crm-faq-path strong {
    color: var(--crm-primary-deep);
}

.crm-faq-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--crm-text-secondary);
    margin: 12px 0 0 !important;
}

.crm-faq-note i {
    color: #d97706;
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.crm-faq-note strong {
    color: var(--crm-text);
}

.crm-faq-role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.crm-faq-role-box {
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    padding: 16px;
}

.crm-faq-role-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.crm-faq-role-badge--admin {
    background: var(--crm-primary-soft);
    color: var(--crm-primary-deep);
}

.crm-faq-role-badge--user {
    background: #ecfdf5;
    color: #059669;
}

.crm-faq-role-box ul {
    margin: 0;
    padding-left: 18px;
}

.crm-faq-tags-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
    list-style: none;
    padding-left: 0 !important;
}

.crm-faq-tags-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px !important;
}

.crm-faq-tags-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--crm-primary);
    flex-shrink: 0;
}

.crm-faq-contact {
    background: linear-gradient(135deg, var(--crm-primary-soft) 0%, #faf8ff 100%);
    border: 1px solid #ddd6fe;
    border-radius: 16px;
    padding: 24px 28px;
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.crm-faq-contact-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--crm-primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: var(--crm-sidebar-active-shadow);
}

.crm-faq-contact h6 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--crm-text);
}

.crm-faq-contact p {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--crm-text-secondary);
}

.crm-faq-contact p:last-child {
    margin-bottom: 0;
    font-size: 13px;
    padding-top: 8px;
    border-top: 1px solid #ddd6fe;
}

.crm-faq-contact strong {
    color: var(--crm-text);
    font-weight: 700;
}

@media (max-width: 767px) {
    .crm-faq-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        text-align: left;
    }

    .crm-faq-hero-text h4 {
        font-size: 20px;
    }

    .crm-faq-quick-nav {
        gap: 8px;
    }

    .crm-faq-quick-link {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
        font-size: 12px;
        padding: 10px 12px;
    }

    .crm-faq-section-card {
        padding: 16px;
    }

    .crm-faq-role-grid,
    .crm-faq-tags-list {
        grid-template-columns: 1fr;
    }

    .crm-faq-contact {
        flex-direction: column;
        padding: 20px;
    }
}

.crm-import-export-bar .btn i {
    font-size: 16px;
    vertical-align: middle;
}

/* ---- Leads list tables ---- */
.crm-leads-section { margin-bottom: 28px; }
.crm-leads-section:last-child { margin-bottom: 0; }

.crm-leads-table-wrap {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: var(--crm-shadow-sm);
    overflow: hidden;
}

.crm-leads-table-wrap .dataTables_wrapper { padding: 16px; }

body.crm-theme .crm-leads-table-wrap .table-responsive {
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.crm-leads-table thead th { white-space: nowrap; }

.crm-leads-table tbody tr.crm-lead-row { cursor: pointer; }

.crm-lead-link {
    color: var(--crm-primary) !important;
    font-weight: 500;
    text-decoration: none;
}

.crm-lead-link:hover { text-decoration: underline; }

.crm-cell-truncate {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.crm-leads-table .col-actions { white-space: nowrap; width: 1%; }

.crm-leads-table .col-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
    margin-right: 4px;
}

.crm-leads-table .col-amount {
    font-weight: 600;
    white-space: nowrap;
}

.crm-leads-table .col-sr {
    width: 56px;
    text-align: center;
}

.crm-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.crm-badge--status { background: var(--crm-primary-soft); color: var(--crm-primary); }
.crm-badge--priority-high { background: #fef2f2; color: #dc2626; }
.crm-badge--priority-medium { background: #fffbeb; color: #d97706; }
.crm-badge--priority-low { background: #ecfdf5; color: #059669; }
.crm-badge--default { background: var(--crm-bg); color: var(--crm-text-secondary); }

.crm-leads-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--crm-text-muted);
    font-size: 14px;
}

/* ---- Brand accents ---- */
body.crm-theme ::selection {
    background: rgba(var(--crm-primary-rgb), 0.18);
    color: var(--crm-text);
}

body.crm-theme a:not(.btn):not(.dropdown-item):not(.crm-lead-link) {
    color: var(--crm-primary);
}

body.crm-theme a:not(.btn):not(.dropdown-item):hover {
    color: var(--crm-primary-hover);
}

body.crm-theme .page-link {
    color: var(--crm-primary) !important;
}

body.crm-theme .page-item.active .page-link {
    background: var(--crm-primary-gradient) !important;
    border-color: var(--crm-primary) !important;
}

/* ---- Global Search ---- */
body.crm-theme .crm-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 380px;
    overflow-y: auto;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    box-shadow: var(--crm-shadow-lg, 0 12px 32px rgba(30, 27, 75, 0.12));
    z-index: 1100;
    padding: 6px;
}

body.crm-theme .crm-search-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--crm-text-muted);
    padding: 8px 10px 4px;
}

body.crm-theme .crm-search-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--crm-transition);
}

body.crm-theme .crm-search-item:hover,
body.crm-theme .crm-search-item.is-active {
    background: var(--crm-bg);
}

body.crm-theme .crm-search-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

body.crm-theme .crm-search-item-icon--lead {
    background: rgba(147, 51, 234, 0.12);
    color: var(--crm-primary);
}

body.crm-theme .crm-search-item-icon--customer {
    background: rgba(5, 150, 105, 0.12);
    color: #059669;
}

body.crm-theme .crm-search-item-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

body.crm-theme .crm-search-item-body strong {
    font-size: 14px;
    color: var(--crm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.crm-theme .crm-search-item-body small {
    font-size: 12px;
    color: var(--crm-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.crm-theme .crm-search-empty {
    padding: 16px;
    text-align: center;
    color: var(--crm-text-muted);
    font-size: 13px;
}

/* ---- Kanban Pipeline ---- */
body.crm-theme .crm-kanban-board-wrap {
    overflow-x: auto;
    padding-bottom: 12px;
}

body.crm-theme .crm-kanban-board {
    display: flex;
    gap: 16px;
    min-height: 420px;
    align-items: flex-start;
}

body.crm-theme .crm-kanban-loading,
body.crm-theme .crm-kanban-empty {
    width: 100%;
    text-align: center;
    padding: 48px 16px;
    color: var(--crm-text-muted);
    font-size: 15px;
}

body.crm-theme .crm-kanban-column {
    flex: 0 0 280px;
    max-width: 280px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    overflow: hidden;
}

body.crm-theme .crm-kanban-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

body.crm-theme .crm-kanban-column-head--0 { background: linear-gradient(135deg, #9333ea, #7c3aed); }
body.crm-theme .crm-kanban-column-head--1 { background: linear-gradient(135deg, #059669, #047857); }
body.crm-theme .crm-kanban-column-head--2 { background: linear-gradient(135deg, #d97706, #b45309); }
body.crm-theme .crm-kanban-column-head--3 { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
body.crm-theme .crm-kanban-column-head--4 { background: linear-gradient(135deg, #db2777, #be185d); }
body.crm-theme .crm-kanban-column-head--5 { background: linear-gradient(135deg, #0891b2, #0e7490); }
body.crm-theme .crm-kanban-column-head--6 { background: linear-gradient(135deg, #4f46e5, #4338ca); }
body.crm-theme .crm-kanban-column-head--7 { background: linear-gradient(135deg, #64748b, #475569); }

body.crm-theme .crm-kanban-column-count {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

body.crm-theme .crm-kanban-column-body {
    min-height: 120px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

body.crm-theme .crm-kanban-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    padding: 12px;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(30, 27, 75, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

body.crm-theme .crm-kanban-card:hover {
    box-shadow: 0 4px 14px rgba(30, 27, 75, 0.1);
}

body.crm-theme .crm-kanban-card-ghost {
    opacity: 0.45;
}

body.crm-theme .crm-kanban-card-drag {
    cursor: grabbing;
    transform: rotate(1deg);
}

body.crm-theme .crm-kanban-card--high { border-left: 3px solid #dc2626; }
body.crm-theme .crm-kanban-card--medium { border-left: 3px solid #d97706; }
body.crm-theme .crm-kanban-card--low { border-left: 3px solid #059669; }

body.crm-theme .crm-kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--crm-text);
    margin-bottom: 4px;
}

body.crm-theme .crm-kanban-card-sub {
    font-size: 12px;
    color: var(--crm-text-secondary);
    margin-bottom: 8px;
}

body.crm-theme .crm-kanban-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: var(--crm-text-muted);
    margin-bottom: 8px;
}

body.crm-theme .crm-kanban-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

body.crm-theme .crm-kanban-card-priority {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
}

body.crm-theme .crm-kanban-card-assignee {
    margin-top: 8px;
    font-size: 11px;
    color: var(--crm-text-muted);
}

/* ---- Calendar ---- */
body.crm-theme .crm-calendar-wrap {
    padding: 16px;
}

body.crm-theme .crm-calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--crm-text-secondary);
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 999px;
    padding: 6px 12px;
}

body.crm-theme .crm-calendar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

body.crm-theme .crm-calendar-dot--followup { background: #9333ea; }
body.crm-theme .crm-calendar-dot--reminder { background: #059669; }

body.crm-theme #crmCalendar .fc-toolbar-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--crm-text);
}

body.crm-theme #crmCalendar .fc-button-primary {
    background: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
}

body.crm-theme #crmCalendar .fc-button-primary:not(:disabled).fc-button-active,
body.crm-theme #crmCalendar .fc-button-primary:not(:disabled):active {
    background: var(--crm-primary-hover, #7c3aed) !important;
    border-color: var(--crm-primary-hover, #7c3aed) !important;
}

body.crm-theme #crmCalendar .fc-daygrid-event {
    border-radius: 4px;
    font-size: 12px;
    padding: 1px 4px;
}

@media (max-width: 767.98px) {
    body.crm-theme .crm-kanban-column {
        flex: 0 0 260px;
        max-width: 260px;
    }

    body.crm-theme #crmCalendar .fc-toolbar {
        flex-direction: column;
        gap: 8px;
    }
}
