/* =========================================================
   MASTER BRIDGE
   LOCKED DESIGN SYSTEM
========================================================= */

:root {

    /* =========================
       PRIMARY BRAND COLORS — BLUE TRUST
    ========================= */

    --primary-blue: #2563EB;
    --blue-dark: #1D4ED8;
    --blue-active: #16A34A;

    --blue-light: #EFF6FF;
    --blue-text: #1E40AF;


    /* =========================
       BACKGROUNDS
    ========================= */

    --bg-app: #EEF2F6;
    --bg-white: #FFFFFF;

    --bg-input: #F8FAFC;
    --bg-subtle: #F1F5F9;


    /* =========================
       TEXT
    ========================= */

    --text-dark: #0F172A;
    --text-primary: #1E293B;

    --text-secondary: #64748B;
    --text-muted: #94A3B8;


    /* =========================
       BORDERS
    ========================= */

    --border-light: #E2E8F0;
    --border-strong: #CBD5E1;


    /* =========================
       STATUS
    ========================= */

    --success: #22C55E;
    --success-bg: #DCFCE7;

    --danger: #EF4444;
    --danger-bg: #FEF2F2;

    --warning: #F59E0B;
    --warning-bg: #FFFBEB;


    /* =========================
       SHADOWS
    ========================= */

    --shadow-subtle:
        0 1px 3px rgba(15, 23, 42, 0.05),
        0 1px 2px rgba(15, 23, 42, 0.03);

    --shadow-card:
        0 1px 3px rgba(15, 23, 42, 0.07),
        0 1px 2px rgba(15, 23, 42, 0.04);

    --shadow-hover:
        0 8px 20px rgba(15, 23, 42, 0.08);


    /* =========================
       RADIUS
    ========================= */

    --radius-card: 10px;
    --radius-button: 7px;
    --radius-small: 6px;

}


/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {

    font-family:
        'Inter',
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;

    background: var(--bg-app);

    color: var(--text-dark);

    -webkit-font-smoothing: antialiased;
}


/* =========================================================
   TOP BAR
========================================================= */

.topbar {

    height: 64px;

    background: var(--bg-white);

    border-bottom:
        1px solid var(--border-light);

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 24px;

    position: sticky;

    top: 0;

    z-index: 100;

    box-shadow: var(--shadow-subtle);
}


/* =========================================================
   BRAND
========================================================= */

.brand {

    display: flex;

    align-items: center;

    gap: 11px;
}


.logo {

    width: 36px;
    height: 36px;

    border-radius: 9px;

    background: var(--primary-blue);

    color: #FFFFFF;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 18px;

    font-weight: 800;

    box-shadow:
        0 3px 8px rgba(37, 99, 235, 0.20);
}


.brand-text {

    display: flex;

    flex-direction: column;

    justify-content: center;
}


.brand-name {

    font-size: 18px;

    line-height: 1;

    font-weight: 800;

    letter-spacing: -0.4px;

    color: var(--text-dark);
}


.brand-name span {

    color: var(--primary-blue);
}


.brand-subtitle {

    margin-top: 4px;

    font-size: 9px;

    line-height: 1;

    font-weight: 700;

    letter-spacing: 0.8px;

    color: var(--text-secondary);

    text-transform: uppercase;
}


/* =========================================================
   TOP RIGHT
========================================================= */

.top-right {

    display: flex;

    align-items: center;

    gap: 14px;
}


.date-box {

    height: 36px;

    padding: 0 12px;

    background: var(--bg-white);

    border:
        1px solid var(--border-light);

    border-radius: var(--radius-button);

    display: flex;

    align-items: center;

    gap: 8px;

    color: var(--text-secondary);

    font-size: 11.5px;

    font-weight: 600;
}


.date-icon {

    width: 16px;

    height: 16px;

    color: var(--primary-blue);
}


.profile {

    width: 34px;

    height: 34px;

    border-radius: 50%;

    background: var(--blue-light);

    color: var(--blue-text);

    border:
        1px solid #BFDBFE;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 11px;

    font-weight: 800;

    cursor: pointer;
}


/* =========================================================
   APP LAYOUT
========================================================= */

