/* =========================================================
   CRM DASHBOARD LAYOUT - CLEAN FINAL CSS
========================================================= */

/* =========================================================
   ROOT BRAND VARIABLES
========================================================= */
:root {

    /* =====================================================
       PRIMARY COLORS
    ===================================================== */

    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #60a5fa;
    --primary-light: #dbeafe;
    --primary-ultra-light: #eff6ff;

    /* =====================================================
       SUCCESS COLORS
    ===================================================== */

    --success-color: #16a34a;
    --success-hover: #15803d;
    --success-light: #dcfce7;
    --success-ultra-light: #f0fdf4;

    /* =====================================================
       DANGER COLORS
    ===================================================== */

    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    --danger-ultra-light: #fef2f2;

    /* =====================================================
       WARNING COLORS
    ===================================================== */

    --warning-color: #f59e0b;
    --warning-hover: #d97706;
    --warning-light: #fef3c7;
    --warning-ultra-light: #fffbeb;

    --warning-gradient:
        linear-gradient(
            135deg,
            #f59e0b,
            #fbbf24
        );

    /* =====================================================
       DARK COLORS
    ===================================================== */

    --dark-color: #020617;
    --dark-light: #0f172a;
    --dark-soft: #1e293b;

    /* =====================================================
       BASE COLORS
    ===================================================== */

    --white-color: #ffffff;

    --body-bg: #f8fafc;
    --app-bg: #f1f5f9;

    --surface-muted: #f8fafc;
    --surface-soft: #f1f5f9;
    --surface-white: #ffffff;

    /* =====================================================
       TEXT COLORS
    ===================================================== */

    --text-color: #0f172a;
    --text-light: #64748b;
    --text-muted: #94a3b8;

    /* =====================================================
       BORDER COLORS
    ===================================================== */

    --border-color: #e2e8f0;

    --border-soft:
        rgba(226, 232, 240, 0.8);

    --border-dark-soft:
        rgba(255, 255, 255, 0.06);

    /* =====================================================
       GRADIENTS
    ===================================================== */

    --primary-gradient:
        linear-gradient(
            135deg,
            #2563eb 0%,
            #3b82f6 100%
        );

    --dark-gradient:
        linear-gradient(
            135deg,
            #020617 0%,
            #0f172a 100%
        );

    --success-gradient:
        linear-gradient(
            135deg,
            #16a34a 0%,
            #22c55e 100%
        );

    --danger-gradient:
        linear-gradient(
            135deg,
            #ef4444 0%,
            #f87171 100%
        );

    /* =====================================================
       TRANSITIONS
    ===================================================== */

    --transition:
        all .30s cubic-bezier(
            0.4,
            0,
            0.2,
            1
        );

    /* =====================================================
       SHADOWS
    ===================================================== */

    --shadow-sm:
        0 8px 24px rgba(15, 23, 42, 0.06);

    --shadow-md:
        0 15px 40px rgba(15, 23, 42, 0.08);

    --shadow-lg:
        0 40px 80px rgba(15, 23, 42, 0.24);

    /* =====================================================
       BORDER RADIUS
    ===================================================== */

    --radius-xs: 12px;
    --radius-sm: 14px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 30px;
    --radius-pill: 999px;

    /* =====================================================
       LAYOUT
    ===================================================== */

    --sidebar-width: 280px;
    --sidebar-collapsed-width: 85px;
    --topbar-height: 82px;

    --content-padding: 30px;
    --content-padding-md: 20px;
    --content-padding-sm: 15px;

    /* =====================================================
       TYPOGRAPHY
    ===================================================== */

    --font-family: 'Inter', sans-serif;
}


/* =========================================================
   RESET / BASE
========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    background: var(--body-bg);
    color: var(--text-color);
    font-family: var(--font-family);
}

a,
button,
input,
textarea,
select {
    font: inherit;
}

a {
    text-decoration: none;
    transition: var(--transition);
}

button {
    cursor: pointer;
    transition: var(--transition);
}

/* =========================================================
   ACCESSIBLE FOCUS
========================================================= */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* =========================================================
   LIGHT BRAND BUTTONS
========================================================= */

