/* Import modern Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* Color Variables and Design Tokens */
:root {
    --bg-main: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: rgba(30, 41, 59, 0.45);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-indigo: #6366f1;
    --accent-teal: #14b8a6;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --accent-green: #22c55e;
    
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --teal-gradient: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    --orange-gradient: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global resets and structure */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-indigo);
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 10;
    transition: var(--transition-normal);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-card);
    margin-bottom: 24px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

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

.nav-item.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.05);
}

.nav-item.active i {
    color: #818cf8;
}

/* Sidebar Footer Sync Panel */
.sync-panel {
    padding-top: 16px;
    border-top: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-status {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.sync-btn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    background: var(--accent-indigo);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.sync-btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

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

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
}

/* Tab Sections */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Headers */
.header-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* KPI Cards Layout */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
    transition: var(--transition-normal);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition-fast);
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.kpi-icon.indigo { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.kpi-icon.teal { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.kpi-icon.orange { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.kpi-icon.green { background: rgba(34, 197, 94, 0.15); color: #4ade80; }

.kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.kpi-trend {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up { color: var(--accent-green); }
.trend-down { color: var(--accent-red); }

/* Dashboard Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(16px);
    position: relative;
    transition: var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

/* Beautiful Data Table */
.table-container {
    overflow-x: auto;
    width: 100%;
}

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

.data-table th {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-card);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-vip { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-loyal { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-new { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.3); }
.badge-risk { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-lost { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.badge-success { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.badge-warning { background: rgba(234, 179, 8, 0.12); color: #facc15; }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.badge-info { background: rgba(14, 165, 233, 0.12); color: #38bdf8; }

/* AI Report Workspace (Tab 5) */
.ai-workspace {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 24px;
    height: calc(100vh - 160px);
}

.ai-report-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 32px;
    overflow-y: auto;
    backdrop-filter: blur(16px);
}

.ai-chat-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

/* Markdown Rendering in Report */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    font-family: 'Outfit', sans-serif;
    color: #fff;
    margin-top: 24px;
    margin-bottom: 12px;
}

.markdown-body h2 {
    font-size: 20px;
    border-bottom: 1px solid var(--border-card);
    padding-bottom: 8px;
}

.markdown-body p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.markdown-body ul, .markdown-body ol {
    margin-left: 20px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 13px;
}

.markdown-body th, .markdown-body td {
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 12px;
    text-align: left;
}

.markdown-body th {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent-indigo);
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 0 8px 8px 0;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-style: italic;
}

/* Chat Interface styling */
.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.chat-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.chat-info span {
    font-size: 11px;
    color: var(--accent-teal);
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-bubble.ai {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-card);
}

.chat-bubble.user {
    background: var(--accent-gradient);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.chat-bubble p {
    margin-bottom: 8px;
}
.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble ul, .chat-bubble ol {
    margin-left: 16px;
    margin-top: 4px;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-card);
    display: flex;
    gap: 12px;
    background: rgba(17, 24, 39, 0.6);
}

.chat-input {
    flex-grow: 1;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
}

.chat-input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.chat-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.chat-send-btn:active {
    transform: translateY(0);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Loading spinner */
.spinner {
    animation: rotate 2s linear infinite;
    width: 18px;
    height: 18px;
}

.spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

.spin-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Media Queries */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }
    .brand-name, .nav-item span, .sync-panel {
        display: none;
    }
    .brand {
        padding-bottom: 20px;
        margin-bottom: 20px;
        justify-content: center;
    }
    .main-content {
        margin-left: 80px;
        padding: 20px;
    }
    .ai-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }
    .ai-report-panel, .ai-chat-panel {
        height: 500px;
    }
}

/* Stili per la barra filtri */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    background: rgba(30, 41, 59, 0.25);
    border: 1px solid var(--border-card);
    padding: 16px;
    border-radius: 16px;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select, .filter-input {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 10px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
    min-width: 200px;
}

.filter-select:focus, .filter-input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Badge Allerta Churn */
.badge-churn {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.5);
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 10px 2px rgba(239, 68, 68, 0.2); }
}

/* Bottone per aprire i canoni */
.btn-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.btn-action:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-indigo);
    color: #fff;
}

/* Modale */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-sidebar);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: var(--shadow-md);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.open .modal-content {
    transform: translateY(0);
}

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

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: #fff;
}

