/* ===================================
   BILANCIO - LAYOUT GENERALE
   =================================== */

.bilancio-header {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 2rem;
}

.bilancio-anno-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bilancio-anno-selector label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.bilancio-anno-selector select {
    max-width: 200px;
}

/* ===================================
   DASHBOARD KPI
   =================================== */

.bilancio-dashboard {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.kpi-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.kpi-ricavi {
    border-left: 4px solid #28a745;
}

.kpi-ricavi .kpi-icon {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.kpi-costi {
    border-left: 4px solid #dc3545;
}

.kpi-costi .kpi-icon {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.kpi-utile {
    border-left: 4px solid #5b63f5;
}

.kpi-utile .kpi-icon {
    background: rgba(91, 99, 245, 0.1);
    color: #5b63f5;
}

.kpi-utile.perdita {
    border-left-color: #dc3545;
}

.kpi-utile.perdita .kpi-icon {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.kpi-margine {
    border-left: 4px solid #17a2b8;
}

.kpi-margine .kpi-icon {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ===================================
   GRAFICI
   =================================== */

.bilancio-grafici {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.grafico-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

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

.grafico-card h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grafico-card canvas {
    max-height: 400px;
}

/* ===================================
   TABELLE ANALITICHE
   =================================== */

.bilancio-tabelle {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.bilancio-tabelle>h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    grid-column: 1 / -1;
}

.bilancio-tabelle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.tabella-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

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

.tabella-card h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.bilancio-table {
    width: 100%;
    border-collapse: collapse;
}

.bilancio-table thead {
    background: var(--brand-primary);
    color: white;
}

.bilancio-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.bilancio-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.bilancio-table tbody tr:hover:not(.empty-state) {
    background: var(--bg-tertiary);
}

.bilancio-table td {
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.bilancio-table .empty-state td {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 768px) {
    .bilancio-dashboard {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .bilancio-grafici {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .bilancio-tabelle {
        grid-template-columns: 1fr;
        padding: 0 1rem 2rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .grafico-card canvas {
        max-height: 300px;
    }
}