.btn{

    height: 48px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

/* =========================================================
   TABLE ACTION BUTTONS
========================================================= */

.crm-table .btn{
    width:38px;
    height:38px;
    padding:0;
    justify-content:center;
    border-radius:10px;
}

.crm-table .btn i{
    font-size:.9rem;
}

/* =========================================================
   PRIMARY
========================================================= */

.btn-primary{

    background:var(--primary-light) !important;

    color:var(--primary-color) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active{

    background:var(--primary-color) !important;

    color:var(--white-color) !important;
}

/* =========================================================
   SUCCESS
========================================================= */

.btn-success{

    background:var(--success-light) !important;

    color:var(--success-color) !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active{

    background:var(--success-color) !important;

    color:var(--white-color) !important;
}

/* =========================================================
   DANGER
========================================================= */

.btn-danger{

    background:var(--danger-light) !important;

    color:var(--danger-color) !important;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active{

    background:var(--danger-color) !important;

    color:var(--white-color) !important;
}

/* =========================================================
   WARNING
========================================================= */

.btn-warning{

    background:var(--warning-light) !important;

    color:var(--warning-color) !important;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active{

    background:var(--warning-color) !important;

    color:var(--white-color) !important;
}

/* =========================================================
   LIGHT SUBTLE BACKGROUNDS
========================================================= */

.bg-primary-subtle{

    background:var(--primary-light) !important;
}

.bg-success-subtle{

    background:var(--success-light) !important;
}

.bg-danger-subtle{

    background:var(--danger-light) !important;
}

.bg-warning-subtle{

    background:var(--warning-light) !important;
}

/* =========================================================
   LIGHT TEXT COLORS
========================================================= */

.text-primary{

    color:var(--primary-color) !important;
}

.text-success{

    color:var(--success-color) !important;
}

.text-danger{

    color:var(--danger-color) !important;
}

.text-warning{

    color:var(--warning-color) !important;
}

/* =========================================================
   LIGHT BADGE OVERRIDES
========================================================= */

.badge{

    font-weight: 700 !important;

    font-size: .78rem !important;

    padding: 7px 12px !important;

    border-radius: 999px !important;

    border: 1px solid transparent !important;

    box-shadow: none !important;
}

/* =========================================================
   PRIMARY
========================================================= */

.bg-primary,
.badge.bg-primary{

    background: #dbeafe !important;

    color: #2563eb !important;

    border-color: #bfdbfe !important;
}

/* =========================================================
   SUCCESS
========================================================= */

.bg-success,
.badge.bg-success{

    background: #dcfce7 !important;

    color: #16a34a !important;

    border-color: #bbf7d0 !important;
}

/* =========================================================
   DANGER
========================================================= */

.bg-danger,
.badge.bg-danger{

    background: #fee2e2 !important;

    color: #dc2626 !important;

    border-color: #fecaca !important;
}

/* =========================================================
   WARNING
========================================================= */

.bg-warning,
.badge.bg-warning{

    background: #fef3c7 !important;

    color: #d97706 !important;

    border-color: #fde68a !important;
}

/* =========================================================
   INFO
========================================================= */

.bg-info,
.badge.bg-info{

    background: #cffafe !important;

    color: #0891b2 !important;

    border-color: #a5f3fc !important;
}

/* =========================================================
   SECONDARY
========================================================= */

.bg-secondary,
.badge.bg-secondary{

    background: #e2e8f0 !important;

    color: #475569 !important;

    border-color: #cbd5e1 !important;
}

/* =========================================================
   LIGHT
========================================================= */

.bg-light,
.badge.bg-light{

    background: #f8fafc !important;

    color: #475569 !important;

    border-color: #e2e8f0 !important;
}



/* =========================================================
   SUBTLE VARIANTS
========================================================= */

.bg-success-subtle{

    background: #dcfce7 !important;

    color: #15803d !important;
}

.bg-danger-subtle{

    background: #fee2e2 !important;

    color: #dc2626 !important;
}

.bg-warning-subtle{

    background: #fef3c7 !important;

    color: #d97706 !important;
}

.bg-primary-subtle{

    background: #dbeafe !important;

    color: #2563eb !important;
}

.bg-info-subtle{

    background: #cffafe !important;

    color: #0891b2 !important;
}

/* =========================================================
   GLOBAL CRM FORM SYSTEM
========================================================= */
.crm-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crm-form-label {
  font-size: .90rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.crm-form-label.required::after {
  content: " *";
  color: var(--danger-color);
}

.crm-form-control,
.crm-form-select,
.crm-form-textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--white-color);
  color: var(--text-color);
  font-size: .95rem;
  transition: var(--transition);
  outline: none;
  box-shadow: none;
}

.crm-form-textarea {
  resize: vertical;
  min-height: 120px;
}

.crm-form-control:hover,
.crm-form-select:hover,
.crm-form-textarea:hover {
  border-color: none;
}

.crm-form-control:focus,
.crm-form-select:focus,
.crm-form-textarea:focus {
  border-color: none;
  box-shadow: none;
}

.crm-form-control::placeholder,
.crm-form-textarea::placeholder {
  color: var(--text-muted);
}

.crm-form-help {
  font-size: .80rem;
  color: var(--text-light);
  margin-top: 2px;
}

.crm-form-error {
  color: var(--danger-color);
  font-size: .80rem;
  font-weight: 500;
}

.crm-form-control.is-invalid,
.crm-form-select.is-invalid,
.crm-form-textarea.is-invalid {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .10);
}

.crm-form-control.is-valid,
.crm-form-select.is-valid,
.crm-form-textarea.is-valid {
  border-color: var(--success-color);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .10);
}

/* =========================================================
   PASSWORD GROUP
========================================================= */

.crm-input-group {
  position: relative;
}

.crm-input-group .crm-form-control {
  padding-right: 55px;
}

.crm-input-action {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-light);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.crm-input-action:hover {
  background: var(--primary-ultra-light);
  color: var(--primary-color);
}

/* =========================================================
   SWITCH
========================================================= */

.crm-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-switch input[type="checkbox"] {
  width: 48px;
  height: 26px;
  appearance: none;
  background: #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: .25s;
}

.crm-switch input[type="checkbox"]::before {
  content: "";
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: .25s;
}

.crm-switch input[type="checkbox"]:checked {
  background: var(--success-color);
}

.crm-switch input[type="checkbox"]:checked::before {
  left: 25px;
}

.crm-switch-label {
  font-weight: 600;
  color: var(--text-color);
}

/* =========================================================
   FORM CARD
========================================================= */

.crm-form-card {
  background: var(--white-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* =========================================================
   BUTTONS
========================================================= */

.crm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.crm-btn-primary {
  color: #fff;
  background: var(--primary-gradient);
}

.crm-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.crm-btn-secondary {
  background: var(--surface-soft);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.crm-btn-secondary:hover {
  background: var(--surface-muted);
}

/* Better Select Arrow */
.crm-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5 8 12l6.5-6.5' stroke='%2364748b' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 42px;
}

/* Filter Button */
#clearFiltersBtn {
    min-height: 52px;
}

/* =========================================================
   DASHBOARD LAYOUT FRAMEWORK
========================================================= */
.crm-app-layout {
    position: relative;
    display: flex;
    min-height: 100vh;
    background: var(--app-bg);
}

.crm-main-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 20px);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.crm-page-content {
    flex: 1;
    padding: 0 var(--content-padding) var(--content-padding);
}

.crm-dashboard-container {
    width: 100%;
    max-width: 100%;
}

/* =========================================================
   TOPBAR
========================================================= */
.crm-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 1040;
    height: var(--topbar-height);
    padding: 0 var(--content-padding);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-soft);
    transition: var(--transition);
}

.crm-topbar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.crm-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* =========================================================
   TOGGLE BUTTON
========================================================= */
.crm-mobile-toggle {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
    font-size: 22px;
}