.app {

    display: flex;

    min-height:
        calc(100vh - 64px);
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {

    width: 245px;

    background: var(--bg-white);

    border-right:
        1px solid var(--border-light);

    padding: 18px 12px;

    flex-shrink: 0;
}


.workspace-label {

    padding: 0 11px;

    margin: 10px 0 7px;

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 0.08em;

    text-transform: uppercase;

    color: var(--text-muted);
}


.menu {

    display: flex;

    flex-direction: column;

    gap: 3px;
}


.menu-item {

    min-height: 39px;

    display: flex;

    align-items: center;

    gap: 11px;

    padding: 0 11px;

    border-radius:
        var(--radius-button);

    color: var(--text-secondary);

    font-size: 12.5px;

    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}


.menu-item:hover {

    background: var(--bg-subtle);

    color: var(--text-dark);
}


.menu-item.active {

    background: var(--blue-light);

    color: var(--blue-text);

    font-weight: 700;
}


/* =========================================================
   SIDEBAR ICONS
========================================================= */

.menu-icon {

    width: 20px;

    height: 20px;

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    color: var(--text-muted);
}


.menu-icon svg {

    width: 17px;

    height: 17px;

    stroke: currentColor;

    fill: none;

    stroke-width: 1.8;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.menu-item.active .menu-icon {

    color: var(--primary-blue);
}


.menu-item:hover .menu-icon {

    color: var(--blue-active);
}


/* =========================================================
   SIDEBAR DIVIDER
========================================================= */

.sidebar-divider {

    height: 1px;

    background:
        var(--border-light);

    margin: 14px 8px;
}


/* =========================================================
   PLAN BOX
========================================================= */

.plan-box {

    margin-top: 20px;

    padding: 14px;

    border-radius:
        var(--radius-card);

    background:
        var(--bg-subtle);

    border:
        1px solid var(--border-light);
}


.plan-top {

    display: flex;

    align-items: center;

    justify-content: space-between;
}


.plan-title {

    font-size: 12px;

    font-weight: 700;

    color: var(--text-dark);
}


.plan-badge {

    font-size: 9px;

    font-weight: 700;

    padding: 4px 7px;

    border-radius: 20px;

    background:
        var(--blue-light);

    color:
        var(--blue-text);
}


.plan-description {

    margin-top: 6px;

    font-size: 10.5px;

    line-height: 1.5;

    color:
        var(--text-secondary);
}


.upgrade {

    width: 100%;

    margin-top: 12px;

    border: 0;

    background:
        var(--primary-blue);

    color: #FFFFFF;

    padding: 9px 12px;

    border-radius:
        var(--radius-button);

    font-size: 11px;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}


.upgrade:hover {

    background:
        var(--blue-dark);

    transform:
        translateY(-1px);
}


/* =========================================================
   MAIN
========================================================= */

.main {

    flex: 1;

    min-width: 0;

    padding:
        24px 28px 40px;
}


/* =========================================================
   DASHBOARD HEADER
========================================================= */

.dashboard-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 18px;
}


.dashboard-title {

    font-size: 22px;

    font-weight: 800;

    letter-spacing: -0.5px;

    color:
        var(--text-dark);
}


.dashboard-subtitle {

    margin-top: 4px;

    font-size: 12px;

    color:
        var(--text-secondary);
}


.primary-button {

    border: 0;

    background:
        var(--primary-blue);

    color: #FFFFFF;

    padding:
        10px 15px;

    border-radius:
        var(--radius-button);

    font-size: 11.5px;

    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 3px 8px rgba(37, 99, 235, 0.18);

    transition:
        background 0.15s ease;
}


.primary-button:hover {

    background:
        var(--blue-dark);
}


/* =========================================================
   QUICK ACTIONS
========================================================= */

.quick-bar {

    background:
        var(--bg-white);

    border:
        1px solid var(--border-light);

    border-radius:
        var(--radius-card);

    padding:
        10px 14px;

    display: flex;

    align-items: center;

    gap: 8px;

    margin-bottom: 18px;

    box-shadow:
        var(--shadow-card);
}


.quick-label {

    font-size: 10px;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.06em;

    color:
        var(--text-muted);

    margin-right: 4px;
}


.quick-action {

    display: inline-flex;

    align-items: center;

    gap: 6px;

    border:
        1px solid var(--border-light);

    background:
        var(--bg-white);

    color:
        var(--text-secondary);

    padding:
        7px 11px;

    border-radius:
        var(--radius-button);

    font-size: 11px;

    font-weight: 600;

    cursor: pointer;

    transition:
        all 0.15s ease;
}


.quick-action:hover {

    background:
        var(--blue-light);

    border-color:
        #BFDBFE;

    color:
        var(--blue-text);
}


.quick-action svg {

    width: 14px;

    height: 14px;

    stroke: currentColor;

    fill: none;

    stroke-width: 1.8;
}


/* =========================================================
   KPI GRID
========================================================= */

.kpi-grid {

    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 18px;
}


.kpi-card {

    background:
        var(--bg-white);

    border:
        1px solid var(--border-light);

    border-radius:
        var(--radius-card);

    padding: 17px;

    min-height: 125px;

    box-shadow:
        var(--shadow-card);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}


.kpi-card:hover {

    transform:
        translateY(-2px);

    box-shadow:
        var(--shadow-hover);
}


.kpi-header {

    display: flex;

    align-items: center;

    justify-content: space-between;
}


.kpi-title {

    font-size: 11.5px;

    font-weight: 600;

    color:
        var(--text-secondary);
}


.kpi-icon {

    width: 32px;

    height: 32px;

    border-radius:
        var(--radius-small);

    background:
        var(--blue-light);

    color:
        var(--blue-text);

    display: flex;

    align-items: center;

    justify-content: center;
}


.kpi-icon svg {

    width: 17px;

    height: 17px;

    stroke: currentColor;

    fill: none;

    stroke-width: 1.8;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.kpi-value {

    margin-top: 12px;

    font-size: 23px;

    font-weight: 800;

    letter-spacing: -0.5px;

    color:
        var(--text-dark);
}


.kpi-change {

    margin-top: 4px;

    font-size: 10px;

    font-weight: 600;

    color:
        var(--success);
}


/* =========================================================
   ANALYTICS GRID
========================================================= */

.analytics-grid {

    display: grid;

    grid-template-columns:
        1fr 1fr 1fr;

    gap: 14px;

    margin-bottom: 18px;
}


.analytics-card {

    background:
        var(--bg-white);

    border:
        1px solid var(--border-light);

    border-radius:
        var(--radius-card);

    min-height: 245px;

    overflow: hidden;

    box-shadow:
        var(--shadow-card);
}


.card-header {

    padding:
        13px 16px;

    border-bottom:
        1px solid var(--border-light);

    display: flex;

    align-items: center;

    justify-content: space-between;
}


.card-title {

    font-size: 12.5px;

    font-weight: 700;

    color:
        var(--text-dark);
}


.card-filter {

    border:
        1px solid var(--border-light);

    background:
        var(--bg-subtle);

    color:
        var(--text-secondary);

    padding:
        5px 8px;

    border-radius: 5px;

    font-size: 9.5px;

    font-weight: 600;
}


/* =========================================================
   DONUT
========================================================= */

.donut-area {

    height: 190px;

    display: flex;

    align-items: center;

    justify-content: center;
}


.donut {

    width: 128px;

    height: 128px;

    border-radius: 50%;

    background:
        conic-gradient(
            var(--primary-blue) 0deg 268deg,
            #E2E8F0 268deg 360deg
        );

    display: flex;

    align-items: center;

    justify-content: center;
}


.donut-inner {

    width: 90px;

    height: 90px;

    border-radius: 50%;

    background:
        var(--bg-white);

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;
}


.donut-value {

    font-size: 19px;

    font-weight: 800;

    color:
        var(--text-dark);
}


.donut-label {

    margin-top: 2px;

    font-size: 9px;

    font-weight: 600;

    color:
        var(--text-muted);
}


/* =========================================================
   VALUE CHART
========================================================= */

.value-chart {

    height: 190px;

    padding:
        15px 17px;

    display: flex;

    flex-direction: column;

    justify-content: center;
}


.chart-value {

    font-size: 23px;

    font-weight: 800;

    color:
        var(--text-dark);
}


.chart-change {

    margin-top: 3px;

    font-size: 10px;

    font-weight: 600;

    color:
        var(--success);
}


.chart-line {

    height: 82px;

    margin-top: 12px;

    position: relative;

    border-bottom:
        1px solid var(--border-light);

    background:
        linear-gradient(
            to bottom,
            transparent 24%,
            var(--border-light) 25%,
            transparent 26%,
            transparent 49%,
            var(--border-light) 50%,
            transparent 51%,
            transparent 74%,
            var(--border-light) 75%,
            transparent 76%
        );
}


.chart-line svg {

    width: 100%;

    height: 100%;
}


.chart-line polyline {

    fill: none;

    stroke:
        var(--primary-blue);

    stroke-width: 3;

    stroke-linecap: round;

    stroke-linejoin: round;
}


/* =========================================================
   CONVERSION
========================================================= */

.conversion-area {

    height: 190px;

    display: flex;

    align-items: center;

    justify-content: center;
}


.conversion-circle {

    width: 128px;

    height: 128px;

    border-radius: 50%;

    background:
        conic-gradient(
            var(--primary-blue) 0deg 242deg,
            #E2E8F0 242deg 360deg
        );

    display: flex;

    align-items: center;

    justify-content: center;
}


.conversion-inner {

    width: 90px;

    height: 90px;

    border-radius: 50%;

    background:
        var(--bg-white);

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;
}


.conversion-value {

    font-size: 19px;

    font-weight: 800;

    color:
        var(--text-dark);
}


.conversion-label {

    margin-top: 2px;

    font-size: 9px;

    font-weight: 600;

    color:
        var(--text-muted);
}


/* =========================================================
   LOWER GRID
========================================================= */

.lower-grid {

    display: grid;

    grid-template-columns:
        1.35fr 1fr;

    gap: 14px;
}


.funnel-card,
.activity-card,
.stage-card {

    background:
        var(--bg-white);

    border:
        1px solid var(--border-light);

    border-radius:
        var(--radius-card);

    overflow: hidden;

    box-shadow:
        var(--shadow-card);
}


/* =========================================================
   FUNNEL
========================================================= */

.funnel-content {

    padding:
        17px 18px;
}


.funnel-row {

    margin-bottom: 15px;
}


.funnel-row:last-child {

    margin-bottom: 0;
}


.funnel-top {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 6px;
}


.funnel-name {

    font-size: 11px;

    font-weight: 600;

    color:
        var(--text-secondary);
}


.funnel-number {

    font-size: 11px;

    font-weight: 700;

    color:
        var(--text-dark);
}


.funnel-bar {

    height: 8px;

    background:
        var(--bg-subtle);

    border-radius: 20px;

    overflow: hidden;
}


.funnel-fill {

    height: 100%;

    background:
        var(--primary-blue);

    border-radius: 20px;
}


/* =========================================================
   ACTIVITY
========================================================= */

.activity-list {

    padding:
        5px 17px;
}


.activity-item {

    display: flex;

    align-items: center;

    gap: 11px;

    padding:
        11px 0;

    border-bottom:
        1px solid var(--border-light);
}


.activity-item:last-child {

    border-bottom: 0;
}


.activity-icon {

    width: 29px;

    height: 29px;

    border-radius:
        var(--radius-small);

    background:
        var(--blue-light);

    color:
        var(--blue-text);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;
}


.activity-icon svg {

    width: 15px;

    height: 15px;

    stroke: currentColor;

    fill: none;

    stroke-width: 1.8;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.activity-text {

    font-size: 10.5px;

    font-weight: 600;

    color:
        var(--text-secondary);
}


.activity-time {

    margin-top: 2px;

    font-size: 9px;

    color:
        var(--text-muted);
}


/* =========================================================
   STAGE DISTRIBUTION
========================================================= */

.stage-wrapper {

    margin-top: 14px;

    display: grid;

    grid-template-columns:
        repeat(5, 1fr);

    gap: 8px;
}


.stage-box {

    text-align: center;

    padding:
        11px 5px;

    background:
        var(--bg-subtle);

    border:
        1px solid var(--border-light);

    border-radius:
        var(--radius-small);
}


.stage-number {

    font-size: 17px;

    font-weight: 800;

    color:
        var(--text-dark);
}


.stage-name {

    margin-top: 3px;

    font-size: 8.5px;

    font-weight: 600;

    color:
        var(--text-secondary);
}


.stage-dot {

    width: 7px;

    height: 7px;

    border-radius: 50%;

    background:
        var(--primary-blue);

    display: inline-block;

    margin-bottom: 4px;
}


/* =========================================================
   FULL WIDTH STAGE CARD
========================================================= */

.stage-card {

    margin-top: 14px;

    padding-bottom: 14px;
}


.stage-card .card-header {

    margin-bottom: 0;
}


.stage-card-inner {

    padding:
        0 16px;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1150px) {

    .kpi-grid {

        grid-template-columns:
            repeat(2, 1fr);
    }


    .analytics-grid {

        grid-template-columns:
            repeat(2, 1fr);
    }


    .analytics-card:last-child {

        grid-column:
            span 2;
    }

}


@media (max-width: 900px) {

    .sidebar {

        width: 68px;
    }


    .workspace-label,
    .menu-text,
    .plan-box {

        display: none;
    }


    .menu-item {

        justify-content: center;

        padding: 0;
    }


    .lower-grid {

        grid-template-columns:
            1fr;
    }

}


@media (max-width: 700px) {

    .topbar {

        padding:
            0 14px;
    }


    .brand-name {

        display: none;
    }


    .brand-subtitle {

        display: none;
    }


    .date-box {

        display: none;
    }


    .main {

        padding:
            16px 12px 30px;
    }


    .dashboard-header {

        align-items:
            flex-start;

        flex-direction:
            column;

        gap: 12px;
    }


    .kpi-grid {

        grid-template-columns:
            1fr;
    }


    .analytics-grid {

        grid-template-columns:
            1fr;
    }


    .analytics-card:last-child {

        grid-column:
            auto;
    }


    .quick-bar {

        overflow-x:
            auto;

        white-space:
            nowrap;
    }


    .stage-wrapper {

        grid-template-columns:
            repeat(2, 1fr);
    }

}



/* =========================================================
   SYSTEM 1 — CRM CONTACTS
   FRONTEND ADDITION — LOCKED MASTER BRIDGE DESIGN
========================================================= */

.crm-view {
    display: none;
}

.crm-view.active {
    display: block;
}

.crm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.crm-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-search-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 280px;
}

.crm-search {
    height: 38px;
    width: min(360px, 100%);
    border: 1px solid var(--border-light);
    background: var(--bg-white);
    border-radius: var(--radius-button);
    padding: 0 12px 0 38px;
    font-family: inherit;
    font-size: 11.5px;
    color: var(--text-dark);
    outline: none;
    box-shadow: var(--shadow-subtle);
}

.crm-search:focus {
    border-color: #93C5FD;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.crm-search-wrap {
    position: relative;
    width: min(360px, 100%);
}

.crm-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-muted);
}