/* ===== Barra Alert Automatici ===== */
.alert-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.alert-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card, rgba(255,255,255,0.03));
    border: 1px solid var(--border-card, rgba(255,255,255,0.06));
    border-radius: 10px;
    flex: 1 1 240px;
    min-width: 220px;
}
.alert-chip i { font-size: 18px; }
.alert-chip strong {
    display: block;
    font-size: 13px;
    color: #fff;
    line-height: 1.2;
}
.alert-chip span {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
}

/* =====================================================================
   TEMA CHIARO (toggle) — primario #145A97
   ===================================================================== */
.theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-card);
    background: var(--bg-card, rgba(30,41,59,0.6));
    color: var(--text-primary);
    backdrop-filter: blur(8px);
    cursor: pointer;
    font-size: 17px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), background var(--transition-fast);
}
.theme-toggle:hover { transform: scale(1.08); }

html[data-theme="light"] {
    --bg-main: #eef2f7;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --border-card: rgba(20, 90, 151, 0.14);
    --border-hover: rgba(20, 90, 151, 0.45);
    --text-primary: #16263a;
    --text-secondary: #566678;
    --text-muted: #8493a3;
    --accent-indigo: #145A97;
    --accent-gradient: linear-gradient(135deg, #145A97 0%, #2a7bc0 100%);
    --shadow-sm: 0 2px 8px rgba(20, 90, 151, 0.08);
    --shadow-md: 0 8px 30px rgba(20, 90, 151, 0.12);
    --shadow-glow: 0 0 20px rgba(20, 90, 151, 0.15);
}
html[data-theme="light"] body { background-color: var(--bg-main); color: var(--text-primary); }

/* Superfici */
html[data-theme="light"] .sidebar { background: #fff; border-right: 1px solid var(--border-card); }
html[data-theme="light"] .card,
html[data-theme="light"] .kpi-card { background: #fff; border-color: var(--border-card); box-shadow: var(--shadow-sm); }
html[data-theme="light"] .card:hover { border-color: var(--border-hover); }

/* Testi che nel tema scuro erano forzati a bianco */
html[data-theme="light"] .kpi-value,
html[data-theme="light"] .card-title,
html[data-theme="light"] .page-title,
html[data-theme="light"] .modal-title,
html[data-theme="light"] .markdown-body h1,
html[data-theme="light"] .markdown-body h2,
html[data-theme="light"] .markdown-body h3,
html[data-theme="light"] .markdown-body th,
html[data-theme="light"] .alert-chip strong { color: var(--text-primary) !important; }

/* Catch-all per gli stili inline color:#fff / white */
html[data-theme="light"] [style*="color: #fff"],
html[data-theme="light"] [style*="color:#fff"],
html[data-theme="light"] [style*="color: white"] { color: var(--text-primary) !important; }

/* Navigazione */
html[data-theme="light"] .nav-item { color: var(--text-secondary); }
html[data-theme="light"] .nav-item.active { color: var(--accent-indigo); background: rgba(20,90,151,0.10); border-color: rgba(20,90,151,0.25); }
html[data-theme="light"] .nav-item.active i { color: var(--accent-indigo); }

/* Tabelle e input */
html[data-theme="light"] .data-table th { background: #eaf1f8; color: var(--text-secondary); }
html[data-theme="light"] .data-table td { color: var(--text-primary); }
html[data-theme="light"] .filter-select,
html[data-theme="light"] .filter-input,
html[data-theme="light"] .chat-input { background: #f1f5f9 !important; color: var(--text-primary) !important; border-color: var(--border-card) !important; }

/* Componenti finestre AI (partials) */
html[data-theme="light"] .gen-output,
html[data-theme="light"] .ai-modal-card { background: #fff !important; color: var(--text-primary) !important; border-color: var(--border-card) !important; }
html[data-theme="light"] .ai-modal-card textarea { background: #f1f5f9 !important; color: var(--text-primary) !important; }
html[data-theme="light"] .ai-modal { background: rgba(20, 90, 151, 0.25); }
html[data-theme="light"] .fw-head h1 { color: var(--text-primary); }
