/* Intelligence Hub & Predictive Analysis Card Styles */

/* ========== Intelligence Hub Card Styles ========== */
.intelligence-hub-card {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%) !important;
    border-radius: 24px !important;
    border: 1px solid rgba(168, 85, 247, 0.2) !important;
    padding: 32px !important;
    cursor: default !important;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.1);
}

.intelligence-hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(139, 92, 246, 0.2);
}

@media (max-width: 640px) {
    /* Removed max-height and overflow to prevent internal scrolling */
}

.intelligence-hub-card.widget-sm {
    grid-column: span 1 !important;
    padding: 24px !important;
}

.intelligence-hub-card.widget-md {
    grid-column: span 2 !important;
}

.intelligence-hub-card.widget-lg {
    grid-column: span 3 !important;
}

.intelligence-hub-card.widget-xl {
    grid-column: span 4 !important;
}

.intelligence-hub-card.widget-sm .intelligence-hub-content-row {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: flex-start !important;
}

.intelligence-hub-card.widget-sm .intelligence-hub-percentage {
    font-size: 24px !important;
}

.intelligence-hub-card.widget-sm .intelligence-hub-subtitle {
    font-size: 11px !important;
}

.intelligence-hub-card.widget-sm .intelligence-hub-stats-v2 {
    padding: 16px !important;
    gap: 8px !important;
    width: 100% !important;
}

.intelligence-hub-card.widget-sm .intelligence-hub-actions {
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
}

.intelligence-hub-card.widget-sm .intelligence-hub-btn {
    padding: 6px !important;
    font-size: 10px !important;
    width: 100% !important;
}

/* Header Layout */
.intelligence-hub-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important; /* Changed from flex-start for better horizontal alignment */
    padding-bottom: 6px !important; /* Tightened from 8px */
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    margin-bottom: 4px !important; /* Tightened from 6px */
}

.intelligence-hub-header-meta {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    text-align: right !important;
    gap: 2px !important;
}

