:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-orange: #f97316;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    background-attachment: fixed;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- 2-TIER HEADER LAYOUT & AUTO-HIDE ON SCROLL --- */
header.two-tier-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 1.1rem 1.5rem 0.85rem 1.5rem !important;
    margin-bottom: 1.5rem !important;
    background: rgba(15, 23, 42, 0.92) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
    gap: 12px !important;
    position: sticky !important;
    top: 10px !important;
    z-index: 1000 !important;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

header.two-tier-header.header-hidden {
    transform: translateY(-115%) !important;
}

/* Mobile optimizations (width <= 768px) */
@media (max-width: 768px) {
    header.two-tier-header {
        padding: 0.9rem 1rem 0.75rem 1rem !important;
        border-radius: 12px !important;
        top: 6px !important;
    }
    #btn-tv-mode {
        display: none !important;
    }
    #theme-toggle-text {
        display: none !important;
    }
    .btn-theme-toggle {
        padding: 5px 8px !important;
        font-size: 1rem !important;
        min-width: 34px !important;
        justify-content: center !important;
    }
}

.header-top-bar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0 4px !important;
}

.header-top-bar .header-left {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

.header-top-bar .header-right {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.header-datasource-bar {
    border-radius: 10px !important;
}

.header-service-bar {
    width: 100% !important;
    padding: 2px 4px 0 4px !important;
}

.service-tabs-scroll {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    padding-bottom: 2px !important;
}

/* --- RETRO ARCADE SPACE SHOOTER AI LOADER (ITEM 3) --- */
.ai-pixel-arcade-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 20px;
    background: #090d16;
    border: 2px solid #3b82f6;
    border-radius: 16px;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4), inset 0 0 20px rgba(139, 92, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.arcade-screen {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.arcade-game-stage {
    width: 100%;
    height: 90px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
}

.arcade-boss {
    font-family: 'Courier New', monospace;
    font-weight: 800;
    font-size: 1.2rem;
    color: #ef4444;
    text-shadow: 0 0 10px #ef4444;
    animation: bossFloat 1.2s infinite alternate ease-in-out;
}

.arcade-hit-spark {
    display: inline-block;
    animation: hitPulse 0.3s infinite alternate ease-in-out;
}

@keyframes hitPulse {
    0% { transform: scale(0.8) rotate(0deg); opacity: 0.4; }
    100% { transform: scale(1.5) rotate(20deg); opacity: 1; filter: drop-shadow(0 0 12px #f59e0b); }
}

@keyframes bossFloat {
    0% { transform: translateY(-8px) scale(1); }
    100% { transform: translateY(8px) scale(1.05); }
}

.arcade-laser {
    font-size: 1.4rem;
    color: #f59e0b;
    text-shadow: 0 0 12px #f59e0b;
    animation: laserBeam 0.5s infinite linear;
}

@keyframes laserBeam {
    0% { transform: translateX(-40px) scaleX(0.7); opacity: 0.2; }
    50% { opacity: 1; transform: translateX(0px) scaleX(1); }
    100% { transform: translateX(40px) scaleX(1.3); opacity: 0.1; }
}

.arcade-ship {
    font-size: 2.2rem;
    animation: shipFly 0.8s infinite alternate ease-in-out;
    filter: drop-shadow(0 0 12px #3b82f6);
}

@keyframes shipFly {
    0% { transform: translateY(6px); }
    100% { transform: translateY(-6px); }
}

.arcade-hud {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-family: 'Courier New', monospace;
}

.arcade-score {
    font-size: 1rem;
    color: #10b981;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-shadow: 0 0 8px #10b981;
}

.arcade-status-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #38bdf8;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
    letter-spacing: 0.05em;
    animation: textGlowPulse 1.5s infinite alternate ease-in-out;
}

@keyframes textGlowPulse {
    0% { opacity: 0.8; }
    100% { opacity: 1; text-shadow: 0 0 15px #38bdf8, 0 0 25px #c084fc; }
}

/* --- ACTION BADGES FOR AI RECOMMENDATIONS (ITEM 4) --- */
.ai-action-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 6px;
    text-transform: uppercase;
}

.ai-action-badge.cut-loss {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.ai-action-badge.scale-up {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.ai-action-badge.reallocate {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.hidden {
    display: none;
}

/* Sidebar Menu */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 250px;
    background: var(--bg-color);
    border-right: 1px solid var(--card-border);
    padding: 20px;
    z-index: 9999;
    transform: translateX(0);
    transition: transform 0.3s ease;
    box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    pointer-events: auto;
}
.sidebar.closed {
    transform: translateX(-100%);
    box-shadow: none;
    pointer-events: none !important;
    visibility: hidden;
}

.status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}
.badge.warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.success { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.highlight-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.85) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(59, 130, 246, 0.4);
    grid-column: span 2;
}

@media (max-width: 768px) {
    .highlight-card {
        grid-column: span 1;
    }
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    gap: 6px;
}

.kpi-card h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.kpi-trend {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.trend-good {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.trend-bad {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.trend-neutral {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.kpi-value {
    font-size: clamp(1.4rem, 2.2vw, 2.1rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    white-space: nowrap;
    line-height: 1.25;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.3;
}

/* Service Comparison Matrix Table Styles */
.matrix-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}
.matrix-badge.star {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.matrix-badge.profitable {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.matrix-badge.warning {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.matrix-th-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}
.matrix-th-sortable:hover {
    color: var(--accent-blue) !important;
}
.sort-indicator {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.7;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 350px;
    box-sizing: border-box;
}

.chart-wrapper canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

.chart-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    margin-bottom: 0;
}

.btn-expand {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    padding: 5px;
    border-radius: 4px;
}
.btn-expand:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.1);
}

/* Fullscreen Mode (Portal Pattern) */
.chart-card.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999999 !important;
    background: #0f172a !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    padding: 20px 40px !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}

.chart-card.fullscreen .chart-wrapper {
    flex: 1 !important;
    width: 100% !important;
    height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
}

.chart-card.fullscreen .chart-header h3 {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

.chart-card.fullscreen .btn-expand {
    font-size: 1.8rem !important;
    padding: 8px 14px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
}

.chart-card.fullscreen canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Modal */
.modal {
    display: flex;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: translateY(-20px);
}

.modal-content h2 { 
    margin-bottom: 1rem; 
    font-weight: 600;
}
.modal-content p { 
    color: var(--text-secondary); 
    margin-bottom: 1.5rem; 
    font-size: 0.9rem; 
    line-height: 1.5; 
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: 'Inter', sans-serif;
    margin-bottom: 1.5rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--accent-blue);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}
.btn-primary:hover { background: #2563eb; }

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* Table Styles & Glossary */
.summary-section, .explanations, .forecasting-section {
    margin-top: 3rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.summary-section h3, .explanations h3, .forecasting-header h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* Forecasting Section */
.forecasting-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.forecasting-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.control-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.control-value {
    font-weight: bold;
    color: var(--accent-blue);
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.forecasting-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.fc-result-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.fc-result-card.highlight {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.fc-result-card h4 {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fc-vheader h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.menu-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 15px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.2s;
}

.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.menu-item.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
    font-weight: 600;
}

.fc-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.fc-subtext {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
}

.day-badge {
    color: #f59e0b; /* Orange/Yellow */
    font-size: 0.65em;
    border: 1px solid rgba(245, 158, 11, 0.5);
    padding: 0px 3px;
    border-radius: 2px;
    margin-left: 3px;
    white-space: nowrap;
    background: rgba(245, 158, 11, 0.05);
    font-weight: normal;
}


table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    background: #1e293b; /* Solid background for sticky header */
    position: sticky;
    top: 0;
    z-index: 10;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.explanations ul {
    list-style-type: none;
    padding-left: 0;
}

.explanations li {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.explanations strong {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
    .kpi-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 1rem; 
        margin-bottom: 2rem;
    }
    .kpi-card { padding: 1rem; }
    .kpi-card h3 { font-size: 0.8rem; margin-bottom: 0.5rem; }
    .kpi-value { font-size: 1.5rem; }
    
    .chart-card { padding: 1rem; }
    .chart-card h3 { font-size: 1.1rem; margin-bottom: 1rem; }
    
    h1 { font-size: 1.8rem; }
    .subtitle { font-size: 0.95rem; }
    .status { position: static; margin-top: 1rem; display: inline-block; }
    .dashboard-container { padding: 1rem; }
    
    .summary-section, .explanations, .forecasting-section { padding: 1rem; margin-top: 2rem; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
}

/* Custom Select Dropdown Arrow */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 32px !important;
}

/* Fix for select options text visibility */
select option {
    background-color: var(--bg-primary, #0f172a);
    color: var(--text-primary, #ffffff);
}

/* Monthly Summary Footer Styles */
.summary-total-row {
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: bold;
    border-top: 2px solid var(--border-color);
}
.summary-total-row td {
    padding-top: 15px;
    padding-bottom: 15px;
}


/* Service Pills Tabs */
.service-tabs {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    flex-wrap: wrap;
}
.service-tab-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.service-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.service-tab-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    transform: scale(1.05);
}



/* Mobile & Tablet Layout (Ultra Compact) */
@media (max-width: 1023px) {
    header {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
        position: sticky;
        top: 0;
        z-index: 1000;
        justify-content: flex-start;
        align-items: center;
    }
    .subtitle {
        display: none;
    }
    h1 {
        font-size: 1.3rem;
        margin-right: 10px; /* Space before the status dot */
    }
    .status {
        margin-left: 0;
    }
    #connection-status {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        padding: 0;
        color: transparent;
        overflow: hidden;
        white-space: nowrap;
        display: block;
        min-width: 10px; /* Prevent flex squishing */
    }
    .service-tabs {
        width: 100%;
        margin-top: 5px;
        gap: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        justify-content: flex-start;
        /* Hide scrollbar for cleaner look */
        scrollbar-width: none; 
    }
    .service-tabs::-webkit-scrollbar {
        display: none;
    }
    .service-tab-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
}

/* Desktop Responsive Header */
@media (min-width: 1024px) {
    header.two-tier-header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
}

/* AI Spinner Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Chat styles */
.chat-msg {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.chat-msg.user {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    color: white;
}
.chat-msg.ai {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    color: #e2e8f0;
}



/* Prevent login overlay flicker & show security check spinner */
.auth-loading #login-overlay {
    display: none !important;
}
.auth-loading #auth-checking-loader {
    display: flex !important;
}

.section-header-toggle {
    cursor: pointer;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--card-border);
    user-select: none;
    transition: background 0.2s;
}

.section-header-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out, margin-bottom 0.4s ease-out;
    max-height: 2000px; /* Large enough to hold the content */
    opacity: 1;
    margin-bottom: 20px;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.section-header-toggle.collapsed-icon .toggle-icon {
    transform: rotate(-90deg);
}

.comparison-insights-box {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.insight-card {
    flex: 1;
    min-width: 250px;
    background: rgba(30, 41, 59, 0.45);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.insight-card h4 {
    margin: 0;
    font-size: 0.95em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.insight-card .insight-service {
    font-size: 1.25em;
    font-weight: 600;
    color: var(--text-primary);
}

.insight-card .insight-details {
    font-size: 0.9em;
}

.insight-card.top-performer {
    border-color: rgba(16, 185, 129, 0.4);
}
.insight-card.top-performer h4 {
    color: var(--accent-green);
}

.insight-card.needs-attention {
    border-color: rgba(239, 68, 68, 0.4);
}
.insight-card.needs-attention h4 {
    color: var(--accent-red);
}

/* AI Chat Custom Scrollbar */
#ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}
#ai-chat-messages::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}
#ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 4px;
}
#ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* Gemini Chat Message Bubbles */
.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 85%;
    word-break: break-word;
    border-radius: 16px;
    padding: 12px 18px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(139, 92, 246, 0.25));
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #f8fafc;
    border-bottom-right-radius: 4px;
}

.chat-msg.ai {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}

.chat-msg img.msg-attached-img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 10px;
    margin-top: 6px;
    object-fit: contain;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Clean Gemini Plus Button (No white box background) */
button#btn-attach-image.btn-attach-plus {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #94a3b8 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 36px !important;
    height: 36px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

button#btn-attach-image.btn-attach-plus:hover {
    background: transparent !important;
    background-color: transparent !important;
    color: #60a5fa !important;
    transform: scale(1.25) !important;
    filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.9)) !important;
}

button#btn-attach-image.btn-attach-plus:active {
    transform: scale(1.05) !important;
}

/* Mobile Responsiveness for Gemini Input Card */
@media (max-width: 768px) {
    #gemini-input-card {
        padding: 4px 10px !important;
        gap: 8px !important;
        border-radius: 22px !important;
    }
    
    .btn-attach-plus {
        width: 32px !important;
        height: 32px !important;
    }
    
    .btn-attach-plus svg {
        width: 19px !important;
        height: 19px !important;
    }
    
    #ai-chat-input {
        font-size: 0.85rem !important;
        height: 38px !important;
        padding: 0 2px !important;
    }
    
    #btn-send-chat {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.85rem !important;
    }
}

/* --- TV PRESENTATION MODE (ULTRA-XL TYPOGRAPHY & FULLSCREEN) --- */
body.tv-mode {
    background: #060913 !important;
    overflow-x: hidden;
}

body.tv-mode .dashboard-container {
    max-width: 100% !important;
    padding: 0 35px !important;
    margin: 0 !important;
}

body.tv-mode header.two-tier-header {
    background: rgba(15, 23, 42, 0.95) !important;
    padding: 1.25rem 0 0.85rem 0 !important;
}

body.tv-mode .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 18px !important;
}

body.tv-mode .kpi-card {
    padding: 24px 20px !important;
    border-width: 1.5px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4) !important;
}