.crm-mobile-toggle:hover {
    background: rgba(37, 99, 235, 0.14);
}

/* =========================================================
   SEARCH
========================================================= */
.crm-search-box {
    position: relative;
    width: 420px;
}

.crm-search-box i {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
}

.crm-search-box input {
    width: 100%;
    height: 54px;
    padding: 0 20px 0 50px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white-color);
    color: var(--text-color);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.crm-search-box input:focus {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

/* =========================================================
   NOTIFICATION / USER
========================================================= */
.crm-notification-btn,
.crm-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.crm-notification-btn {
    position: relative;
    width: 50px;
    height: 50px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--white-color);
    color: var(--text-color);
}

.crm-notification-btn:hover {
    background: var(--surface-muted);
}

.crm-notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white-color);
    border-radius: 50%;
    background: var(--danger-color);
    color: var(--white-color);
    font-size: 11px;
    font-weight: 700;
}

.crm-user-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.crm-user-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: var(--white-color);
    font-size: 18px;
    font-weight: 800;
}

.crm-user-meta h6 {
    margin: 0;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 700;
}

.crm-user-meta p {
    margin: 2px 0 0;
    color: var(--text-light);
    font-size: 12px;
}

.crm-logout-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: var(--radius-xs);
    background: var(--surface-muted);
    color: var(--text-light);
}

.crm-logout-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
}

/* =========================================================
   PAGE HEADER
========================================================= */
.crm-page-header {
    position: relative;
    overflow: hidden;
    margin-bottom: 28px;
    padding: 30px;
    background: var(--white-color);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
}

.crm-page-header::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    width: 100%;
    height: 5px;
    background: var(--primary-gradient);
}

.crm-page-title {
    margin: 0 0 8px;
    color: var(--text-color);
    font-size: 34px;
    font-weight: 800;
    line-height: 1.2;
}

.crm-page-subtitle {
    margin: 0;
    color: var(--text-light);
    font-size: 15px;
    font-weight: 500;
}

.crm-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.crm-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 700;
}

.crm-add-btn {
    height: 48px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary-gradient);
    color: var(--white-color);
    font-weight: 700;
}

.crm-add-btn:hover {
    transform: translateY(-2px);
}

.crm-secondary-btn {
     height: 48px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px;
    border: none;
    border-radius: var(--radius-sm);
     background: var(--primary-light, #eff6ff);
    color: var(--primary-color, #2563eb);
    font-weight: 700;
}

/* =========================================================
   DASHBOARD CARDS
========================================================= */
.dashboard-card,
.quick-action-card {
    background: var(--white-color);
    transition: var(--transition);
}

.dashboard-card {
    margin-bottom: 24px;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.dashboard-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(37, 99, 235, 0.06);
    color: var(--primary-color);
    font-size: 22px;
}

.quick-action-card {
    border: 1px solid var(--border-color) !important;
}

.quick-action-card:hover {
    background: var(--primary-gradient);
}

.quick-action-card:hover .fw-bold,
.quick-action-card:hover .text-muted {
    color: var(--white-color) !important;
}

.quick-action-card:hover .dashboard-icon {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white-color);
}

.dashboard-table thead th {
    padding: 16px;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.dashboard-table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--surface-soft);
    color: var(--text-color);
    font-size: 14px;
}

.mini-report-box {
    padding: 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* =========================================================
   SIDEBAR
========================================================= */

.crm-sidebar{
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;

    width: var(--sidebar-width);
    height: 100vh;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: var(--dark-gradient);

    border-right: 1px solid var(--border-dark-soft);

    transition: var(--transition);
}

/* =========================================================
   SIDEBAR TOP / FOOTER
========================================================= */

.crm-sidebar-top,
.crm-sidebar-footer{
    background: rgba(255,255,255,.02);
}

.crm-sidebar-top{
    padding: 24px 22px;

    border-bottom: 1px solid var(--border-dark-soft);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* =========================================================
   BRAND
========================================================= */

.crm-sidebar-brand{
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;

    text-decoration: none;
}

/* =========================================================
   LOGO ONLY MODE
========================================================= */

.crm-sidebar-logo-only{
    padding: 4px 0;
}

/* =========================================================
   DESKTOP LOGO
========================================================= */

.crm-sidebar-logo{
    width: 100%;
    max-width: 170px;

    height: auto;
    max-height: 52px;

    object-fit: contain;
    object-position: left center;

    display: block;
}

/* =========================================================
   MOBILE LOGO
========================================================= */

.crm-mobile-logo{
    width: 100%;
    max-width: 150px;

    height: auto;
    max-height: 40px;

    object-fit: contain;
    object-position: left center;

    display: block;
}

/* =========================================================
   FALLBACK BRAND ICON
========================================================= */

.crm-brand-icon{
    width: 54px;
    height: 54px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-md);

    background: var(--primary-gradient);

    color: var(--white-color);

    font-size: 22px;
}

/* =========================================================
   HIDE OLD BRAND TEXT
========================================================= */

.crm-brand-text{
    display: none;
}

/* =========================================================
   MOBILE SIDEBAR HEADER
========================================================= */

.crm-mobile-sidebar-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* =========================================================
   KEEP MOBILE LOGO LEFT
========================================================= */

.crm-mobile-sidebar-header .crm-sidebar-brand{
    justify-content: flex-start;
    width: auto;
    flex: 1;
}

/* =========================================================
   RESPONSIVE LOGO
========================================================= */

@media (max-width: 991.98px){

    .crm-sidebar-logo{
        width: 145px !important;
        height: 44px !important;
    }

    .crm-mobile-logo{
        width: 135px !important;
        height: 38px !important;
    }
}

/* =========================================================
   SIDEBAR BODY
========================================================= */

.crm-sidebar-body{
    flex: 1;

    overflow-x: hidden;
    overflow-y: auto;

    padding: 18px 14px 24px;

    scrollbar-width: thin;
}

/* =========================================================
   SIDEBAR MENU
========================================================= */

.crm-sidebar-menu,
.crm-sidebar-submenu{
    list-style: none;

    margin: 0;
    padding: 0;
}

.crm-sidebar-item{
    margin-bottom: 8px;
}

/* =========================================================
   MAIN MENU LINK
========================================================= */

.crm-sidebar-link{
    position: relative;

    width: 100%;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 14px 16px;

    border: none;
    outline: none;

    overflow: hidden;

    background: transparent;

    border-radius: var(--radius-lg);

    color: rgba(255,255,255,.74);

    text-decoration: none;

    transition: all .25s ease;

    cursor: pointer;
}

.crm-sidebar-link:hover{
    background: rgba(255,255,255,.06);

    color: var(--white-color);

    transform: translateX(2px);
}

.crm-sidebar-link.active{
    background: var(--primary-gradient);

    color: var(--white-color);
}

/* =========================================================
   MENU LEFT
========================================================= */

.crm-sidebar-link-left{
    display: flex;
    align-items: center;

    gap: 14px;

    flex: 1;

    min-width: 0;

    overflow: hidden;
}

/* =========================================================
   ICON
========================================================= */

.crm-sidebar-icon{
    width: 44px;
    height: 44px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-md);

    background: rgba(255,255,255,.08);

    font-size: 18px;
}