.crm-select {
    height: 38px;
    border: 1px solid var(--border-light);
    background: var(--bg-white);
    border-radius: var(--radius-button);
    padding: 0 30px 0 10px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    outline: none;
}

.crm-secondary-button {
    height: 38px;
    border: 1px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-secondary);
    padding: 0 12px;
    border-radius: var(--radius-button);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.crm-secondary-button:hover {
    background: var(--blue-light);
    border-color: #BFDBFE;
    color: var(--blue-text);
}

.crm-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.crm-summary-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    padding: 15px 16px;
    box-shadow: var(--shadow-card);
}

.crm-summary-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.crm-summary-value {
    margin-top: 8px;
    font-size: 22px;
    line-height: 1;
    font-weight: 800;
    color: var(--text-dark);
}

.crm-table-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.crm-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

.crm-table th {
    text-align: left;
    padding: 12px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.crm-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 11px;
    vertical-align: middle;
}

.crm-table tbody tr:last-child td {
    border-bottom: 0;
}

.crm-table tbody tr:hover {
    background: #FAFCFF;
}

.crm-contact {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 170px;
}

.crm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue-text);
    border: 1px solid #BFDBFE;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    flex-shrink: 0;
}

.crm-contact-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dark);
}

.crm-contact-company {
    display: none;
}
.crm-contact-link:hover,
.crm-contact-link:focus,
.crm-contact-link:active {
    background: transparent;
    color: inherit;
    outline: none;
    box-shadow: none;
}