body.tv-mode .kpi-card h3 {
    font-size: 1.25rem !important;
    letter-spacing: 0.05em !important;
}

body.tv-mode .kpi-value {
    font-size: clamp(2.2rem, 3.5vw, 3.2rem) !important;
    font-weight: 800 !important;
}

body.tv-mode .kpi-card.highlight-card .kpi-value {
    font-size: clamp(2.8rem, 4.5vw, 4.2rem) !important;
}

body.tv-mode .kpi-label {
    font-size: 0.95rem !important;
}

body.tv-mode .ai-analyst-card {
    padding: 2.2rem !important;
}

body.tv-mode .ai-analyst-card h3 {
    font-size: 1.7rem !important;
}

body.tv-mode .chart-card {
    padding: 26px !important;
}

body.tv-mode .chart-header h3 {
    font-size: 1.5rem !important;
}

body.tv-mode table {
    font-size: 1.15rem !important;
}

body.tv-mode th, body.tv-mode td {
    padding: 14px 18px !important;
}

body.tv-mode #btn-tv-mode {
    display: none !important;
}

body.tv-mode #btn-exit-tv-mode {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   AI BUDGET PLANNER & SCENARIO SIMULATOR STYLES
   ========================================================================== */
.planner-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

.planner-controls-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.planner-input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.planner-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.planner-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.planner-select-input {
    background: rgba(15, 23, 42, 0.7);
    color: white;
    border: 1.5px solid rgba(59, 130, 246, 0.4);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.planner-select-input option {
    background: #0f172a;
    color: white;
    padding: 8px 12px;
}

.quick-budget-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.btn-budget-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-budget-pill:hover, .btn-budget-pill.active {
    background: rgba(59, 130, 246, 0.25);
    border-color: var(--accent-blue);
    color: white;
}

.goal-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.goal-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.goal-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.05);
}