.crm-sidebar-link.active .crm-sidebar-icon{
    background: rgba(255,255,255,.12);
}

/* =========================================================
   MENU TEXT
========================================================= */

.crm-sidebar-link-text{
    flex: 1;

    min-width: 0;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    text-align: left;

    font-size: 15px;
    font-weight: 600;

    transition: var(--transition);
}

/* =========================================================
   DROPDOWN ARROW
========================================================= */

.crm-sidebar-arrow{
    margin-left: auto;

    flex-shrink: 0;

    font-size: 14px;

    transition: transform .25s ease;
}

.crm-sidebar-dropdown-btn[aria-expanded="true"]
.crm-sidebar-arrow{
    transform: rotate(180deg);
}

/* =========================================================
   SUBMENU WRAPPER
========================================================= */

.crm-sidebar-submenu-wrapper{
    overflow: hidden;

    transition: all .25s ease;
}

/* =========================================================
   SUBMENU
========================================================= */

.crm-sidebar-submenu{
    position: relative;

    margin-top: 8px;
    margin-left: 22px;

    padding-left: 22px;
    padding-bottom: 8px;

    border-left: 1px dashed rgba(255,255,255,.10);

    display: flex;
    flex-direction: column;

    gap: 6px;
}

/* =========================================================
   SUBMENU LINK
========================================================= */

.crm-sidebar-sublink{
    position: relative;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 11px 14px;

    border-radius: var(--radius-md);

    color: rgba(255,255,255,.66);

    text-decoration: none;

    font-size: 13px;
    font-weight: 600;

    transition: all .2s ease;
}

.crm-sidebar-sublink:hover{
    background: rgba(255,255,255,.06);

    color: var(--white-color);

    transform: translateX(2px);
}

.crm-sidebar-sublink.active{
    background: linear-gradient(
        135deg,
        rgba(59,130,246,.22),
        rgba(99,102,241,.16)
    );

    color: #fff;

    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,.04);
}

.crm-sidebar-sublink i{
    font-size: 14px;

    min-width: 16px;
}

/* =========================================================
   SIDEBAR FOOTER
========================================================= */

.crm-sidebar-footer{
    padding: 18px;

    border-top: 1px solid var(--border-dark-soft);
}

/* =========================================================
   PLAN CARD
========================================================= */

.crm-sidebar-plan{
    display: flex;
    align-items: center;

    gap: 14px;

    padding: 18px;

    border: 1px solid rgba(255,255,255,.05);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.crm-sidebar-plan-icon{
    width: 52px;
    height: 52px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-md);

    background: var(--primary-gradient);

    color: var(--white-color);

    font-size: 22px;
}

.crm-sidebar-plan-text{
    flex: 1;
    min-width: 0;
}