.crm-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 20px;
    background: var(--blue-light);
    color: var(--blue-text);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.crm-status.customer {
    background: var(--success-bg);
    color: #15803D;
}

.crm-status.lost {
    background: var(--danger-bg);
    color: #B91C1C;
}

.crm-status.nurture {
    background: var(--warning-bg);
    color: #B45309;
}

.crm-action-btn {
    border: 0;
    background: transparent;
    color: var(--blue-text);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 5px;
}

.crm-action-btn:hover {
    background: var(--blue-light);
}

.crm-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
}

.crm-loading {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 11px;
}

.crm-error {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #FECACA;
    background: var(--danger-bg);
    color: #B91C1C;
    border-radius: var(--radius-small);
    font-size: 10.5px;
    font-weight: 600;
    display: none;
}

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

.crm-modal-backdrop.active {
    display: flex;
}

.crm-modal {
    width: min(720px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.crm-modal-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.crm-modal-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-dark);
}

.crm-modal-close {
    width: 30px;
    height: 30px;
    border: 0;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.crm-modal-body {
    padding: 18px;
}

.crm-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.crm-field.full {
    grid-column: span 2;
}

.crm-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
}

.crm-field input,
.crm-field select,
.crm-field textarea {
    width: 100%;
    border: 1px solid var(--border-light);
    background: var(--bg-input);
    border-radius: var(--radius-button);
    padding: 9px 10px;
    font-family: inherit;
    font-size: 11px;
    color: var(--text-dark);
    outline: none;
}