.goal-card.selected {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.goal-card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}

.goal-card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.btn-run-planner {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
}

.btn-run-planner:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.5);
}

.btn-run-planner:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.forecast-stat-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.forecast-stat-card.highlight {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.15) 0%, rgba(30, 41, 59, 0.8) 100%);
    border-color: rgba(16, 185, 129, 0.4);
}

.forecast-stat-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.forecast-stat-val {
    font-size: 1.45rem;
    font-weight: 800;
    color: white;
}

/* --- QUICK STRATEGIC PROMPT CHIPS --- */
.btn-prompt-pill {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #e2e8f0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-prompt-pill:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: #a78bfa;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-prompt-pill:active {
    transform: translateY(0);
}

/* --- AI HEALTH MONITOR BANNER --- */
.health-badge-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

.health-badge-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

.health-badge-success {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* ==========================================
   THEME TOGGLE BUTTON & LIGHT MODE SYSTEM
   ========================================== */
.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

/* --- LIGHT THEME RULES --- */
body.light-theme {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.94);
    --card-border: rgba(203, 213, 225, 0.8);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-purple: #7c3aed;
    --accent-red: #dc2626;
    --accent-yellow: #d97706;
    --accent-orange: #ea580c;
    
    background-color: #f8fafc;
    color: #0f172a;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.06) 0%, transparent 50%);
}