.intelligence-hub-confidence {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: #ffffff !important;
    font-size: 11px !important; /* Reduced from 12px */
    font-weight: 700 !important;
    background: rgba(99, 102, 241, 0.4) !important;
    padding: 2px 8px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.intelligence-hub-confidence span span {
    color: #4ade80 !important;
}

.intelligence-hub-train-status {
    font-size: 9px !important; /* Reduced from 10px */
    color: rgba(255, 255, 255, 0.6) !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
}

/* Tooltip Fix - Show below icons and align to the RIGHT to avoid clipping */
.info-tooltip {
    position: relative;
    display: inline-flex;
}

.info-tooltip .tooltip-content {
    bottom: auto !important;
    top: calc(100% + 8px) !important; /* Position below with spacing */
    right: 0 !important; /* Align to the right of the icon */
    left: auto !important;
    width: 200px !important;
    padding: 10px 14px !important;
    background: rgba(15, 23, 42, 0.98) !important; /* Darker for contrast */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important;
    transform: translateY(5px) !important; /* Subtle slide up animation */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 10000 !important;
    text-align: left !important;
    pointer-events: none !important;
}

.info-tooltip:hover .tooltip-content {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.info-tooltip .tooltip-content::after {
    display: none !important; /* Remove triangle to simplify alignment for now, or move to right */
}

/* Base Content Row (Small view) */
.intelligence-hub-content-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px; /* Reduced from 12px */
    width: 100%;
}

/* Horizontal Layout for MD and LG sizes */
.intelligence-hub-card:not(.widget-sm) .intelligence-hub-content-row {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 15px !important; /* Reduced from 20px */
}

.intelligence-hub-card:not(.widget-sm) .intelligence-hub-main {
    flex: 0 0 120px !important; /* Tightened from 140px */
    align-items: flex-start !important;
}

.intelligence-hub-percentage {
    color: #ffffff !important;
    font-size: 40px !important; /* Slightly reduced from 42px */
    font-weight: 800 !important;
    line-height: 1 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.intelligence-hub-subtitle {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 10px !important; /* Reduced from 11px */
    font-weight: 700 !important;
    margin-top: 2px !important; /* Reduced from 4px */
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.intelligence-hub-card:not(.widget-sm) .intelligence-hub-stats-v2 {
    flex: 1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    gap: 15px !important;
}

.intelligence-hub-card {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    color: white !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2) !important;
    padding: 20px 24px !important; /* Slightly reduced horizontal but generous enough */
}

.intelligence-hub-title {
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 14px !important; /* Slightly smaller title */
    letter-spacing: 0.05em !important;
}

.intelligence-hub-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(4px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.intelligence-hub-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.intelligence-hub-card:not(.widget-sm) .intelligence-hub-actions {
    flex-direction: row !important;
    gap: 10px !important;
    width: auto !important;
    margin-top: 0 !important;
}

/* Responsive adjustments for SM */
.intelligence-hub-card.widget-sm .intelligence-hub-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
}

.intelligence-hub-card.widget-sm .intelligence-hub-header-meta {
    align-items: flex-start !important;
    text-align: left !important;
    width: 100% !important;
    padding-top: 3px !important;
}

.intelligence-hub-card::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.intelligence-hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.intelligence-hub-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.intelligence-hub-icon {
    font-size: 20px;
}

.intelligence-hub-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #6b21a8;
    text-transform: uppercase;
}

.intelligence-hub-trend-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.intelligence-hub-trend-badge.down { background-color: #fee2e2; color: #991b1b; }
.intelligence-hub-trend-badge.up { background-color: #dcfce7; color: #166534; }
.intelligence-hub-trend-badge.stable { background-color: #f3f4f6; color: #4b5563; }

.intelligence-hub-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.intelligence-hub-gauge-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 12px;
}

.intelligence-hub-gauge {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-background {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 8;
}

.gauge-progress {
    fill: none;
    stroke: #581c87;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-label {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #6b21a8;
    opacity: 0.7;
    margin-top: -4px;
}

.gauge-tooltip {
    position: absolute;
    top: 0;
    right: 0;
}

.gauge-tooltip .info-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: help;
    color: white;
}

.intelligence-hub-percentage {
    font-size: 32px;
    font-weight: 800;
    color: #581c87;
    line-height: 1;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.intelligence-hub-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: #7c3aed;
    opacity: 0.9;
    text-align: center;
}

/* Styles for the training status text for better visibility */
#trainModelStatus {
    font-size: 11px;
    margin-top: 8px;
    color: #6b21a8 !important;
    font-weight: 500;
    opacity: 0.8;
}

#lastTrainedText {
    font-weight: 600;
}

.intelligence-hub-stats-v2 {
    flex: 1;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    backdrop-filter: blur(5px);
}

.intelligence-hub-confidence {
    text-align: left;
    font-size: 14px;
    color: #6b21a8;
    margin-bottom: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.intelligence-hub-confidence span span {
    font-weight: 800;
    font-size: 16px;
}

.intelligence-hub-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.intelligence-hub-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b21a8;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.intelligence-hub-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.2);
}

/* ========== Predictive Analysis Modal Styles ========== */
.predictive-modal {
    background: #ffffff;
    border-radius: 24px;
    padding: 0;
    width: 100%;
    max-width: 650px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    color: #1f2937;
    overflow: hidden;
}

.predictive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.predictive-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
}

.forecast-day-label {
    font-size: 14px;
    color: #6b7280;
}

.main-forecast-card {
    background: #f3f0ff;
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 24px;
}