.crm-sidebar-plan-text h6{
    margin: 0;

    color: var(--white-color);

    font-size: 15px;
    font-weight: 700;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================================
   PLAN META
========================================================= */

.crm-sidebar-plan-meta{
    margin-top: 6px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;
}

.crm-sidebar-plan-status{
    color: rgba(255,255,255,.58);

    font-size: 12px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================================
   RENEW BUTTON
========================================================= */

.crm-renew-btn{
    border: none;
    outline: none;

    flex-shrink: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 6px 12px;

    border-radius: 999px;

    background: rgba(59,130,246,.15);

    color: #60a5fa;

    font-size: 11px;
    font-weight: 600;

    line-height: 1;

    cursor: pointer;

    transition: all .25s ease;
}

.crm-renew-btn:hover{
    background: var(--primary-gradient);

    color: #fff;

    transform: translateY(-1px);
}

.crm-renew-btn:focus{
    box-shadow: none;
}

.crm-renew-btn i{
    font-size: 12px;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 576px){

    .crm-sidebar-plan-meta{
        flex-wrap: wrap;
        gap: 8px;
    }

    .crm-renew-btn{
        width: 100%;
        justify-content: center;
    }
}
/* =========================================================
   RENEW PLAN CARD
========================================================= */

.renew-plan-card{
    padding: 18px;

    border-radius: 14px;

    background: #f8fafc;

    border: 1px solid #e2e8f0;

    margin-bottom: 24px;
}

.renew-plan-header{
    display:flex;
    justify-content:space-between;
    align-items:center;

    margin-bottom:15px;
}

.renew-plan-badge{
    padding:4px 10px;

    border-radius:999px;

    background:#dcfce7;

    color:#15803d;

    font-size:12px;
    font-weight:600;
}

.renew-plan-details{
    display:grid;

    grid-template-columns:1fr 1fr;

    gap:16px;
}

.renew-plan-details small{
    display:block;

    color:#64748b;
}

.renew-plan-details strong{
    color:#0f172a;
}

/* =========================================================
   BILLING CYCLE
========================================================= */

.renew-cycle-grid{
    display:grid;

    grid-template-columns:repeat(2,1fr);

    gap:14px;
}

.renew-cycle-card{
    position:relative;

    border:2px solid #e2e8f0;

    border-radius:14px;

    padding:18px;

    cursor:pointer;

    transition:.25s;
}

.renew-cycle-card:hover{
    border-color:#3b82f6;
}

.renew-cycle-card input{
    margin-bottom:12px;
}

.renew-cycle-card strong{
    display:block;

    margin-top:8px;

    color:#2563eb;
}

/* =========================================================
   BILLING SUMMARY
========================================================= */

.renew-summary-card{
    padding:20px;

    border-radius:14px;

    background:#f8fafc;

    border:1px solid #e2e8f0;
}

.renew-summary-row{
    display:flex;

    justify-content:space-between;

    margin-bottom:10px;
}

.renew-summary-total{
    display:flex;

    justify-content:space-between;

    align-items:center;

    font-size:18px;
}
/* =========================================================
   MOBILE SIDEBAR
========================================================= */

.crm-mobile-sidebar{
    width: 340px !important;

    max-width: 92vw;

    background: var(--dark-gradient);

    border-right: 1px solid var(--border-dark-soft);

    color: var(--white-color);
}

.crm-mobile-sidebar .offcanvas-header{
    padding: 22px 20px;

    border-bottom: 1px solid rgba(255,255,255,.08);
}

.crm-mobile-sidebar .offcanvas-body{
    padding: 18px 14px 24px;

    overflow-y: auto;
    overflow-x: hidden;
}

.crm-mobile-sidebar .btn-close{
    filter: invert(1);

    opacity: 1;
}

.crm-mobile-logo{
    width: 52px;
    height: 52px;

    object-fit: contain;
}

/* =========================================================
   MOBILE TOGGLE
========================================================= */

.crm-mobile-toggle{
    position: relative;

    z-index: 1060;

    flex-shrink: 0;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 991px){

    .crm-topbar-inner{
        gap: 12px;
    }

    .crm-topbar-right{
        margin-left: auto;
    }

    .crm-user-box{
        padding: 6px 10px;
    }

    .crm-user-avatar{
        width: 42px;
        height: 42px;

        font-size: 16px;
    }
}

/* =========================================================
   COLLAPSED SIDEBAR
========================================================= */

@media (min-width: 992px){

    body.toggled .crm-sidebar{
        width: var(--sidebar-collapsed-width);
    }

    body.toggled .crm-main-wrapper{
        margin-left: var(--sidebar-collapsed-width);
    }

    body.toggled .crm-topbar{
        left: var(--sidebar-collapsed-width);
    }

    body.toggled .crm-brand-text,
    body.toggled .crm-sidebar-link-text,
    body.toggled .crm-sidebar-arrow,
    body.toggled .crm-sidebar-plan-text,
    body.toggled .crm-sidebar-submenu-wrapper{
        display: none !important;
    }

    body.toggled .crm-sidebar-plan{
        justify-content: center;

        padding: 12px;
    }

    body.toggled .crm-sidebar-link{
        justify-content: center;
    }

    body.toggled .crm-sidebar-link-left{
        justify-content: center;
    }
}
/* =========================================================
   FOOTER
========================================================= */
.crm-footer {
    width: 100%;
    margin-top: auto;
    padding: 26px var(--content-padding);
    background: var(--dark-gradient);
    border-top: 1px solid var(--border-dark-soft);
}

.crm-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
}

.crm-footer-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.crm-footer-copy,
.crm-footer-credit {
    margin: 0;
    color: rgba(255, 255, 255, 0.74);
    font-size: 14px;
    font-weight: 500;
}

.crm-footer-credit a {
    color: var(--primary-soft);
    font-weight: 700;
    text-decoration: none;
}

.crm-footer-credit a:hover {
    color: #93c5fd;
}

.crm-footer-divider {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.30);
}

.crm-footer-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.crm-footer-version {
    white-space: nowrap;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.45) !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 1199px) {
    .crm-search-box {
        width: 320px;
    }
}

@media (max-width: 991px) {
    .crm-sidebar {
        left: calc(-1 * var(--sidebar-width));
    }

    body.toggled .crm-sidebar {
        left: 0;
        display: flex !important;
    }

    .crm-topbar {
        left: 0;
        padding: 0 var(--content-padding-md);
    }

    .crm-main-wrapper {
        margin-left: 0;
        padding-top: calc(var(--topbar-height) + 14px);
    }

    .crm-page-content {
        padding: 0 var(--content-padding-md) var(--content-padding-md);
    }

    .crm-search-box {
        display: none;
    }

    .crm-page-title {
        font-size: 28px;
    }

    .crm-footer {
        padding: 24px var(--content-padding-md);
    }

    .crm-footer-inner {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        text-align: center;
    }

    .crm-footer-left {
        justify-content: center;
        text-align: center;
    }

    .crm-footer-right {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 576px) {
    :root {
        --topbar-height: 74px;
    }

    .crm-topbar {
        padding: 0 var(--content-padding-sm);
    }

    .crm-page-content {
        padding: 0 var(--content-padding-sm) var(--content-padding-sm);
    }

    .crm-user-meta {
        display: none;
    }

    .crm-page-title {
        font-size: 24px;
    }

    .crm-footer {
        padding: 22px var(--content-padding-sm);
    }

    .crm-footer-left {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .crm-footer-divider {
        display: none;
    }

    .crm-footer-right {
        align-items: center;
        justify-content: center;
    }

    .crm-footer-copy,
    .crm-footer-credit,
    .crm-footer-version {
        text-align: center;
    }
}

/* =========================================================
   ANIMATION
========================================================= */
@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.spin-animation {
    display: inline-block;
    animation: spin .8s linear infinite;
}

/* =========================================================
   CRM APP LAYOUT CONFIG
========================================================= */

.crm-app-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

.crm-main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.crm-page-content {
    flex: 1;
    padding: 32px;
}

.crm-dashboard-container {
    width: 100%;
}

/* =========================================================
   PAGE HEADER
========================================================= */

.crm-page-header {
    margin-bottom: 32px;
}

.crm-page-title {
    margin: 0 0 6px;
    font-size: 32px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--text-color);
}

.crm-page-subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-light);
}