body.light-theme .btn-theme-toggle {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

body.light-theme header.two-tier-header {
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(203, 213, 225, 0.8) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .header-top-bar h1 {
    color: #0f172a;
}

body.light-theme #btn-hamburger {
    color: #0f172a !important;
}

body.light-theme .header-datasource-bar {
    background: rgba(241, 245, 249, 0.9) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .sidebar {
    background: #ffffff !important;
    border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.08);
}

body.light-theme .menu-item {
    color: #334155 !important;
}

body.light-theme .menu-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-theme .menu-item.active {
    background: rgba(37, 99, 235, 0.1) !important;
    color: #2563eb !important;
    font-weight: 700;
}

body.light-theme .kpi-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.light-theme .kpi-card.highlight-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
}

body.light-theme .kpi-card.highlight-card h3 {
    color: var(--text-secondary) !important;
}

body.light-theme .kpi-card.highlight-card .kpi-label {
    color: var(--text-secondary) !important;
}

body.light-theme .chart-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.light-theme .chart-header h3 {
    color: #0f172a;
}

body.light-theme .summary-section {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.light-theme .summary-section h3 {
    color: #0f172a;
}

body.light-theme .table-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

body.light-theme table th {
    background: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 2px solid #e2e8f0;
}

body.light-theme table td {
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

body.light-theme table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}

body.light-theme .ai-analyst-card {
    background: linear-gradient(145deg, #ffffff 0%, rgba(243, 232, 255, 0.65) 100%) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.08);
}

body.light-theme .ai-analyst-card h3 {
    color: #1e1b4b !important;
}

body.light-theme #ai-health-desc {
    color: #334155 !important;
}

body.light-theme #ai-health-banner.health-badge-danger {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
}

