/***********************************************************
 * Swastikaa Infra Broker CRM — Main Stylesheet
 * Integrates template theme with CRM-specific components
 ***********************************************************/

/* ─── CSS Variables ──────────────────────────────────── */
:root {
    --primary:        #009CFF;
    --primary-dark:   #007ACC;
    --primary-soft:   rgba(0, 156, 255, .12);
    --light:          #F3F6F9;
    --dark:           #191C24;
    --sidebar-bg:     #191C24;
    --sidebar-w:      250px;
    --topbar-h:       60px;
    --color-success:  #28a745;
    --color-danger:   #dc3545;
    --color-warning:  #ffc107;
    --color-info:     #17a2b8;
    --color-muted:    #6c757d;
    --font:           'DM Sans', sans-serif;
    --transition:     0.3s ease;
    --radius:         10px;
    --shadow:         0 2px 12px rgba(0, 0, 0, .08);
    --shadow-card:    0 1px 6px rgba(0, 0, 0, .07);
}


/* ─── Global Reset ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--light);
    color: var(--dark);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

a { text-decoration: none; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; }


/* ─── Spinner (page load) ────────────────────────────── */
#spinner {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
    pointer-events: all;
}


/* ─── Back to Top ────────────────────────────────────── */
.back-to-top {
    position: fixed;
    display: none;
    right: 30px;
    bottom: 30px;
    z-index: 99;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 156, 255, .4);
    transition: var(--transition);
}

.back-to-top:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-2px);
}


/* ─── Layout Wrappers ────────────────────────────────── */
.crm-wrapper,
.app-wrapper {
    display: flex;
    min-height: 100vh;
}


/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--sidebar-bg);
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
    border-radius: 2px;
}


/* ─── Sidebar Brand ──────────────────────────────────── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    text-decoration: none;
    flex-shrink: 0;
}

/* admin uses .sidebar-brand-icon; broker uses .brand-icon */
.sidebar-brand-icon,
.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* admin uses .sidebar-brand-text; broker uses .brand-text */
.sidebar-brand-text,
.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-name {
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.brand-sub {
    color: rgba(255, 255, 255, .4);
    font-size: 10.5px;
    white-space: nowrap;
}


/* ─── Sidebar Nav ────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 10px 0 16px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    padding: 14px 18px 4px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .28);
}

/* Override Bootstrap .nav-link inside sidebar */
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: rgba(255, 255, 255, .62) !important;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    margin: 1px 8px 1px 0;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
    text-decoration: none;
    position: relative;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, .08);
    border-left-color: var(--primary);
}

/* nav-icon: broker uses <i class="nav-icon">; admin uses <span class="nav-icon"> */
.nav-icon {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-block;
    font-style: normal;
}

.nav-label { flex: 1; }

.nav-badge {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}


/* ─── Sidebar Footer (admin) ─────────────────────────── */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}

/* Admin uses .sidebar-user; broker uses .user-info */
.sidebar-user,
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Admin uses .sidebar-user-avatar; broker uses .user-avatar */
.sidebar-user-avatar,
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; }

/* Admin uses .sidebar-user-name; broker uses .user-name */
.sidebar-user-name,
.user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Admin uses .sidebar-user-role; broker uses .user-role */
.sidebar-user-role,
.user-role {
    color: rgba(255, 255, 255, .38);
    font-size: 11px;
}


/* ─── Sidebar Backdrop (mobile) ──────────────────────── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.show { display: block; }


/* ─── Main Content ───────────────────────────────────── */
.main-content,
.content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    background: var(--light);
    transition: margin-left var(--transition);
    display: flex;
    flex-direction: column;
}


/* ─── Topbar ─────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 10px;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
    flex-shrink: 0;
}

/* Both admin (.topbar-toggle) and broker (.sidebar-toggle) trigger */
.topbar-toggle,
.sidebar-toggle {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--dark);
    font-size: 18px;
    transition: var(--transition);
    padding: 0;
}

.topbar-toggle:hover,
.sidebar-toggle:hover {
    background: var(--primary);
    color: #fff;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-muted);
}

.topbar-breadcrumb .sep { color: #ccc; }
.topbar-breadcrumb .current { color: var(--dark); font-weight: 600; }

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Admin topbar buttons */
.topbar-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--light);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--dark);
    text-decoration: none;
    position: relative;
    font-size: 13px;
    transition: var(--transition);
    padding: 0;
}

.topbar-btn:hover { background: var(--primary); color: #fff; }

.topbar-notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-danger);
    border: 2px solid #fff;
}

.topbar-notif-dot.d-none { display: none !important; }

/* Broker topbar notification icon button */
.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--light);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--dark);
    text-decoration: none;
    position: relative;
    font-size: 15px;
    transition: var(--transition);
}