.crm-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.crm-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 14px;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: #2563eb;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.crm-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 22px;
    border: none;
    border-radius: 14px;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.crm-add-btn:hover {
    transform: translateY(-2px);
}

/* =========================================================
   RIGHT SIDEBAR & QUICKLINKS
========================================================= */

.crm-dashboard-sidebar {
    position: sticky;
    top: 32px;
}

.crm-dashboard-sidebar-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border-radius: 28px;
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.crm-dashboard-sidebar-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.crm-dashboard-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.crm-dashboard-sidebar-header h5 {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 800;
    color: var(--text-color);
}

.crm-dashboard-sidebar-header p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-light);
}

.crm-dashboard-sidebar-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(37,99,235,.08);
    color: #2563eb;
    font-size: 20px;
}

.crm-dashboard-quicklinks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.crm-quick-action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--border-color);
    text-decoration: none !important;
    transition: var(--transition);
}

.crm-quick-action:hover {
    transform: translateX(4px);
    border-color: #dbeafe;
    background: #f8fbff;
    box-shadow: var(--shadow-sm);
}

.crm-quick-action-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #f8fafc;
    color: #64748b;
    font-size: 18px;
    transition: var(--transition);
}

.crm-quick-action:hover .crm-quick-action-icon {
    background: #eff6ff;
    color: #2563eb;
}

.crm-quick-action-content {
    flex: 1;
    min-width: 0;
}

.crm-quick-action-content h6 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
}

.crm-quick-action-content span {
    font-size: 12px;
    color: var(--text-light);
}

.crm-quick-action-arrow {
    margin-left: auto;
    font-size: 18px;
    color: #94a3b8;
}

/* =========================================================
   COMMON WIDGET BASE STYLES
========================================================= */

.crm-stat-widget,
.crm-chart-widget,
.crm-report-widget,
.crm-table-widget-card {
    position: relative;
    overflow: hidden;
    height: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 34px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.crm-stat-widget::before,
.crm-chart-widget::before,
.crm-report-widget::before,
.crm-table-widget-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    width: 100%;
    height: 4px;
}