.crm-field textarea {
    min-height: 78px;
    resize: vertical;
}

.crm-field input:focus,
.crm-field select:focus,
.crm-field textarea:focus {
    border-color: #93C5FD;
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.crm-modal-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.crm-notice {
    margin-bottom: 12px;
    padding: 9px 11px;
    border-radius: var(--radius-small);
    font-size: 10px;
    font-weight: 600;
    display: none;
}

.crm-notice.success {
    display: block;
    background: var(--success-bg);
    color: #15803D;
}

.crm-notice.error {
    display: block;
    background: var(--danger-bg);
    color: #B91C1C;
}

.crm-profile-modal {
    width: min(640px, 100%);
}

.crm-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.crm-profile-item {
    padding: 11px;
    border: 1px solid var(--border-light);
    background: var(--bg-subtle);
    border-radius: var(--radius-small);
}

.crm-profile-label {
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.crm-profile-value {
    margin-top: 4px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-dark);
    word-break: break-word;
}

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

@media (max-width: 700px) {
    .crm-toolbar {
        align-items: stretch;
    }

    .crm-search-filter,
    .crm-actions {
        width: 100%;
    }

    .crm-search-wrap {
        width: 100%;
    }

    .crm-search {
        width: 100%;
    }

    .crm-summary-grid {
        grid-template-columns: 1fr;
    }

    .crm-form-grid,
    .crm-profile-grid {
        grid-template-columns: 1fr;
    }

    .crm-field.full {
        grid-column: auto;
    }
}


/* =====================================================
   STEP 1.8.1 — CONTACT BULK SELECTION
   ===================================================== */
.crm-bulk-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 14px 0;
    padding: 12px 14px;
    background: #EFF6FF;
    border: 1px solid #DBEAFE;
    border-radius: 10px;
}
.crm-bulk-bar.active { display: flex; }
.crm-bulk-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crm-bulk-count { font-weight: 700; color: #1E40AF; }
.crm-bulk-hint { color: #64748B; font-size: 13px; }
.crm-bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crm-bulk-button {
    border: 1px solid #CBD5E1;
    background: #fff;
    color: #1E293B;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.crm-bulk-button:hover { border-color: #2563EB; color: #1D4ED8; }
.crm-bulk-button.primary { background: #2563EB; border-color: #2563EB; color: #fff; }
.crm-bulk-button.danger { color: #B91C1C; }
.crm-bulk-button:disabled { opacity: .55; cursor: not-allowed; }
.crm-contact-checkbox, #selectAllContacts {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #2563EB;
    cursor: pointer;
}
.crm-select-cell { width: 42px; text-align: center; }


/* =========================================================
   SYSTEM 2.3 — PIPELINE BOARD UI
   ADDITIVE ONLY — SYSTEM 1.9.4.3 BASE PRESERVED
========================================================= */

.pipeline-view {
    display: none;
}

.pipeline-view.active {
    display: block;
}

.pipeline-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pipeline-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pipeline-select {
    min-width: 190px;
}

.pipeline-board-wrap {
    overflow-x: auto;
    padding-bottom: 12px;
}

.pipeline-board {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: max-content;
}

.pipeline-column {
    width: 270px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 10px;
}

.pipeline-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 5px 11px;
}

.pipeline-column-title {
    font-size: 13px;
    font-weight: 700;
    color: #0F172A;
}

.pipeline-column-count {
    min-width: 24px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #E2E8F0;
    border-radius: 999px;
    background: #FFFFFF;
    color: #64748B;
    font-size: 11px;
}

.pipeline-column-cards {
    min-height: 90px;
}

.pipeline-opportunity-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 13px;
    margin-bottom: 9px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pipeline-opportunity-title {
    color: #0F172A;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.4;
}

.pipeline-opportunity-contact {
    color: #334155;
    font-size: 12px;
    margin-bottom: 8px;
}

.pipeline-opportunity-product {
    color: #2563EB;
    font-size: 11px;
    margin-top: 7px;
}

.pipeline-opportunity-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #64748B;
    font-size: 11px;
}

.pipeline-empty {
    padding: 18px 10px;
    border: 1px dashed #CBD5E1;
    border-radius: 9px;
    background: #FFFFFF;
    color: #94A3B8;
    font-size: 12px;
    text-align: center;
}

.pipeline-loading {
    width: 100%;
    padding: 40px 20px;
    color: #64748B;
    text-align: center;
    font-size: 13px;
}

.pipeline-error {
    display: none;
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid #FECACA;
    border-radius: 9px;
    background: #FEF2F2;
    color: #991B1B;
    font-size: 13px;
}

.pipeline-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.pipeline-summary-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 15px 16px;
}

.pipeline-summary-label {
    color: #64748B;
    font-size: 12px;
    margin-bottom: 7px;
}

.pipeline-summary-value {
    color: #0F172A;
    font-size: 22px;
    font-weight: 800;
}

@media (max-width: 900px) {
    .pipeline-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   SYSTEM 2.3 — FINAL REFERENCE VISUAL
   ADDITIVE CSS ONLY
   SYSTEM 1.9.4.3 LOCKED BASE PRESERVED
========================================================= */

/* Keep the same application background as the Contacts workspace. */
#pipelineView.pipeline-view {
    background: var(--bg-app);
}

/* Reference-style compact board: all 7 stages fit on desktop. */
#pipelineView .pipeline-board-wrap {
    overflow-x: hidden;
    padding-bottom: 4px;
}