.btn-icon:hover { background: var(--primary); color: #fff; }

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 9px;
    min-width: 14px;
    height: 14px;
    line-height: 14px;
    padding: 0 3px;
    border-radius: 10px;
}


/* ─── Page Content ───────────────────────────────────── */
.page-content {
    padding: 24px;
    flex: 1;
}


/* ─── Page Header ────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}


/* ─── CRM Card ───────────────────────────────────────── */
.crm-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, .05);
    overflow: hidden;
}

.crm-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
}

.crm-card-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.crm-card-body { padding: 20px; }


/* ─── Stat / KPI Cards ───────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, .05);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.bg-primary-soft { background: rgba(0, 156, 255, .12); }
.stat-icon.bg-success-soft { background: rgba(40, 167, 69, .12); }
.stat-icon.bg-warning-soft { background: rgba(255, 193, 7, .15); }
.stat-icon.bg-danger-soft  { background: rgba(220, 53, 69, .12); }

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 4px;
}


/* ─── Alerts (CRM styled) ────────────────────────────── */
.alert-crm {
    border-radius: var(--radius);
    border: none;
    padding: 12px 16px;
    font-size: 13.5px;
}


/* ─── Buttons ────────────────────────────────────────── */
.btn {
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 18px;
}

.btn.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn.btn-primary:hover,
.btn.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-square,
.btn-sm-square,
.btn-lg-square {
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
    border-radius: 50px;
}

.btn-sm-square { width: 32px; height: 32px; }
.btn-square    { width: 38px; height: 38px; }
.btn-lg-square { width: 48px; height: 48px; }


/* ─── Form Controls ──────────────────────────────────── */
.form-control,
.form-select {
    font-size: 13.5px;
    border-radius: 8px;
    border-color: #e0e4ea;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 156, 255, .15);
}

.form-label {
    font-size: 12.5px;
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
}


/* ─── Tables ─────────────────────────────────────────── */
.table { font-size: 13.5px; }

.table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
    border-bottom-width: 1px;
    white-space: nowrap;
}

/* ─── CRM Table ──────────────────────────────────────── */
.crm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.crm-table thead tr {
    background: var(--light);
    border-bottom: 2px solid var(--card-border);
}

.crm-table thead th {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
    white-space: nowrap;
    text-align: left;
}

.crm-table tbody tr {
    border-bottom: 1px solid var(--card-border);
    transition: background var(--transition);
}

.crm-table tbody tr:last-child { border-bottom: none; }

.crm-table tbody tr:hover { background: rgba(0, 156, 255, .03); }

.crm-table tbody td {
    padding: 11px 14px;
    vertical-align: middle;
    color: var(--dark);
    font-size: 13.5px;
}

.crm-table tbody td.text-muted { color: var(--color-muted) !important; }

/* Bootstrap helper row colours inside crm-table */
.crm-table tr.table-success td { background: rgba(40, 167, 69, .06); }
.crm-table tr.table-warning td { background: rgba(255, 193, 7, .08); }
.crm-table tr.table-secondary td { background: rgba(108, 117, 125, .06); }


/* ─── Status Chips ───────────────────────────────────── */
.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
    background: rgba(108, 117, 125, .12);
    color: #6c757d;
}

