/* Lead Sources Dashboard
     - Screen-scoped styling only (no main.css edits)
     - Uses existing CSS tokens from base.css (var(--...))
 */

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) {
    padding-bottom: 2rem;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* --- Header --- */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 15px 25px;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--primary-4);
    margin-top: 1rem;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-filters-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-date-display {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-date-sep {
    opacity: 0.85;
    margin: 0 4px;
}

/* Raw inputs are only used as source-of-truth for the picker and API */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-date-input {
    display: none;
}

/* Match Leads screen density */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-date-display .tw-dp-trigger {
    padding: .25rem .75rem;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-select-wrapper {
    position: relative;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-custom-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--white);
    border: 1px solid var(--border-soft);
    padding: 9px 15px 9px 35px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--black);
    cursor: pointer;
    outline: none;
    min-width: 180px;
    font-weight: 500;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-custom-select:focus {
    border-color: var(--primary);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-select-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 12px;
    color: var(--text1);
    opacity: 0.8;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .btn-action {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .btn-action:hover {
    background: var(--btn-pr-hover);
}

/* --- KPIs --- */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px var(--primary-4);
    border: 1px solid var(--white);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 90px;
    transition: transform 0.2s;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card:hover {
    transform: translateY(-3px);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text1);
    opacity: 0.85;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    margin-top: auto;
    line-height: 1;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card.leads .kpi-value {
    color: var(--lbl2);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card.income {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: var(--white);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card.income .kpi-label {
    color: var(--white);
    opacity: 0.85;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card.income .kpi-value {
    color: var(--white);
}

/* --- Chart --- */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .chart-card {
    background: var(--white);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 20px var(--primary-4);
    display: flex;
    flex-direction: column;
    height: 380px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .card-subtitle {
    font-size: 13px;
    color: var(--text1);
    opacity: 0.85;
    display: block;
    margin-top: 4px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .total-badge {
    background: var(--lightblue2);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 13px;
    white-space: nowrap;
}

/* Top charts row (annual leads + employees performance) */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-top-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    align-items: stretch;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-top-charts-grid > .chart-card {
    height: 380px;
}

/* Employees chart legend */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-emp-legend {
    display: flex;
    gap: 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--black);
    white-space: nowrap;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-dot] {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-dot="meetings"] {
    background: var(--lbl2);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-dot="closings"] {
    background: var(--lbl1);
}

/* Employees chart bars */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-emp-chart-area {
    position: relative;
    z-index: 2;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 18px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-group] {
    position: relative;
    height: 100%;
    flex: 1;
    min-width: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-direction: column;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-bars] {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 100%;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-bar] {
    width: 14px;
    height: 0;
    border-radius: 4px 4px 0 0;
    transition: height 1000ms cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    cursor: pointer;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-bar="meetings"] {
    background: var(--lbl2);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-bar="closings"] {
    background: var(--lbl1);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-tooltip] {
    position: absolute;
    top: -38px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--black);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    opacity: 0;
    transition: 0.2s;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-tooltip]::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--black);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-bar]:hover [data-lsd-emp-tooltip] {
    opacity: 1;
    top: -42px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-name] {
    position: absolute;
    bottom: -30px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text1);
    opacity: 0.9;
    white-space: nowrap;
}

/* Chart bars (existing JS uses data-lsd-* attributes) */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .chart-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-soft);
    position: relative;
    /* Chart-only overrides to match requested palette */
    --lbl4: #f59e0b;  /* yellow */
    --lbl2: #3b82f6;  /* light blue */
    --lbl1: #10b981;  /* green */
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .grid-line {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    border-top: 1px dashed var(--lightblue2);
    z-index: 0;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .grid-line[data-lsd-grid-line="0"] { bottom: 0%; }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .grid-line[data-lsd-grid-line="50"] { bottom: 50%; }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .grid-line[data-lsd-grid-line="100"] { bottom: 100%; }

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-area {
    position: relative;
    z-index: 2;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar-container] {
    position: relative;
    height: 100%;
    flex: 1;
    min-width: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar] {
    width: 100%;
    height: 0;
    border-radius: 6px 6px 0 0;
    transition: height 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    opacity: 0.9;
    background: var(--lbl2);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar][data-tone="peak"] { background: var(--primary); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar][data-tone="high"] { background: var(--lbl2); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar][data-tone="mid"] { background: var(--lbl4); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar][data-tone="low"] { background: var(--lbl1); }

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-month-label] {
    position: absolute;
    bottom: -30px;
    font-size: 12px;
    color: var(--text1);
    opacity: 0.85;
    white-space: nowrap;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-tooltip] {
    position: absolute;
    top: -35px;
    background: var(--black);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    transition: 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar-container]:hover [data-lsd-tooltip] {
    opacity: 1;
    transform: translateY(-5px);
}

/* --- Analysis Grid --- */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 25px;
    align-items: stretch;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .card {
    background: var(--white);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 4px 20px var(--primary-4);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 380px;
}

/* Funnel */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .funnel-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    gap: 15px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .funnel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-label {
    width: 50px;
    text-align: right;
    font-weight: 600;
    color: var(--text1);
    opacity: 0.85;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-bar-bg {
    flex-grow: 1;
    height: 28px;
    background: var(--lightblue2);
    margin: 0 15px;
    border-radius: 6px;
    overflow: hidden;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-bar-fill {
    height: 100%;
    border-radius: 6px;
    width: 0;
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.9;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-bar-fill[data-tone="info"] { background: var(--lbl2); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-bar-fill[data-tone="primary"] { background: var(--primary); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-bar-fill[data-tone="warning"] { background: var(--lbl4); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-bar-fill[data-tone="success"] { background: var(--lbl1); }

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .f-val {
    width: 30px;
    font-weight: 800;
    color: var(--black);
    text-align: left;
}

/* ROI table */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-table th {
    text-align: right;
    font-size: 12px;
    color: var(--text1);
    opacity: 0.85;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--lightblue2);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-table td {
    padding: 15px 0;
    border-bottom: 1px solid var(--lightgray);
    font-size: 14px;
    vertical-align: middle;
    color: var(--black);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-source {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--black);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .source-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex: 0 0 auto;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .icon-google { background: var(--lbl2); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .icon-fb { background: var(--primary); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .icon-tiktok { background: var(--black); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .icon-organic { background: var(--lbl1); }

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-badge {
    background: var(--lightblue2);
    color: var(--lbl1);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 12px;
    display: inline-block;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-badge.low {
    background: var(--lightblue2);
    color: var(--delete);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-badge.mid {
    background: var(--lightblue2);
    color: var(--lbl2);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-trend-up { color: var(--lbl1); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-trend-flat { color: var(--text1); opacity: 0.7; }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .roi-trend-down { color: var(--delete); }

/* Side stats */
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .side-split {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .mini-card {
    flex: 1;
    border-bottom: 1px solid var(--lightblue2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .mini-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-mini-title {
    text-align: center;
    font-size: 15px;
    margin-bottom: 10px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .occupancy-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 250px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .circle-bg {
    fill: none;
    stroke: var(--lightblue2);
    stroke-width: 3.8;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-ring-segment {
    fill: none;
    stroke-width: 2.8;
    stroke-linecap: round;
    transition: stroke-dasharray 1200ms cubic-bezier(0.16, 1, 0.3, 1), stroke-dashoffset 1200ms cubic-bezier(0.16, 1, 0.3, 1);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-ring-segment.answered {
    stroke: var(--lbl2);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-ring-segment.missed {
    stroke: var(--delete);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .percentage {
    fill: var(--lbl2);
    font-weight: 900;
    font-size: 0.5em;
    text-anchor: middle;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-mini-sub {
    text-align: center;
    font-size: 12px;
    color: var(--text1);
    opacity: 0.85;
    margin-top: 5px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .calls-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 800;
    color: var(--black);
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .calls-total {
    font-size: 12px;
    color: var(--text1);
    opacity: 0.85;
    font-weight: 700;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .progress-multi {
    height: 10px;
    width: 100%;
    background: var(--lightblue2);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .prog-bar {
    height: 100%;
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    width: 0;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .prog-answered { background: var(--primary); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .prog-missed { background: var(--delete); }

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .calls-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 800;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .legend-item.answered { color: var(--primary); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .legend-item.missed { color: var(--delete); }

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .dot.answered { background: var(--primary); }
:where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .dot.missed { background: var(--delete); }

/* --- Responsive --- */
@media (max-width: 768px) {
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .page-title {
        font-size: 18px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-header-section {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 20px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-filters-group {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-date-display,
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-select-wrapper,
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-custom-select,
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .btn-action {
        width: 100%;
        box-sizing: border-box;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .lsd-date-display {
        justify-content: center;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card.income {
        grid-column: span 2;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .chart-card {
        padding: 20px;
        height: auto;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .chart-wrapper {
        height: 250px;
        min-height: 250px;
        overflow-x: hidden;
        justify-content: space-between;
        gap: 10px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 40px;
        box-sizing: border-box;
    }

    /* Mobile-only: allow horizontal scroll just for the annual leads trend */
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-wrapper.chart-wrapper {
        display: block;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        touch-action: pan-y;
        scrollbar-width: none; /* Firefox */
        direction: rtl;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-wrapper.chart-wrapper::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-area {
        min-width: 0;
        gap: 8px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-wrapper #lsd-year-chart-area {
        min-width: 100%;
        gap: 12px;
        direction: rtl;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar-container] {
        flex: 1 1 0;
        min-width: 0;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-wrapper [data-lsd-bar-container] {
        flex: 0 0 10px;
        min-width: 10px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-wrapper [data-lsd-bar-container],
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-wrapper [data-lsd-bar] {
        touch-action: pan-y;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-bar] {
        width: 70%;
        margin-left: auto;
        margin-right: auto;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-year-chart-wrapper [data-lsd-bar] {
        width: 100%;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-month-label] {
        font-size: 10px;
        transform: rotate(-18deg);
        transform-origin: top right;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-emp-chart-area {
        justify-content: space-between;
        gap: 10px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-group] {
        min-width: 0;
        flex: 1 1 0;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-bars] {
        gap: 4px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-bar] {
        width: 10px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) [data-lsd-emp-name] {
        font-size: 11px;
        transform: rotate(-10deg);
        transform-origin: top right;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .analysis-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .card {
        height: auto;
        min-height: auto;
        padding: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-row {
        grid-template-columns: repeat(3, 1fr);
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .kpi-card.income {
        grid-column: span 3;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .analysis-grid {
        grid-template-columns: 1fr 1fr;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .analysis-grid .card:last-child {
        grid-column: span 2;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .side-split {
        flex-direction: row;
        gap: 40px;
    }

    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) .mini-card {
        border-bottom: none;
        border-left: 1px solid var(--lightblue2);
        padding-left: 40px;
        margin-bottom: 0;
        padding-bottom: 0;
    }
}

@media (max-width: 980px) {
    :where(#screen-leads-sources-dashboard, #leads-sources-dashboard) #lsd-top-charts-grid {
        grid-template-columns: 1fr;
    }
}