/* Admin predictive modal — main analysis card (same structure as employee modal) */
.perf-main-analysis-card {
    display: flex;
    align-items: center;
    gap: 36px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 28px;
    padding: 36px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

/* Close button — always a fixed square, never stretches */
.predictive-header > button,
#employeePerformanceModal .predictive-header > button {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Header text side — allow it to shrink without overflowing */
.predictive-header > div:first-child {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}


.main-forecast-value {
    font-size: 64px;
    font-weight: 800;
    color: #8b5cf6;
    line-height: 1;
    margin-bottom: 8px;
}

.main-forecast-caption {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.main-forecast-subtext {
    margin-top: 16px;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

/* Activity Bars */
.activity-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 100px;
    padding: 0 20px;
    margin-bottom: 8px;
    gap: 8px;
}

.activity-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.activity-bar {
    width: 100%;
    max-width: 35px;
    background: #e5e7eb;
    border-radius: 6px;
    transition: height 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.activity-bar.next-bar {
    background: #8b5cf6;
}

.activity-bar-value {
    position: absolute;
    top: -22px;
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #4b5563;
}

.activity-bar.next-bar .activity-bar-value {
    color: #8b5cf6;
}

.activity-days {
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    margin-bottom: 24px;
    gap: 8px;
}

.activity-day {
    flex: 1;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
}

.activity-day.next-day {
    color: #6b7280;
}

/* Metric Cards */
.metric-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 16px;
    padding: 24px;
}

.metric-card-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.metric-card-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.metric-card-caption {
    font-size: 11px;
    color: #9ca3af;
}

.insight-banner {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.insight-text {
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
}

.predictive-understood-btn {
    width: 100%;
    padding: 16px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

/* ========== Attendance Predictions Table ========== */
.predictions-table {
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    border-collapse: collapse;
}

.predictions-table thead tr {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
}

.predictions-table thead th {
    padding: 24px 16px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-align: center;
}

.predictions-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #e2e8f0;
}

.predictions-table tbody td {
    padding: 24px 16px;
    vertical-align: middle;
}

/* ========== Dark Mode Overrides ========== */
body.dark-mode .intelligence-hub-card {
    background: linear-gradient(135deg, #000000 0%, #050505 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode .intelligence-hub-title { color: #ffffff; }
body.dark-mode .intelligence-hub-percentage { color: #ffffff; }
body.dark-mode .intelligence-hub-subtitle { color: #a1a1aa; }
body.dark-mode .intelligence-hub-confidence { color: #a1a1aa; }
body.dark-mode .intelligence-hub-stats-v2 { background: #0a0a0a; border: 1px solid rgba(255, 255, 255, 0.05); }

body.dark-mode .intelligence-hub-btn {
    background: rgba(30, 27, 75, 0.8);
    border-color: rgba(139, 92, 246, 0.4);
    color: #ddd6fe;
}

body.dark-mode #predictiveModal .modal-content,
body.dark-mode #employeePerformanceModal .modal-content {
    background: #000000 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 1) !important;
    color: #ffffff !important;
}

/* Removed aggressive transparent inline background override */

body.dark-mode .predictive-header {
    background: #050505 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

body.dark-mode .predictive-title { color: #ffffff !important; }

body.dark-mode .main-forecast-card {
    background: #0a0a0a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
}

body.dark-mode .forecast-day-label,
body.dark-mode .main-forecast-caption {
    color: #a1a1aa !important;
}

body.dark-mode .main-forecast-value {
    background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 20px rgba(255, 255, 255, 0.1) !important;
}

/* ====================================================
   MOBILE RESPONSIVE — All Predictive / My Stats Modals
   ==================================================== */
@media (max-width: 768px) {

    /* ── Modal shell ───────────────────────────────── */
    #predictiveModal .predictive-modal,
    #employeePerformanceModal .predictive-modal,
    #personnelSearchModal .modal-content {
        max-height: 93vh !important;
        margin: 8px !important;
        width: calc(100vw - 16px) !important;
        border-radius: 24px !important;
    }

    /* Reduce inner scroll-area padding on mobile */
    #predictiveModal .predictive-modal > div[style*="padding: 32px"],
    #employeePerformanceModal .predictive-modal > div[style*="padding: 32px"] {
        padding: 28px 24px !important;
    }

    /* ── Header ─────────────────────────────────────── */
    .predictive-header {
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 8px !important;
        flex-wrap: nowrap !important;
    }

    /* Shrink title font on mobile */
    .predictive-title {
        font-size: 18px !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    /* Keep close button anchored top-right, normal flow */
    .predictive-header > button {
        flex-shrink: 0 !important;
        position: static !important;
    }

    /* Employee modal — avatar + name header */
    #employeePerformanceModal .predictive-header > div:first-child {
        gap: 10px !important;
    }

    #employeePerformanceModal .predictive-header div[style*="font-size: 24px"] {
        font-size: 17px !important;
    }

    /* ── "Tomorrow's Expected Load" / "Attendance Probability" banner ── */
    #predictiveModal div[style*="min-width: 320px"],
    #employeePerformanceModal div[style*="min-width: 320px"] {
        min-width: 0 !important;
        width: 100% !important;
        padding: 24px 28px !important;
        box-sizing: border-box !important;
    }

    /* Outer wrapper that centres the banner */
    #predictiveModal div[style*="justify-content: center"][style*="margin-bottom: 24px"],
    #employeePerformanceModal div[style*="justify-content: center"][style*="margin-bottom: 24px"] {
        padding: 0 !important;
    }

    /* ── .perf-main-analysis-card (admin predictive modal, redesigned) ── */
    .perf-main-analysis-card {
        flex-direction: column !important;
        align-items: center !important;
        gap: 20px !important;
        padding: 28px 20px !important;
    }

    .perf-main-analysis-card > div:first-child {
        flex-shrink: 0 !important;
        margin: 0 auto !important;
    }

    .perf-main-analysis-card > div:last-child {
        width: 100% !important;
        flex: unset !important;
    }

    .perf-main-analysis-card > div:last-child > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr 1fr !important;
        width: 100% !important;
        gap: 12px !important;
    }

    /* Hide Bezier badge on mobile (class-based, reliable) */
    .bezier-badge {
        display: none !important;
    }

    /* ── Main analysis card (circular chart + stats) ── */
    .main-forecast-card {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 20px !important;
        padding: 28px 20px !important;
    }

    /* Circle wrapper — admin modal */
    .main-forecast-card > div:first-child {
        flex-shrink: 0 !important;
        margin: 0 auto !important;
    }

    /* Stats section — admin modal */
    .main-forecast-card > div:last-child {
        width: 100% !important;
        flex: unset !important;
    }

    /* 2-col stats grid — admin modal */
    .main-forecast-card > div:last-child > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr 1fr !important;
        width: 100% !important;
        gap: 12px !important;
    }

    /* Employee modal — main analysis section (no class, use attribute) */
    #employeePerformanceModal div[style*="display: flex"][style*="align-items: center"][style*="gap: 40px"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 20px !important;
        padding: 28px 20px !important;
    }

    /* Circle — employee modal */
    #employeePerformanceModal div[style*="width: 140px"][style*="flex-shrink: 0"] {
        margin: 0 auto !important;
    }

    /* Stats flex:1 section — employee modal */
    #employeePerformanceModal div[style*="display: flex"][style*="align-items: center"][style*="gap: 40px"] > div:last-child {
        width: 100% !important;
        flex: unset !important;
    }

    /* 3-col stats grid → 2-col on mobile — employee modal */
    #employeePerformanceModal div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    /* ── Chart sections (Engagement Velocity) ─────── */
    /* Chart header row: stack vertically */
    .activity-chart-section > div[style*="justify-content: space-between"],
    #employeePerformanceModal div[style*="background: #ffffff"][style*="border-radius: 28px"] > div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* Day-range buttons + Bezier badge row — wrap them */
    .activity-chart-section div[style*="display: flex"][style*="align-items: center"][style*="gap: 12px"],
    #employeePerformanceModal div[style*="display: flex"][style*="align-items: center"][style*="gap: 12px"] {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* Hide "Bezier Interpolation" text badge on mobile to save space */
    .activity-chart-section div[style*="Bezier Interpolation"],
    #employeePerformanceModal div[style*="Bezier Interpolation"] {
        display: none !important;
    }

    /* ── AI Insight / Executive Intelligence section ─ */
    /* Admin modal insight: float causes issues → clear it */
    #predictiveModal div[style*="background: #f8fafc"] span[style*="float: left"] {
        float: none !important;
        display: inline-flex !important;
        margin-bottom: 10px !important;
        margin-right: 0 !important;
    }

    /* Employee modal AI insight: tighten gap */
    #employeePerformanceModal div[style*="display: flex"][style*="gap: 20px"][style*="align-items: flex-start"] {
        gap: 12px !important;
    }

    #employeePerformanceModal div[style*="display: flex"][style*="gap: 20px"][style*="align-items: flex-start"] > div:last-child div[style*="font-size: 13px"] {
        font-size: 12px !important;
    }

    /* ── Bottom action buttons ─────────────────────── */
    /* Admin: "ACKNOWLEDGE ANALYSIS" — full width */
    #predictiveModal button[onclick*="closePredictiveModal"] {
        width: 100% !important;
        padding: 16px 20px !important;
        font-size: 13px !important;
        border-radius: 20px !important;
    }

    /* Employee: bottom bar */
    #employeePerformanceModal div[style*="padding: 24px 32px"] {
        padding: 16px !important;
    }

    /* ── Intelligence Hub card (dashboard widget) ── */
    .intelligence-hub-content-row {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .intelligence-hub-actions {
        width: 100% !important;
        flex-direction: column !important;
    }

    .intelligence-hub-btn {
        width: 100% !important;
    }
}

/* Fix flex child scrolling issue for both Desktop and Mobile */
.predictive-modal > div[style*="overflow-y: auto"],
.modal-content > div[style*="overflow-y: auto"] {
    min-height: 0 !important;
    overflow-x: hidden !important;
}

#employeePerformanceModal .main-forecast-card > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
}