/* Broker / booking statuses */
.status-chip.status-active,
.status-chip.status-registered    { background: rgba(40, 167, 69, .12);  color: #16a34a; }
.status-chip.status-pending,
.status-chip.status-token_paid    { background: rgba(255, 193, 7, .15);  color: #b45309; }
.status-chip.status-blocked       { background: rgba(201, 146, 46, .14); color: #c9922e; }
.status-chip.status-cancelled     { background: rgba(220, 53, 69, .12);  color: #dc3545; }
.status-chip.status-agreement_signed { background: rgba(14, 165, 233, .12); color: #0ea5e9; }
.status-chip.status-paid          { background: rgba(40, 167, 69, .12);  color: #16a34a; }
.status-chip.status-pending_verification { background: rgba(255, 193, 7, .15); color: #b45309; }
.status-chip.status-open          { background: rgba(220, 53, 69, .12);  color: #dc3545; }
.status-chip.status-in_progress   { background: rgba(14, 165, 233, .12); color: #0ea5e9; }
.status-chip.status-resolved,
.status-chip.status-closed        { background: rgba(40, 167, 69, .12);  color: #16a34a; }


/* ─── Utility ────────────────────────────────────────── */
.fw-600 { font-weight: 600; }
.text-primary { color: var(--primary) !important; }
.bg-primary   { background-color: var(--primary) !important; }


/* ─── Sidebar Collapsed — Desktop ────────────────────── */
@media (min-width: 992px) {
    .sidebar.collapsed {
        width: 0;
        overflow: hidden;
    }

    /* When sidebar collapses, expand main content (general sibling) */
    .sidebar.collapsed ~ .main-content,
    .sidebar.collapsed ~ .content {
        margin-left: 0;
    }
}


/* ─── Mobile ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-w));
    }

    .sidebar.mobile-open {
        margin-left: 0;
    }

    .main-content,
    .content {
        margin-left: 0;
    }

    .page-content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .back-to-top {
        right: 16px;
        bottom: 20px;
    }
}


/* ─── Auth Pages ─────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    background: #f0f4f9;
}

/* Left branding panel */
.auth-left {
    flex: 1;
    background: linear-gradient(145deg, #0a2540 0%, #009CFF 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px;
    color: #fff;
    min-height: 100vh;
}

/* Right form panel */
.auth-form-panel {
    width: 480px;
    min-width: 380px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 24px;
    background: #f0f4f9;
    min-height: 100vh;
    overflow-y: auto;
}

.auth-form-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, .10);
    padding: 44px 40px;
    width: 100%;
    max-width: 480px;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.auth-features li {
    padding: 4px 0;
    font-size: 14px;
}

.auth-features li::before { content: none; }

/* Auth form Bootstrap overrides */
.auth-form-box .btn-primary {
    background: #1a3a5c;
    border-color: #1a3a5c;
}

.auth-form-box .btn-primary:hover {
    background: #122a46;
    border-color: #122a46;
}

.auth-form-box .form-control {
    border: 1px solid #dde2ea;
    font-size: 13.5px;
    border-radius: 8px;
}

.auth-form-box .form-control:focus {
    border-color: #1a3a5c;
    box-shadow: 0 0 0 3px rgba(26, 58, 92, .12);
}

.auth-form-box .form-label {
    font-size: 12.5px;
    font-weight: 500;
}

.auth-form-box .input-group .btn {
    border: 1px solid #dde2ea;
    border-left: none;
    background: #fff;
    color: #888;
    border-radius: 0 8px 8px 0;
}

@media (max-width: 768px) {
    .auth-left { display: none; }
    .auth-form-panel {
        width: 100%;
        min-width: unset;
        padding: 28px 16px;
        min-height: 100vh;
        justify-content: flex-start;
    }
    .auth-form-box {
        padding: 32px 20px;
        border-radius: 12px;
    }
}


/* ─── Date Picker (tempusdominus) ────────────────────── */
.bootstrap-datetimepicker-widget.bottom { top: auto !important; }

.bootstrap-datetimepicker-widget .table * { border-bottom-width: 0; }

.bootstrap-datetimepicker-widget .table th { font-weight: 500; }

.bootstrap-datetimepicker-widget.dropdown-menu {
    padding: 10px;
    border-radius: 8px;
}

.bootstrap-datetimepicker-widget table td.active,
.bootstrap-datetimepicker-widget table td.active:hover {
    background: var(--primary);
}

.bootstrap-datetimepicker-widget table td.today::before {
    border-bottom-color: var(--primary);
}


/* ─── OWL Carousel ───────────────────────────────────── */
.testimonial-carousel .owl-dots {
    margin-top: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.testimonial-carousel .owl-dot {
    position: relative;
    display: inline-block;
    margin: 0 5px;
    width: 15px;
    height: 15px;
    border: 5px solid var(--primary);
    border-radius: 15px;
    transition: .5s;
}

.testimonial-carousel .owl-dot.active {
    background: var(--dark);
    border-color: var(--primary);
}


/* ─── Progress Bar (waypoints animated) ─────────────── */
.progress .progress-bar {
    width: 0;
    transition: width 2s ease;
}


/* ─── Badge adjustments ──────────────────────────────── */
.badge.bg-primary { background-color: var(--primary) !important; }


/* ==========================================================
   CRM DASHBOARD & COMPONENT STYLES
   (These classes are used by dashboard views, shared by
    both broker and admin panels)
   ========================================================== */

/* ─── Additional CSS Variables ───────────────────────── */
:root {
    --brand-primary:  #009CFF;
    --brand-accent:   rgba(0, 156, 255, .10);
    --card-border:    rgba(0, 0, 0, .06);
    --color-navy:     #1a3a5c;
    --color-gold:     #c9922e;
    --color-rose:     #e11d48;
    --color-teal:     #0ea5e9;
    --color-purple:   #7c3aed;
}


/* ─── Page Subtitle ──────────────────────────────────── */
.page-subtitle {
    font-size: 13px;
    color: var(--color-muted);
    margin: 2px 0 0;
}

.font-mono {
    font-family: 'Courier New', Courier, monospace;
}


/* ─── KPI Grid ───────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--card-border);
    padding: 18px 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-decoration: none;
    transition: box-shadow var(--transition), transform var(--transition);
    color: inherit;
}

.kpi-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
    transform: translateY(-2px);
    color: inherit;
}

.kpi-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-icon-wrap.navy   { background: rgba(26,  58,  92, .12); }
.kpi-icon-wrap.green  { background: rgba(22, 163,  74, .12); }
.kpi-icon-wrap.gold   { background: rgba(201,146,  46, .12); }
.kpi-icon-wrap.teal   { background: rgba(14, 165, 233, .12); }
.kpi-icon-wrap.rose   { background: rgba(225, 29,  72, .12); }
.kpi-icon-wrap.purple { background: rgba(124, 58, 237, .12); }

.kpi-data { flex: 1; min-width: 0; }

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

.kpi-label {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 3px;
}

.kpi-delta {
    font-size: 11.5px;
    margin-top: 4px;
    font-weight: 500;
}

.kpi-delta.up   { color: var(--color-success); }
.kpi-delta.down { color: var(--color-danger); }

/* kpi-card color variants (left-border accent) */
.kpi-card.kpi-navy   { border-left: 3px solid #1a3a5c; }
.kpi-card.kpi-gold   { border-left: 3px solid #c9922e; }
.kpi-card.kpi-teal   { border-left: 3px solid #0ea5e9; }
.kpi-card.kpi-rose   { border-left: 3px solid #e11d48; }
.kpi-card.kpi-green  { border-left: 3px solid #16a34a; }
.kpi-card.kpi-purple { border-left: 3px solid #7c3aed; }

/* kpi-card sub-elements (used in newer views) */
.kpi-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-right: 4px;
}

.kpi-content { flex: 1; min-width: 0; }


/* ─── CRM Card extras ────────────────────────────────── */
.crm-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.crm-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.no-pad { padding: 0 !important; }

.chart-wrap {
    position: relative;
    width: 100%;
}

.chart-wrap canvas {
    width: 100% !important;
}


/* ─── CRM Buttons ────────────────────────────────────── */
.btn-crm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn-crm-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-crm-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-crm-outline {
    background: transparent;
    color: var(--dark);
    border-color: #d4d8e0;
}

.btn-crm-outline:hover {
    background: var(--light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-crm-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.btn-crm-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-crm-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}


/* ─── Chips / Badges ─────────────────────────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.chip-primary   { background: rgba(0,156,255,.12);  color: var(--primary); }
.chip-navy      { background: rgba(26,58,92,.12);   color: #1a3a5c; }
.chip-info      { background: rgba(14,165,233,.12); color: #0ea5e9; }
.chip-success   { background: rgba(40,167,69,.12);  color: #16a34a; }
.chip-warning   { background: rgba(255,193,7,.15);  color: #b45309; }
.chip-gold      { background: rgba(201,146,46,.12); color: #c9922e; }
.chip-danger    { background: rgba(220,53,69,.12);  color: #dc3545; }
.chip-secondary { background: rgba(108,117,125,.12);color: #6c757d; }
.chip-purple    { background: rgba(124,58,237,.12); color: #7c3aed; }


/* ─── Form CRM Select ────────────────────────────────── */
.form-crm-select {
    appearance: none;
    background: var(--light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236c757d'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 10px 6px;
    border: 1px solid #d4d8e0;
    border-radius: 8px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    color: var(--dark);
    cursor: pointer;
    transition: border-color var(--transition);
}

.form-crm-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,156,255,.15);
}


/* ─── Activity Feed ──────────────────────────────────── */
.activity-feed {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
    font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-dot.navy   { background: #1a3a5c; }
.activity-dot.gold   { background: #c9922e; }
.activity-dot.gray   { background: #94a3b8; }
.activity-dot.green  { background: #16a34a; }

.activity-actor { font-weight: 600; color: var(--dark); }
.activity-action { color: var(--color-muted); }

.activity-time {
    margin-left: auto;
    font-size: 11px;
    color: var(--color-muted);
    white-space: nowrap;
    flex-shrink: 0;
}


/* ─── Limit Bar (block quota) ────────────────────────── */
.limit-bar {
    background: var(--light);
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
}

.limit-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 1s ease;
}


/* ─── Text Rupee symbol ──────────────────────────────── */
.text-rupee::before { content: ''; }


/* ─── Responsive KPI grid ────────────────────────────── */
@media (max-width: 767.98px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 16px;
    }
    .kpi-value { font-size: 18px; }
}

@media (max-width: 479.98px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}
