:root {
    --primary: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card: #ffffff;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg);
    color: #1e293b;
    margin: 0;
    padding: 20px; /* Ridotto per mobile, su desktop si espande */
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 700;
}

p { color: var(--secondary); margin-bottom: 32px; }

/* Input modernizzati */
.input-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Allineamento speciale per Scenario B */
.scenario-b {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f1f5f9;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--secondary);
}

.input-financial {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.input-financial:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Box Risultati */
.result-box {
    background: #f1f5f9;
    padding: 24px;
    border-radius: 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 32px 0;
    text-align: center;
}

.result-item strong { font-size: 1.5rem; display: block; }

/* Pulsante PDF */
.button-group {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.btn-pdf {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-pdf:active { transform: scale(0.98); }

/* Tabella Premium Centrata */
.table-container {
    width: 100%;
    margin-top: 40px;
    overflow-x: auto; /* Per scorrimento su mobile */
}

.table-container h3 {
    text-align: center;
    margin-bottom: 20px;
}

.table-container table {
    width: 100%;
    max-width: 800px; /* Centratura visiva */
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: center; /* Centrato */
    padding: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--secondary);
    border-bottom: 1px solid #e2e8f0;
}

td { 
    padding: 16px 12px; 
    border-bottom: 1px solid #f1f5f9; 
    font-weight: 500; 
    text-align: center; /* Centrato */
}

/* Grafico */
.chart-container {
    background-color: #ffffff !important;
    position: relative;
    margin: 32px 0;
    padding: 20px;
    border-radius: 12px;
    width: 100% !important;
    height: 450px !important;
    box-sizing: border-box !important;
}

/* RESPONSIVE PER TELEFONO */
@media (max-width: 600px) {
    body { padding: 10px; }
    
    .container { padding: 20px; }

    .result-box {
        flex-direction: column;
        gap: 20px;
    }

    /* Rimuove il bordo laterale su mobile */
    .result-item {
        border-left: none !important;
        padding-left: 0 !important;
    }

    .chart-container {
        height: 350px !important; /* Leggermente più basso su mobile */
        padding: 5px;
    }

    h2 { font-size: 1.4rem; text-align: center; }
    p { text-align: center; font-size: 0.9rem; }
}
/* Footer*/
.user-footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    color: var(--secondary);
}

.user-footer p {
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.user-footer strong {
    color: var(--primary);
    letter-spacing: 0.5px;
}

.user-footer small {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Sidebar e Navigazione */
.sidebar {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    background-color: #1e293b;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
}

.sidebar-header {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    letter-spacing: 1px;
}

.sidebar a {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 1rem;
    color: #94a3b8;
    display: block;
    transition: 0.3s;
    border-left: 3px solid transparent;
}

.sidebar a:hover {
    color: white;
    background: #334155;
    border-left: 3px solid var(--primary);
}

.openbtn {
    font-size: 16px;
    cursor: pointer;
    background-color: #1e293b;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    margin: 10px;
    transition: 0.3s;
}

.openbtn:hover { background-color: var(--primary); }

#main {
    transition: margin-left .5s;
}

/* Stile tabella multiprodotto */
#productTable input {
    padding: 8px;
    font-size: 0.9rem;
}

#productTable th {
    background: #f8fafc;
}
#multiResultBox {
    background: #ffffff;
    border: 2px solid var(--primary); /* Una cornice blu per farlo risaltare */
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
    padding: 30px;
    transition: all 0.3s ease;
}

#multiResultContent {
    width: 100%;
    text-align: center;
}