.yxe-leads-dashboard {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================================
   Enterprise SaaS Header (Stripe/Linear Style)
   ========================================= */

/* Variables for this component */
:root {
    --yxe-border-color: #E3E8EE;
    --yxe-text-primary: #1A1F36;
    --yxe-text-secondary: #4F566B;
    --yxe-text-tertiary: #8792A2;
    --yxe-bg-surface: #FFFFFF;
    --yxe-bg-subtle: #F7F9FC;
    --yxe-brand-focus: #3C4257;
    --yxe-bg-primary: #2C3E50;
    /* Navy */
    --yxe-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --yxe-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.yxe-header-container {
    background: var(--yxe-bg-surface);
    padding: 24px 32px;
    border-radius: 12px;
    box-shadow: var(--yxe-shadow-md);
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* --- Title Group --- */
.yxe-header-title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yxe-header-title {
    margin: 0;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--yxe-text-primary);
    line-height: 1.1;
    letter-spacing: -0.01em;
    padding: 0;
    border: none;
}

.yxe-header-subtitle {
    font-size: 0.9em;
    color: var(--yxe-text-secondary);
    font-weight: 500;
}

/* --- Controls Area --- */
.yxe-header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Unified Filter Pill */
.yxe-filter-pill {
    display: flex;
    align-items: center;
    background: var(--yxe-bg-surface);
    border: 1px solid var(--yxe-border-color);
    border-radius: 8px;
    min-height: 40px;
    height: auto;
    /* Enterprise standard height */
    box-shadow: var(--yxe-shadow-sm);
    transition: all 0.2s ease;
    padding: 4px;
    flex-wrap: wrap;
    gap: 4px;
}

.yxe-filter-pill:hover {
    border-color: #CDD3DB;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.yxe-filter-pill:focus-within {
    border-color: var(--yxe-brand-focus);
    box-shadow: 0 0 0 1px var(--yxe-brand-focus);
}

/* Pill Sections */
.yxe-pill-section {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
}

/* Divider */
.yxe-pill-divider {
    width: 1px;
    height: 20px;
    background: var(--yxe-border-color);
}

/* Select Styling */
.yxe-pill-select {
    border: none;
    background: transparent;
    font-size: 0.9em;
    color: var(--yxe-text-primary);
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    outline: none;
    height: 100%;
}

/* Date Inputs */
.yxe-date-inputs {
    gap: 16px;
}

.yxe-micro-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.yxe-micro-input label {
    font-size: 0.7em;
    font-weight: 700;
    color: var(--yxe-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.yxe-micro-input input {
    border: none;
    background: transparent;
    font-size: 0.9em;
    color: var(--yxe-text-primary);
    padding: 0;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    width: 110px;
    /* Fixed width for stability */
}

.yxe-micro-divider {
    width: 12px;
    height: 1px;
    background: var(--yxe-border-color);
}

/* Compare Toggle */
.yxe-header-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    transition: background 0.2s;
}

.yxe-header-toggle:hover {
    background: var(--yxe-bg-subtle);
}

.yxe-toggle-label {
    font-size: 0.9em;
    color: var(--yxe-text-secondary);
    font-weight: 500;
}

/* Small Switch */
.yxe-switch-sm {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    margin: 0;
}

.yxe-switch-sm input {
    opacity: 0;
    width: 0;
    height: 0;
}

.yxe-slider-sm {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--yxe-border-color);
    transition: .3s;
    border-radius: 34px;
}

.yxe-slider-sm:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

input:checked+.yxe-slider-sm {
    background-color: var(--yxe-brand-focus);
}

input:checked+.yxe-slider-sm:before {
    transform: translateX(14px);
}

/* Reset Button */
.yxe-header-reset {
    background: none;
    border: none;
    color: var(--yxe-text-tertiary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yxe-header-reset:hover {
    color: var(--yxe-text-primary);
    background: var(--yxe-bg-subtle);
}

.yxe-header-reset .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Helper Text Row */
.yxe-header-message-row {
    height: 20px;
    /* Reserve space to prevent jump */
    margin-top: -20px;
    margin-bottom: 24px;
    padding-left: 32px;
}

.yxe-header-helper {
    font-size: 0.85em;
    color: var(--yxe-text-tertiary);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .yxe-header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .yxe-header-controls {
        width: 100%;
        justify-content: space-between;
    }

    .yxe-filter-pill {
        flex: 1;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .yxe-header-container {
        position: relative;
        padding: 20px 16px;
        margin-bottom: 20px;
    }

    .yxe-header-title-group {
        margin-bottom: 16px;
    }

    .yxe-header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        width: 100%;
    }

    /* Filter pill on mobile - remove pill styling, make it clean blocks */
    .yxe-filter-pill {
        flex-direction: column;
        height: auto;
        padding: 0;
        align-items: stretch;
        background: transparent;
        border: none;
        box-shadow: none;
        gap: 12px;
    }

    .yxe-pill-divider {
        display: none;
    }

    .yxe-pill-section {
        padding: 0;
        background: var(--yxe-bg-surface);
        border: 1px solid var(--yxe-border-color);
        border-radius: 8px;
        box-shadow: var(--yxe-shadow-sm);
    }

    /* Preset select on mobile */
    .yxe-pill-select {
        width: 100%;
        padding: 12px 16px;
        font-size: 1em;
        border: none;
        background: transparent;
    }

    /* Date inputs container on mobile */
    .yxe-date-inputs {
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding: 12px 16px;
    }

    .yxe-micro-input {
        width: 100%;
        margin-bottom: 12px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .yxe-micro-input:last-child {
        margin-bottom: 0;
    }

    .yxe-micro-input label {
        display: block;
        margin-bottom: 0;
        font-size: 0.8em;
        font-weight: 600;
        color: var(--yxe-text-tertiary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        min-width: 50px;
        flex-shrink: 0;
    }

    .yxe-micro-input input {
        flex: 1;
        width: auto;
        padding: 8px 12px;
        border: 1px solid var(--yxe-border-color);
        border-radius: 6px;
        font-size: 0.95em;
        background: var(--yxe-bg-surface);
    }

    .yxe-micro-divider {
        display: none;
    }

    /* Compare toggle on mobile - card style */
    .yxe-header-toggle {
        justify-content: space-between;
        background: var(--yxe-bg-surface);
        padding: 14px 16px;
        border-radius: 8px;
        width: 100%;
        border: 1px solid var(--yxe-border-color);
        box-shadow: var(--yxe-shadow-sm);
    }

    .yxe-toggle-label {
        font-size: 1em;
    }

    /* Reset button at top right */
    .yxe-header-reset {
        position: absolute;
        top: 20px;
        right: 16px;
        z-index: 10;
    }

    /* Helper message */
    .yxe-header-message-row {
        padding-left: 16px;
        margin-top: 8px;
        margin-bottom: 16px;
    }

    /* Elementor-specific mobile overrides with higher specificity */
    .elementor-widget-container .yxe-header-container {
        padding: 20px 16px !important;
    }

    .elementor-widget-container .yxe-filter-pill {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        gap: 12px !important;
    }

    .elementor-widget-container .yxe-pill-section {
        background: white !important;
        border: 1px solid #E3E8EE !important;
        border-radius: 8px !important;
        padding: 0 !important;
        margin-bottom: 12px !important;
    }

    .elementor-widget-container .yxe-pill-select {
        width: 100% !important;
        padding: 12px 16px !important;
        border: none !important;
    }

    .elementor-widget-container .yxe-date-inputs {
        padding: 12px 16px !important;
        gap: 0 !important;
    }

    .elementor-widget-container .yxe-micro-input {
        flex-direction: row !important;
        gap: 12px !important;
        margin-bottom: 12px !important;
    }

    .elementor-widget-container .yxe-micro-input label {
        min-width: 50px !important;
        font-size: 0.8em !important;
        text-transform: uppercase !important;
    }

    .elementor-widget-container .yxe-micro-input input {
        flex: 1 !important;
        width: auto !important;
        padding: 8px 12px !important;
        border: 1px solid #E3E8EE !important;
        border-radius: 6px !important;
    }

    .elementor-widget-container .yxe-header-toggle {
        background: white !important;
        border: 1px solid #E3E8EE !important;
        border-radius: 8px !important;
        padding: 14px 16px !important;
        width: 100% !important;
    }
}

/* =========================================
   Lead Statistics Header (Premium Polish)
   ========================================= */

.lead-stats-header {
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* --- Title Block --- */
.lead-stats-title-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lead-stats-title {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
    color: #1a1f36;
    line-height: 1.2;
    border: none;
    padding: 0;
}

.lead-stats-subtitle {
    font-size: 0.85em;
    color: #697386;
    font-weight: 500;
    line-height: 1.4;
}

/* --- Controls Area --- */
.lead-stats-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Common Control Height & Alignment */
.lead-stats-select,
.lead-stats-date-group,
.lead-stats-compare,
.lead-stats-reset-btn {
    height: 36px;
    /* Fixed height for perfect alignment */
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

/* Date Preset Select */
.lead-stats-select {
    padding: 0 12px;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
    font-size: 0.9em;
    color: #3c4257;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lead-stats-select:hover,
.lead-stats-select:focus {
    border-color: #cdd3db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    outline: none;
}

/* Date Inputs Group */
.lead-stats-date-group {
    background: #f7f9fc;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
    padding: 0 12px;
    gap: 12px;
    transition: border-color 0.2s;
}

.lead-stats-date-group:hover {
    border-color: #cdd3db;
}

.lead-stats-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lead-stats-input-wrapper label {
    font-size: 0.75em;
    font-weight: 600;
    color: #8792a2;
    /* Muted label color */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.lead-stats-input-wrapper input {
    border: none;
    background: transparent;
    font-size: 0.9em;
    color: #3c4257;
    padding: 0;
    font-family: inherit;
    outline: none;
    height: 100%;
    cursor: pointer;
}

.lead-stats-divider {
    width: 1px;
    height: 16px;
    background: #e3e8ee;
}

/* Compare Toggle */
.lead-stats-compare {
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid #e3e8ee;
    /* Visual separator */
}

.lead-stats-compare-label {
    font-size: 0.9em;
    color: #4f566b;
    font-weight: 500;
}

/* Toggle Switch Styling */
.yxe-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin: 0;
}

.yxe-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.yxe-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e3e8ee;
    transition: .4s;
    border-radius: 34px;
}

.yxe-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked+.yxe-slider {
    background-color: #3c4257;
}

input:checked+.yxe-slider:before {
    transform: translateX(16px);
}

/* Reset Button */
.lead-stats-reset-wrapper {
    display: flex;
    align-items: center;
}

.lead-stats-reset-btn {
    background: none;
    border: none;
    color: #697386;
    font-size: 0.9em;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 4px;
    transition: color 0.2s;
    text-decoration: none;
}

.lead-stats-reset-btn:hover {
    color: #1a1f36;
    background: transparent;
    /* Ensure no background on hover */
    text-decoration: underline;
}

/* Helper Text */
.lead-stats-helper {
    font-size: 0.85em;
    color: #8792a2;
    /* Muted grey */
    margin-top: -20px;
    margin-bottom: 20px;
    padding-left: 24px;
    /* Align with title padding */
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Adjustments */
@media (max-width: 900px) {
    .lead-stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .lead-stats-controls {
        width: 100%;
        justify-content: space-between;
    }

    .lead-stats-compare {
        border-left: none;
        padding-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: flex-start;
    }
}

.yxe-date-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.yxe-btn-reset {
    background-color: #f0f0f1;
    color: #2271b1;
    border: 1px solid #2271b1;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.yxe-btn-reset:hover {
    background-color: #ecf4f9;
    border-color: #135e96;
    color: #135e96;
}

.yxe-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .yxe-card-grid {
        grid-template-columns: 1fr;
    }
}

.yxe-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 25px;
    border: 1px solid #eee;
}

.yxe-card-full {
    grid-column: 1 / -1;
}

.yxe-card h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #2c3e50;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* Elementor Compatibility Fixes */
.elementor-widget-container .yxe-leads-dashboard {
    width: 100%;
}

/* Force consistent box-sizing in Elementor */
.elementor-widget-container .yxe-leads-dashboard *,
.elementor-widget-container .yxe-leads-dashboard *::before,
.elementor-widget-container .yxe-leads-dashboard *::after {
    box-sizing: border-box;
}

/* Ensure proper input styling in Elementor */
.elementor-widget-container .yxe-micro-input input[type="date"],
.elementor-widget-container .yxe-pill-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Fix toggle switch in Elementor */
.elementor-widget-container .yxe-switch input[type="checkbox"],
.elementor-widget-container .yxe-switch-sm input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Override Elementor's default checkbox styling */
.elementor-widget-container input[type="checkbox"]+.yxe-slider,
.elementor-widget-container input[type="checkbox"]+.yxe-slider-sm {
    display: block !important;
}

/* Ensure labels don't have Elementor margins */
.elementor-widget-container .yxe-micro-input label,
.elementor-widget-container .yxe-toggle-label,
.elementor-widget-container .yxe-header-toggle label {
    margin: 0 !important;
    padding: 0 !important;
}

/* =========================================
   Mobile Responsive Enhancements
   ========================================= */

/* Tablets and smaller */
@media (max-width: 900px) {
    .yxe-leads-dashboard {
        padding: 0 16px;
    }

    .yxe-header-container {
        padding: 20px;
    }

    .yxe-card {
        padding: 20px;
    }

    .yxe-card h2 {
        font-size: 16px;
    }
}

/* Mobile phones */
@media (max-width: 600px) {
    .yxe-leads-dashboard {
        padding: 0 12px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Header adjustments */
    .yxe-header-container {
        padding: 16px;
        gap: 16px;
        overflow: visible;
    }

    .yxe-header-title {
        font-size: 1.25em;
    }

    .yxe-header-subtitle {
        font-size: 0.85em;
    }

    /* Fix reset button styling on mobile */
    .yxe-header-reset {
        background: rgba(255, 255, 255, 0.95) !important;
        border: 1px solid var(--yxe-border-color) !important;
        border-radius: 6px !important;
        padding: 10px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .yxe-header-reset .dashicons {
        font-size: 20px !important;
        width: 20px !important;
        height: 20px !important;
        color: #333 !important;
        line-height: 1 !important;
        display: block !important;
    }

    .yxe-header-reset .dashicons::before {
        display: inline-block !important;
        vertical-align: top !important;
    }

    /* Cards */
    .yxe-card-grid {
        gap: 20px;
        margin-bottom: 20px;
        grid-template-columns: 1fr !important;
    }

    .yxe-card {
        padding: 16px;
        overflow: hidden;
    }

    .yxe-card h2 {
        font-size: 15px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    /* Chart descriptions */
    .yxe-card p {
        font-size: 0.85em !important;
        margin-bottom: 12px !important;
    }

    /* Canvas elements - ensure they're responsive */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Fix three-column insights on mobile */
    .yxe-lead-insights-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        overflow-x: visible !important;
    }

    .yxe-insight-card {
        width: 100% !important;
        min-width: auto !important;
        max-width: 100% !important;
        flex-shrink: 0 !important;
    }

    /* Advanced section cards - stack vertically */
    #yxeAdvancedContainer .yxe-card-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    #yxeAdvancedContainer .yxe-card {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Tables - make them scrollable with visual indicators */
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        font-size: 0.85em !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Ensure table container doesn't overflow */
    .yxe-card>div {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    /* Add scroll shadow indicator for tables */
    .yxe-card>div::-webkit-scrollbar {
        height: 8px;
    }

    .yxe-card>div::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .yxe-card>div::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 10px;
    }

    /* Keyword movement table specific fixes */
    #yxeKeywordInsights {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        position: relative;
    }

    #yxeKeywordInsights table {
        min-width: 500px;
    }

    /* Add gradient fade to indicate scrollable content */
    #yxeKeywordInsights::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95));
        pointer-events: none;
    }

    /* Hide dropdown by default (Desktop First) */
    .yxe-preset-dropdown {
        display: none !important;
    }

    /* Desktop preset button group */
    .yxe-header-controls .yxe-preset-buttons {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        max-width: 600px;
        justify-content: flex-start;
    }

    .yxe-header-controls .yxe-preset-btn {
        background: var(--yxe-bg-subtle) !important;
        border: 1px solid var(--yxe-border-color) !important;
        border-radius: 6px !important;
        padding: 6px 12px !important;
        margin: 4px !important;
        /* Increased spacing */
        font-size: 0.9em !important;
        cursor: pointer !important;
        transition: background 0.2s, color 0.2s !important;
        color: var(--yxe-text-primary) !important;
        box-shadow: none !important;
        text-transform: none !important;
        font-weight: 500 !important;
        line-height: normal !important;
    }

    .yxe-header-controls .yxe-preset-btn.active,
    .yxe-header-controls .yxe-preset-btn:hover {
        background: var(--yxe-bg-primary) !important;
        color: #fff !important;
        border-color: var(--yxe-bg-primary) !important;
    }

    @media (max-width: 768px) {
        .yxe-preset-buttons {
            display: none !important;
        }

        .yxe-preset-dropdown {
            display: block !important;
        }
    }

    /* Charts - make fully responsive, NO horizontal scroll */
    .yxe-card {
        overflow: hidden !important;
        overflow-x: visible !important;
    }

    /* Override high-intent charts grid on mobile */
    .yxe-charts-grid {
        grid-template-columns: 1fr !important;
    }

    canvas {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        min-width: 0 !important;
    }

    /* Specific chart containers */
    #yxeHighIntentByType,
    #yxeHighIntentBySource,
    #yxeTrafficTypeChart,
    #yxeDailyHighIntentChart,
    #yxeLeadsChart,
    #yxeWebsiteEventChart,
    #yxeDayOfWeekChart,
    #yxeTrafficSourceChart,
    #yxeDeviceTypeChart {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 250px !important;
    }

    /* Chart containers should not scroll */
    .yxe-card canvas {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Mobile-friendly chart text - smaller labels */
    .chartjs-render-monitor {
        font-size: 9px !important;
    }

    /* Message row */
    .yxe-header-message-row {
        padding-left: 16px;
        margin-bottom: 16px;
    }

    .yxe-header-helper {
        font-size: 0.8em;
    }

    /* Performance card adjustments */
    #yxeTrendAnalysis {
        padding: 16px;
        overflow: hidden;
        flex-direction: column !important;
        text-align: left !important;
    }

    /* Stack comparison sections vertically on mobile */
    #yxeTrendAnalysis>div {
        flex: 1 !important;
        min-width: 100% !important;
        text-align: left !important;
        margin-bottom: 20px !important;
    }

    /* Fix alignment of comparison labels and values */
    #yxeActualLabel,
    #yxePrevLabel {
        text-align: left !important;
    }

    #yxeCurrentActual,
    #yxeLastMonthActual {
        text-align: left !important;
        font-size: 2.5em !important;
    }

    /* Goal settings on mobile */
    #yxeGoalSettingsSection .yxe-card {
        padding: 16px;
    }

    #yxeGoalSettingsSection h3 {
        font-size: 1em;
    }

    #yxeGoalSettingsSection p {
        font-size: 0.85em;
    }

    /* Modal adjustments */
    #yxeChartModal>div {
        width: 95% !important;
        height: 90% !important;
        padding: 16px !important;
    }

    #yxeModalTitle {
        font-size: 1.2em !important;
    }

    /* Ensure all containers respect viewport */
    * {
        max-width: 100%;
    }
}

/* Very small phones */
@media (max-width: 400px) {
    .yxe-header-container {
        padding: 12px;
    }

    .yxe-header-title {
        font-size: 1.1em;
    }

    .yxe-card {
        padding: 12px;
    }

    .yxe-card h2 {
        font-size: 14px;
    }

    .yxe-filter-pill {
        padding: 8px;
    }
}

/* Landscape mobile - optimize for horizontal space */
@media (max-width: 900px) and (orientation: landscape) {
    .yxe-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .yxe-card-full {
        grid-column: 1 / -1;
    }
}

/* Print styles */
@media print {
    .yxe-header-controls {
        display: none;
    }

    .yxe-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}