/* Accent Borders */
.crm-stat-widget::before { background: var(--primary-gradient); }
.crm-chart-widget::before { background: linear-gradient(90deg, #2563eb, #38bdf8); }
.crm-report-widget::before { background: linear-gradient(90deg, #0f172a, #334155); }
.crm-table-widget-card::before { background: linear-gradient(90deg, #64748b, #94a3b8); }

/* Hover Animations */
.crm-stat-widget:hover,
.crm-chart-widget:hover,
.crm-report-widget:hover,
.crm-table-widget-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* =========================================================
   STAT WIDGET COMPONENTS
========================================================= */

.crm-stat-widget-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.crm-widget-label {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

.crm-widget-number {
    margin: 0;
    font-size: 34px;
    line-height: 1;
    font-weight: 800;
    color: var(--text-color);
}

.dashboard-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 22px;
    transition: var(--transition);
}

.crm-stat-widget:hover .dashboard-icon,
.crm-chart-widget:hover .dashboard-icon,
.crm-report-widget:hover .dashboard-icon {
    background: rgba(37,99,235,.08);
    color: #2563eb;
}

/* =========================================================
   WIDGET HEADER
========================================================= */

.crm-widget-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.crm-widget-header h6 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 800;
    color: var(--text-color);
}

.crm-widget-header p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-light);
}

.crm-widget-refresh {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: var(--transition);
}

.crm-widget-refresh:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* =========================================================
   CHART WIDGET COMPONENTS
========================================================= */

.crm-chart-widget-body {
    position: relative;
    width: 100%;
    height: 340px;
    min-height: 340px;
}

/* =========================================================
   REPORT WIDGET COMPONENTS
========================================================= */

.crm-report-number {
    margin: 18px 0 14px;
    font-size: 40px;
    line-height: 1;
    font-weight: 800;
    color: var(--text-color);
}

.crm-report-growth {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.crm-growth-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: 12px;
    font-weight: 700;
}

.crm-growth-text {
    font-size: 12px;
    color: var(--text-light);
}

.dashboard-progress {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.dashboard-progress .progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
}

/* =========================================================
   TABLES COMPONENTS
========================================================= */

.crm-table-body-wrapper {
    width: 100%;
    margin-top: 16px;
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table thead th {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

.dashboard-table tbody td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-color);
    font-size: 14px;
    white-space: nowrap;
}

/* =========================================================
   EMPTY DASHBOARD STATE
========================================================= */

.crm-empty-dashboard {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crm-empty-dashboard-content {
    max-width: 620px;
    padding: 60px 40px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 32px;
    box-shadow: var(--shadow-sm);
}

.crm-empty-dashboard-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 28px;
    background: rgba(37,99,235,.08);
    color: #2563eb;
    font-size: 42px;
}

.crm-empty-dashboard-content h3 {
    margin-bottom: 16px;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-color);
}

.crm-empty-dashboard-content p {
    margin-bottom: 30px;
    line-height: 1.9;
    color: var(--text-light);
}

.crm-empty-dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    padding: 0 26px;
    border-radius: 18px;
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.crm-empty-dashboard-btn:hover {
    transform: translateY(-2px);
    color: #fff;
}

/* =========================================================
   RESPONSIVE MEDIA QUERIES (BOOTSTRAP ALIGNED)
========================================================= */

@media (max-width: 1400px) {
    .crm-dashboard-sidebar {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .crm-page-content {
        padding: 18px;
    }

    .crm-page-title {
        font-size: 24px;
    }

    .crm-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .crm-plan-badge,
    .crm-add-btn {
        width: 100%;
        justify-content: center;
    }

    /* REORDER STAT CARDS ON MOBILE */
    .crm-stat-widget-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    /* Target the text wrapper div to allow column tracking */
    .crm-stat-widget-content > div:not(.dashboard-icon) {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Icon on top */
    .crm-stat-widget-content .dashboard-icon {
        order: 1;
    }

    /* Text wrapper section below icon */
    .crm-stat-widget-content > div:not(.dashboard-icon) {
        order: 2;
    }

    /* Center Number in middle */
    .crm-widget-number {
        order: 1;
        font-size: 28px;
        margin-bottom: 6px;
    }

    /* Title at the bottom */
    .crm-widget-label {
        order: 2;
        margin: 0;
    }

    .crm-stat-widget,
    .crm-chart-widget,
    .crm-report-widget,
    .crm-table-widget-card,
    .crm-dashboard-sidebar-card {
        padding: 20px;
        border-radius: 24px;
    }

    .crm-chart-widget-body {
        height: 280px;
        min-height: 280px;
    }

    .crm-report-number {
        font-size: 34px;
    }
}

/* =========================================================
   ENTERPRISE ACCESS CONTROL - CLEAN FINAL CSS
========================================================= */

/* =========================================================
   ACCESS SUMMARY CARDS
========================================================= */

.crm-access-card{

    position:relative;

    background:#ffffff;

    border:1px solid #e2e8f0;

    border-radius:24px;

    padding:26px;

    display:flex;

    align-items:center;

    gap:20px;

    min-height:130px;

    overflow:hidden;

    box-shadow:
        0 10px 30px rgba(15,23,42,0.04);

    transition:
        transform .25s ease,
        box-shadow .25s ease,
        border-color .25s ease;
}

.crm-access-card:hover{

    transform:translateY(-4px);

    border-color:#cbd5e1;

    box-shadow:
        0 18px 45px rgba(15,23,42,0.08);
}

/* =========================================================
   CARD ICON
========================================================= */

.crm-access-card-icon{

    width:68px;
    height:68px;

    min-width:68px;

    border-radius:20px;

    display:flex;

    align-items:center;

    justify-content:center;

    font-size:28px;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.4);
}

/* =========================================================
   CARD CONTENT
========================================================= */

.crm-access-card h3{

    margin:0 0 6px;

    font-size:2rem;

    font-weight:800;

    line-height:1;

    color:#0f172a;
}

.crm-access-card p{

    margin:0;

    color:#64748b;

    font-size:.94rem;

    font-weight:500;
}

/* =========================================================
   PANELS / DATA CARDS
========================================================= */

.crm-access-panel,
.crm-data-card,
.crm-module-card,
.crm-plan-card{

    background:#ffffff;

    border:1px solid #e2e8f0;

    border-radius:24px;

    overflow:hidden;

    box-shadow:
        0 10px 35px rgba(15,23,42,0.04);
}

.crm-data-card{

    padding:0;
}

/* =========================================================
   DATA CARD HEADER
========================================================= */

.crm-data-card-header{

    padding:24px 28px 0;
}

.crm-data-card-header h5{

    margin-bottom:6px;

    font-size:1.05rem;

    font-weight:700;

    color:#0f172a;
}

.crm-data-card-header p{

    margin:0;

    color:#64748b;

    font-size:.92rem;
}

/* =========================================================
   NAV TABS
========================================================= */

.crm-access-tabs{

    background:#ffffff;

    border:1px solid #e2e8f0;

    border-radius:20px;

    padding:10px;

    display:flex;

    align-items:center;

    gap:10px;

    flex-wrap:wrap;

    overflow:hidden;

}

.crm-access-tabs .nav-item{

    flex:0 0 auto;
}

.crm-access-tabs .nav-link{

    border:none;

    background:transparent;

    color:#475569;

    border-radius:14px;

    padding:12px 18px;

    display:inline-flex;

    align-items:center;

    justify-content:center;

    gap:8px;

    font-size:.92rem;

    font-weight:600;

    white-space:nowrap;

    transition:all .25s ease;
}

.crm-access-tabs .nav-link i{

    font-size:1rem;

    line-height:1;
}

.crm-access-tabs .nav-link:hover{

    background:#eff6ff;

    color:#2563eb;
}

.crm-access-tabs .nav-link.active{

    background:#0f172a !important;

    color:#ffffff !important;

}


/* =========================================================
   ROLE / MODULE ICON
========================================================= */

.crm-role-icon,
.crm-module-icon{

    width:48px;
    height:48px;

    min-width:48px;

    border-radius:16px;

    display:flex;

    align-items:center;

    justify-content:center;

    background:#eff6ff;

    color:#2563eb;

    font-size:20px;
}

/* =========================================================
   MODULE / PLAN CARDS
========================================================= */

.crm-module-card,
.crm-plan-card{

    padding:24px;
}

.crm-module-card-top,
.crm-plan-card-header{

    display:flex;

    align-items:center;

    justify-content:space-between;

    gap:15px;

    margin-bottom:20px;
}

.crm-module-card h5,
.crm-plan-card h4{

    margin-bottom:8px;

    font-weight:700;

    color:#0f172a;
}

.crm-module-card p,
.crm-plan-card p{

    margin:0;

    color:#64748b;
}

/* =========================================================
   PLAN PRICE
========================================================= */

.crm-plan-price{

    margin-bottom:20px;

    font-size:2.3rem;

    font-weight:800;

    color:#0f172a;
}

.crm-plan-price small{

    font-size:.9rem;

    color:#64748b;
}

/* =========================================================
   MODULE CHECK
========================================================= */

.crm-module-check{

    display:block;

    cursor:pointer;
}

.crm-module-check input{

    display:none;
}

.crm-module-check-card{

    background:#ffffff;

    border:1px solid #e2e8f0;

    border-radius:20px;

    padding:20px;

    display:flex;

    align-items:center;

    gap:15px;

    transition:all .25s ease;
}

.crm-module-check-card:hover{

    border-color:#bfdbfe;

    background:#f8fbff;
}

.crm-module-check-card i{

    font-size:24px;

    color:#2563eb;
}

.crm-module-check input:checked + .crm-module-check-card{

    background:#eff6ff;

    border-color:#2563eb;

    box-shadow:
        0 8px 24px rgba(37,99,235,0.12);
}

/* =========================================================
   DATATABLE WRAPPER
========================================================= */

.dataTables_wrapper{
    width:100%;
}

.crm-data-card .table-responsive,
.dataTables_wrapper{

    overflow-x:auto;

    overflow-y:hidden;

    -webkit-overflow-scrolling:touch;
}

/* =========================================================
   TOP TOOLBAR
========================================================= */

.crm-dt-length{

    display:flex;

    align-items:center;

    justify-content:flex-start;
}

.crm-dt-buttons{

    display:flex;

    align-items:center;

    justify-content:flex-end;

    gap:10px;

    flex-wrap:wrap;
}

.crm-dt-search{

    display:flex;

    justify-content:flex-end;
}

.dataTables_length label,
.dataTables_filter label{

    margin:0;

    width:100%;
}

.dataTables_length select{

    min-width:90px;

    height:42px;

    border:1px solid #dbe2ea !important;

    border-radius:12px !important;

    padding:0 12px !important;

    box-shadow:none !important;
}

.dataTables_filter input{

    width:280px !important;

    max-width:100%;

    height:44px;

    border:1px solid #dbe2ea !important;

    border-radius:14px !important;

    padding:0 16px !important;

    box-shadow:none !important;
}



/* =========================================================
   TABLE
========================================================= */

table.dataTable{

    width:100% !important;

    border-collapse:separate !important;

    border-spacing:0 !important;
}

table.dataTable thead th{

    background:#f8fafc;

    color:#64748b;

    font-size:.78rem;

    font-weight:700;

    text-transform:uppercase;

    letter-spacing:.4px;

    padding:18px 22px;

    white-space:nowrap;
}

table.dataTable tbody td{

    padding:18px 22px;

    vertical-align:middle;

    white-space:nowrap;
}

table.dataTable tbody tr:hover{

    background:#f8fafc;
}

/* =========================================================
   PAGINATION
========================================================= */

.dataTables_paginate{

    display:flex;

    justify-content:flex-end;

    gap:4px;
}

.paginate_button{

    border-radius:12px !important;
}

.paginate_button.current{

    background:#2563eb !important;

    color:#fff !important;

    border:none !important;
}

/* =========================================================
   CUSTOM SCROLLBAR
========================================================= */

.dataTables_wrapper::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar{

    height:8px;
}

.dataTables_wrapper::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track{

    background:#f1f5f9;

    border-radius:10px;
}

.dataTables_wrapper::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb{

    background:#cbd5e1;

    border-radius:10px;
}

.dataTables_wrapper::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover{

    background:#94a3b8;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width:991px){

    .crm-dt-length,
    .crm-dt-buttons,
    .crm-dt-search{

        width:100%;

        justify-content:center !important;
    }

    .crm-dt-search{

        margin-top:10px;
    }

    .dataTables_filter input{

        width:100% !important;

        min-width:100% !important;
    }

    .dt-buttons{

        width:100%;

        justify-content:center;
    }

    .dt-buttons .btn{

        flex:1 1 calc(50% - 10px);

        min-width:130px;
    }

    .dataTables_info{

        text-align:center;

        margin-bottom:10px;
    }

    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .pagination{
    
        display:flex !important;
    
        justify-content:center !important;
    
        width:100%;
    }

    .dataTables_scroll{

        overflow:hidden;
    }
    
    .dataTables_scrollBody{
    
        overflow-x:auto !important;
    
        overflow-y:hidden !important;
    }

    table.dataTable{

        min-width:max-content !important;
    }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width:576px){

    .crm-access-tabs{

        padding:8px;
    }

    .crm-access-tabs .nav-link{

        padding:10px 14px;

        font-size:.85rem;
    }

    .crm-access-card{

        gap:16px;
    }

    .crm-role-icon,
    .crm-module-icon{

        width:42px;
        height:42px;

        min-width:42px;

        font-size:18px;
    }

}
/* =========================================================
   BOOTSTRAP MODAL BODY SHIFT FIX
========================================================= */

body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}


/* =========================================================
   ENTERPRISE MODAL SCROLL FIX
========================================================= */

.modal-dialog {
    margin: 1rem auto;
}

.modal-dialog.modal-xl {
    max-width: 1400px;
}

.modal-content {
    max-height: 90vh;
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

.modal-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
}

.modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(90vh - 130px);
    padding: 1.25rem;
}

.modal-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: #fff;
    border-top: 1px solid #dee2e6;
}