#pipelineView .pipeline-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
    align-items: stretch;
}

/* Compact white stage cards. */
#pipelineView .pipeline-column {
    width: auto;
    min-width: 0;
    background: #FFFFFF;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 7px;
    box-shadow: var(--shadow-subtle);
}

/* Compact stage header. */
#pipelineView .pipeline-column-header {
    min-height: 38px;
    padding: 3px 4px 8px;
    border-bottom: 1px solid #E5E7EB;
}

/* Reference stage colours. */
#pipelineView .pipeline-column:nth-child(1) .pipeline-column-header {
    border-top: 4px solid #64748B;
    background: #F8FAFC;
}
#pipelineView .pipeline-column:nth-child(2) .pipeline-column-header {
    border-top: 4px solid #F59E0B;
    background: #FFFBEB;
}
#pipelineView .pipeline-column:nth-child(3) .pipeline-column-header {
    border-top: 4px solid #EF4444;
    background: #FEF2F2;
}
#pipelineView .pipeline-column:nth-child(4) .pipeline-column-header {
    border-top: 4px solid #2563EB;
    background: #EFF6FF;
}
#pipelineView .pipeline-column:nth-child(5) .pipeline-column-header {
    border-top: 4px solid #7C3AED;
    background: #F5F3FF;
}
#pipelineView .pipeline-column:nth-child(6) .pipeline-column-header {
    border-top: 4px solid #16A34A;
    background: #F0FDF4;
}
#pipelineView .pipeline-column:nth-child(7) .pipeline-column-header {
    border-top: 4px solid #EC4899;
    background: #FDF2F8;
}