body.light-theme #ai-health-banner.health-badge-success {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
}

body.light-theme .btn-prompt-pill {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

body.light-theme .btn-prompt-pill:hover {
    background: rgba(37, 99, 235, 0.08) !important;
    border-color: #2563eb !important;
    color: #1d4ed8 !important;
}

body.light-theme .planner-controls-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.light-theme .forecast-stat-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

body.light-theme .forecast-stat-val {
    color: #0f172a !important;
}

body.light-theme .goal-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light-theme .goal-card-title {
    color: #0f172a !important;
}

body.light-theme .goal-card-desc {
    color: #64748b !important;
}

body.light-theme .goal-card.selected {
    background: rgba(37, 99, 235, 0.06) !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.15) !important;
}

body.light-theme .goal-card.selected .goal-card-title {
    color: #1d4ed8 !important;
}

body.light-theme .goal-card.selected .goal-card-desc {
    color: #2563eb !important;
}

body.light-theme .btn-budget-pill {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

body.light-theme .btn-budget-pill.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

body.light-theme input, 
body.light-theme select {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme select option,
body.light-theme .planner-select-input option {
    background: #ffffff !important;
    color: #0f172a !important;
}

body.light-theme .planner-select-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

body.light-theme .service-tab-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

body.light-theme .service-tab-btn.active {
    background: #2563eb;
    color: #ffffff;
}

body.light-theme .insight-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

body.light-theme .insight-card .insight-service {
    color: #0f172a !important;
}

body.light-theme .insight-card.top-performer {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.06) 0%, #ffffff 100%) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

body.light-theme .insight-card.needs-attention {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.06) 0%, #ffffff 100%) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
}

body.light-theme .planner-narrative-card {
    background: linear-gradient(145deg, #ffffff 0%, rgba(243, 232, 255, 0.5) 100%) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.08);
}

body.light-theme .planner-narrative-card .chart-header h3 {
    color: #6b21a8 !important;
}

body.light-theme .planner-narrative-content {
    color: #334155 !important;
}

body.light-theme .planner-narrative-content strong {
    color: #0f172a !important;
}

body.light-theme .planner-narrative-content h4 {
    color: #b45309 !important;
}

body.light-theme .btn-copy-planner {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
}

body.light-theme .btn-copy-planner:hover {
    background: rgba(139, 92, 246, 0.1) !important;
    color: #6b21a8 !important;
    border-color: #a855f7 !important;
}

body.light-theme .modal-content {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .modal-header h3 {
    color: #0f172a !important;
}

body.light-theme .modal-close {
    color: #64748b !important;
}

body.light-theme .chat-msg.user {
    background: #2563eb !important;
    color: white !important;
}

body.light-theme .chat-msg.ai {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border: 1px solid #e2e8f0 !important;
}

/* Fix Table Column padding & overflow in Planner */
#planner-service-table th, 
#planner-service-table td,
#planner-dow-table th, 
#planner-dow-table td {
    padding: 12px 14px;
    text-align: left;
}

#planner-service-table th:first-child,
#planner-service-table td:first-child {
    padding-left: 18px;
    min-width: 110px;
}

#planner-dow-table th:first-child,
#planner-dow-table td:first-child {
    padding-left: 18px;
    min-width: 140px;
}

/* ==========================================
   TV MODE BUTTON & CHAT INPUT & PLANNER LOADER
   ========================================== */