/* =========================================================
   MODAL SCROLLBAR
========================================================= */

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent!important;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6)!important;
    border-radius: 999px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.9)!important;
}


/* =========================================================
   PREVENT BACKDROP SCROLL ISSUES
========================================================= */

.modal {
    overflow: hidden !important;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 768px) {

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        height: 95vh;
        max-height: 95vh;
    }

    .modal-body {
        max-height: calc(95vh - 130px);
    }
}


/* USER VIEW PROFILE */

.crm-user-profile{
    display:flex;
    align-items:center;
    gap:20px;
    margin-bottom:24px;
    padding-bottom:24px;
    border-bottom:1px solid var(--border-color);
}


.crm-user-name{
    margin:0;
    font-size:1.35rem;
    font-weight:700;
    color:var(--text-color);
}

.crm-user-email{
    margin:4px 0 0;
    color:var(--text-light);
}

.crm-info-grid{
    display:grid;
    grid-template-columns:160px 1fr;
    gap:14px 20px;
}

.crm-info-label{
    color:var(--text-light);
    font-size:.90rem;
    font-weight:600;
}

.crm-info-value{
    color:var(--text-color);
    font-weight:600;
}

@media(max-width:768px){

    .crm-info-grid{
        grid-template-columns:1fr;
        gap:6px;
    }

    .crm-info-value{
        margin-bottom:12px;
    }
}