/* Matching stage title colours. */
#pipelineView .pipeline-column:nth-child(1) .pipeline-column-title { color: #475569; }
#pipelineView .pipeline-column:nth-child(2) .pipeline-column-title { color: #D97706; }
#pipelineView .pipeline-column:nth-child(3) .pipeline-column-title { color: #DC2626; }
#pipelineView .pipeline-column:nth-child(4) .pipeline-column-title { color: #2563EB; }
#pipelineView .pipeline-column:nth-child(5) .pipeline-column-title { color: #6D28D9; }
#pipelineView .pipeline-column:nth-child(6) .pipeline-column-title { color: #16A34A; }
#pipelineView .pipeline-column:nth-child(7) .pipeline-column-title { color: #DB2777; }

/* Matching compact count badges. */
#pipelineView .pipeline-column:nth-child(1) .pipeline-column-count {
    background: #F1F5F9; color: #64748B;
}
#pipelineView .pipeline-column:nth-child(2) .pipeline-column-count {
    background: #FEF3C7; color: #D97706;
}
#pipelineView .pipeline-column:nth-child(3) .pipeline-column-count {
    background: #FEE2E2; color: #DC2626;
}
#pipelineView .pipeline-column:nth-child(4) .pipeline-column-count {
    background: #DBEAFE; color: #2563EB;
}
#pipelineView .pipeline-column:nth-child(5) .pipeline-column-count {
    background: #EDE9FE; color: #6D28D9;
}
#pipelineView .pipeline-column:nth-child(6) .pipeline-column-count {
    background: #DCFCE7; color: #16A34A;
}
#pipelineView .pipeline-column:nth-child(7) .pipeline-column-count {
    background: #FCE7F3; color: #DB2777;
}