.btn-tv-mode {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-tv-mode:hover {
    background: linear-gradient(135deg, #334155, #475569);
    border-color: #7dd3fc;
    transform: translateY(-1px);
}

body.light-theme .btn-tv-mode {
    background: #e0f2fe !important;
    color: #0284c7 !important;
    border: 1px solid #7dd3fc !important;
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.12);
}

body.light-theme .btn-tv-mode:hover {
    background: #bae6fd !important;
    border-color: #38bdf8 !important;
    color: #0369a1 !important;
}

.ai-chat-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.ai-chat-input-row input#ai-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.ai-chat-input-row .btn-send-chat {
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.ai-chat-input-row .btn-attach-plus {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

body.light-theme .ai-chat-input-row {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-theme .ai-chat-input-row input#ai-chat-input {
    color: #0f172a !important;
}

body.light-theme .ai-chat-input-row input#ai-chat-input::placeholder {
    color: #64748b !important;
}

body.light-theme .ai-chat-input-row .btn-attach-plus {
    color: #475569 !important;
}

body.light-theme #ai-chat-box {
    border-top: 1px solid #e2e8f0 !important;
}

/* ==========================================
   AI REAL-TIME ANALYST TYPOGRAPHY & BLOCKS
   ========================================== */
.ai-response-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.ai-block {
    border-radius: 10px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.ai-block.summary-block {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.ai-block.strengths-block {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.ai-block.risks-block {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.ai-block.recommendations-block {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.ai-grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.ai-block-title {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-block.summary-block .ai-block-title { color: #38bdf8; }
.ai-block.strengths-block .ai-block-title { color: #10b981; }
.ai-block.risks-block .ai-block-title { color: #ef4444; }
.ai-block.recommendations-block .ai-block-title { color: #f59e0b; }

.ai-block-body {
    font-size: 0.88rem;
    line-height: 1.6;
    color: #cbd5e1;
}

.ai-strong {
    color: #f8fafc;
    font-weight: 700;
}

.ai-section-subtitle {
    color: #f59e0b;
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: 700;
    border-left: 3px solid #f59e0b;
    padding-left: 8px;
}

.ai-section-title {
    color: var(--accent-blue);
    margin-top: 12px;
    margin-bottom: 6px;
    font-size: 0.95rem;
    font-weight: 700;
}

.ai-section-main-title {
    color: var(--accent-blue);
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 1.05rem;
    font-weight: 700;
}

.ai-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 10px 0;
}

.ai-list-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    line-height: 1.55;
}

.ai-list-num {
    color: #f59e0b;
    font-weight: 700;
    flex-shrink: 0;
}

.ai-list-text {
    flex: 1;
}

.ai-bullet-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    line-height: 1.55;
    padding-left: 4px;
}

.ai-bullet-dot {
    color: var(--accent-blue);
    font-weight: bold;
    flex-shrink: 0;
}

.ai-bullet-text {
    flex: 1;
}

/* ==========================================
   LIGHT THEME OVERRIDES FOR AI ANALYST
   ========================================== */
body.light-theme .ai-response-box {
    color: #0f172a !important;
}

body.light-theme .ai-block.summary-block {
    background: #ffffff !important;
    border: 1px solid #bae6fd !important;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.05);
}

body.light-theme .ai-block.strengths-block {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.04);
}

body.light-theme .ai-block.risks-block {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.04);
}

body.light-theme .ai-block.recommendations-block {
    background: #fffdf5 !important;
    border: 1px solid #fed7aa !important;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.04);
}

body.light-theme .ai-block.summary-block .ai-block-title { color: #0284c7 !important; }
body.light-theme .ai-block.strengths-block .ai-block-title { color: #059669 !important; }
body.light-theme .ai-block.risks-block .ai-block-title { color: #dc2626 !important; }
body.light-theme .ai-block.recommendations-block .ai-block-title { color: #d97706 !important; }

body.light-theme .ai-block-body {
    color: #334155 !important;
}

body.light-theme .ai-strong {
    color: #0f172a !important;
    font-weight: 700 !important;
}

body.light-theme .ai-section-subtitle {
    color: #b45309 !important;
    border-left: 3px solid #f59e0b !important;
}

body.light-theme .ai-list-num {
    color: #d97706 !important;
    font-weight: 700 !important;
}

body.light-theme .ai-list-text,
body.light-theme .ai-bullet-text {
    color: #334155 !important;
}

body.light-theme .ai-bullet-dot {
    color: #2563eb !important;
}

body.light-theme #ai-content-box p {
    color: #334155 !important;
}

.planner-loader-card {
    text-align: center;
    padding: 50px 20px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 12px;
    border: 1px dashed rgba(59, 130, 246, 0.3);
    color: var(--text-secondary);
}

body.light-theme .planner-loader-card {
    background: #ffffff !important;
    border: 1px dashed rgba(37, 99, 235, 0.35) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    color: #475569 !important;
}

body.light-theme .planner-loader-card h4 {
    color: #1d4ed8 !important;
    font-weight: 700;
}

body.light-theme .planner-loader-card p {
    color: #64748b !important;
}

/* ==========================================
   LIGHT THEME: FULLSCREEN CHART & TV MODE FIXES
   ========================================== */

/* 1. Fullscreen Chart in Light Theme */
body.light-theme .chart-card.fullscreen {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: none !important;
    box-shadow: none !important;
}

body.light-theme .chart-card.fullscreen .chart-header h3 {
    color: #0f172a !important;
}

body.light-theme .chart-card.fullscreen .btn-expand {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

body.light-theme .chart-card.fullscreen .btn-expand:hover {
    background: #cbd5e1 !important;
}

/* 2. TV Mode: Net Profit Card in Light Theme */
body.light-theme.tv-mode .kpi-card.highlight-card,
body.tv-mode.light-theme .kpi-card.highlight-card,
body.tv-mode.light-theme .highlight-card,
body.light-theme.tv-mode .highlight-card {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06) !important;
}

body.light-theme.tv-mode .kpi-card.highlight-card h3,
body.tv-mode.light-theme .kpi-card.highlight-card h3 {
    color: #64748b !important;
}

body.light-theme.tv-mode .kpi-card.highlight-card .kpi-label,
body.tv-mode.light-theme .kpi-card.highlight-card .kpi-label {
    color: #64748b !important;
}

body.light-theme.tv-mode header.two-tier-header {
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

/* 3. Exit Button for TV Presentation Mode (In-Header replacement for TV Mode button) */
.btn-exit-tv-mode {
    display: none;
    background: rgba(239, 68, 68, 0.92) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    padding: 6px 16px !important;
    border-radius: 20px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35) !important;
    transition: all 0.2s ease !important;
    align-items: center !important;
    gap: 6px !important;
}

.btn-exit-tv-mode:hover {
    background: rgba(220, 38, 38, 1) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5) !important;
}

body.tv-mode #btn-exit-tv-mode {
    display: inline-flex !important;
}

body.tv-mode #btn-tv-mode {
    display: none !important;
}

/* ==========================================
   STACKING CONTEXT BREAKOUT FOR FULLSCREEN CHARTS
   ========================================== */
.summary-section:has(.fullscreen),
.collapsible-content:has(.fullscreen),
#cross-service-comparison:has(.fullscreen),
#comparison-wrapper:has(.fullscreen),
.dashboard-container:has(.fullscreen),
body.has-chart-fullscreen .summary-section,
body.has-chart-fullscreen .collapsible-content {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: visible !important;
    transform: none !important;
    filter: none !important;
    z-index: 99999999 !important;
}

.chart-card.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999999 !important;
}

/* ==========================================
   LIGHT THEME: SETTINGS VIEW POLISH
   ========================================== */
body.light-theme #view-settings {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}

body.light-theme #view-settings > div[id^="section-"] {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

body.light-theme #view-settings h2 {
    color: #0f172a !important;
}

body.light-theme #view-settings h3,
body.light-theme #view-settings h4 {
    color: #1d4ed8 !important;
}

body.light-theme #view-settings p {
    color: #64748b !important;
}

body.light-theme #view-settings label {
    color: #1e293b !important;
}

/* Form and Table Containers inside Settings */
body.light-theme #view-settings div[style*="background: #0f172a"],
body.light-theme #view-settings div[style*="background:#0f172a"],
body.light-theme #view-settings div[style*="background: rgba(15, 23, 42"] {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
    color: #0f172a !important;
}

/* Inputs, Textareas and Selects in Settings */
body.light-theme #view-settings input,
body.light-theme #view-settings select,
body.light-theme #view-settings textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

body.light-theme #view-settings input:focus,
body.light-theme #view-settings select:focus,
body.light-theme #view-settings textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

body.light-theme #view-settings input::placeholder,
body.light-theme #view-settings textarea::placeholder {
    color: #94a3b8 !important;
}

/* Tables inside Settings */
body.light-theme #view-settings table {
    background: #ffffff !important;
    color: #0f172a !important;
}

body.light-theme #view-settings thead {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme #view-settings th {
    color: #475569 !important;
    font-weight: 600 !important;
}

body.light-theme #view-settings td {
    color: #0f172a !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

body.light-theme #view-settings tbody tr:hover {
    background: #f8fafc !important;
}

/* Sub-action buttons in Settings */
body.light-theme #btn-clear-ads,
body.light-theme #btn-clear-gemini,
body.light-theme #btn-refresh-models {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #64748b !important;
}

body.light-theme #btn-clear-ads:hover,
body.light-theme #btn-clear-gemini:hover,
body.light-theme #btn-refresh-models:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