/* Small, dense opportunity/contact cards like the reference. */
#pipelineView .pipeline-opportunity-card {
    padding: 9px;
    margin-bottom: 7px;
    border-radius: 7px;
    background: #FFFFFF;
    box-shadow: none;
}

#pipelineView .pipeline-opportunity-title {
    font-size: 12px;
    line-height: 1.3;
    margin-bottom: 4px;
}

#pipelineView .pipeline-opportunity-contact {
    font-size: 10.5px;
    line-height: 1.3;
    margin-bottom: 5px;
}

#pipelineView .pipeline-opportunity-meta {
    font-size: 10px;
}

#pipelineView .pipeline-opportunity-product {
    font-size: 10px;
    margin-top: 5px;
}

#pipelineView .pipeline-empty {
    min-height: 66px;
    padding: 12px 5px;
    border-radius: 7px;
    background: #FFFFFF;
    font-size: 10.5px;
}

/* Desktop: no horizontal scrollbar. */
@media (min-width: 1051px) {
    #pipelineView .pipeline-board-wrap {
        overflow-x: hidden;
    }
}

/* Smaller screens retain access to all stages. */
@media (max-width: 1050px) {
    #pipelineView .pipeline-board {
        grid-template-columns: repeat(4, minmax(150px, 1fr));
        min-width: 0;
    }

    #pipelineView .pipeline-board-wrap {
        overflow-x: auto;
    }
}

@media (max-width: 700px) {
    #pipelineView .pipeline-board {
        grid-template-columns: repeat(2, minmax(145px, 1fr));
    }
}