body.light-theme #btn-use-mock {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
}

body.light-theme #btn-use-mock:hover {
    background: #e2e8f0 !important;
}

/* System Info Box in Light Theme */
body.light-theme #section-sysinfo-setting div[style*="background: rgba(15, 23, 42"] {
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%) !important;
    border: 1px solid #bae6fd !important;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.08) !important;
}

body.light-theme #sys-info-date {
    color: #0f172a !important;
    font-weight: 600 !important;
}

/* ==========================================================================
   MARKETING FULL-FUNNEL WIDGET
   ========================================================================== */
.funnel-card {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.funnel-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 12px;
}

.funnel-badge-normal {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.funnel-badge-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.funnel-badge-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.funnel-flow-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 4px;
}

.funnel-step-box {
    flex: 1;
    min-width: 140px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.funnel-step-box:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.funnel-step-box.highlight {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.funnel-step-box.bottleneck-step {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.funnel-step-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.funnel-step-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.funnel-step-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.funnel-step-sub {
    font-size: 0.78rem;
    color: #38bdf8;
    font-weight: 500;
}

.funnel-step-box.highlight .funnel-step-sub {
    color: #10b981;
}

.funnel-arrow-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 80px;
}

.funnel-arrow-line {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    position: absolute;
    top: 50%;
    z-index: 1;
}

.funnel-rate-badge {
    position: relative;
    z-index: 2;
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 12px;
    padding: 4px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.funnel-rate-badge.rate-warning {
    border-color: #f59e0b;
}

.funnel-rate-badge.rate-danger {
    border-color: #ef4444;
    background: #1c0c0c;
}

.funnel-rate-badge .rate-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.funnel-rate-badge .rate-val {
    font-size: 0.8rem;
    color: #38bdf8;
    font-weight: 700;
}

.funnel-rate-badge.rate-warning .rate-val {
    color: #f59e0b;
}

.funnel-rate-badge.rate-danger .rate-val {
    color: #ef4444;
}

.funnel-arrow-head {
    position: absolute;
    right: -4px;
    top: calc(50% - 7px);
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.7rem;
    z-index: 1;
}

/* Creative Matrix Sortable Table */
.matrix-th-sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.matrix-th-sortable:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #38bdf8 !important;
}

.creative-status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.creative-status-pill.top-hook {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.creative-status-pill.high-cvr {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

.creative-status-pill.fatigue {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.creative-status-pill.normal {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
}

/* Light Theme overrides for Funnel & Creative */
body.light-theme .funnel-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .funnel-step-box {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

body.light-theme .funnel-step-box:hover {
    border-color: #38bdf8 !important;
    background: #f0f9ff !important;
}

body.light-theme .funnel-step-box.highlight {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
}

body.light-theme .funnel-arrow-line {
    background: #cbd5e1 !important;
}

body.light-theme .funnel-rate-badge {
    background: #ffffff !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .funnel-rate-badge.rate-warning {
    background: #fffdf5 !important;
    border-color: #f59e0b !important;
}

body.light-theme .funnel-rate-badge.rate-danger {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
}

body.light-theme .funnel-rate-badge .rate-label {
    color: #64748b !important;
}

body.light-theme .funnel-arrow-head {
    color: #94a3b8 !important;
}

body.light-theme #creative-ai-result-box {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
}

body.light-theme #view-creative .summary-section[style*="background: linear-gradient"] {
    background: linear-gradient(145deg, #ffffff 0%, #f5f3ff 100%) !important;
    border: 1px solid #ddd6fe !important;
}

body.light-theme #view-creative .summary-section h3 {
    color: #1e1b4b !important;
}

/* Creative Suite Period Filter Buttons */
.creative-period-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.creative-period-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
}

.creative-period-btn.active {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 2px 12px rgba(56, 189, 248, 0.4) !important;
}

/* Creative Matrix Table Dark Mode */
#creative-matrix-table th {
    background: rgba(30, 41, 59, 0.8) !important;
    color: #93c5fd !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    padding: 12px 10px !important;
    border-bottom: 2px solid rgba(56, 189, 248, 0.3) !important;
}

#creative-matrix-table td {
    color: #f1f5f9;
    font-size: 0.88rem;
    padding: 12px 10px;
}

/* Light Theme Overrides */
body.light-theme .creative-period-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
}

body.light-theme .creative-period-btn.active {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

body.light-theme #creative-matrix-table th {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-bottom: 2px solid #cbd5e1 !important;
}

body.light-theme #creative-matrix-table td {
    color: #334155 !important;
}


