/* ===== ForfettarioCalc — site.css ===== */
/* DM Sans + DM Mono, palette verde/blu istituzionale */

:root {
    --c-bg:      #f8fafc;
    --c-surface: #ffffff;
    --c-border:  #e2e8f0;
    --c-text:    #1e293b;
    --c-muted:   #64748b;
    --c-primary: #1a56db;
    --c-primary-hover: #1449b0;
    --c-green:   #15803d;
    --c-green-bg:#f0fdf4;
    --c-yellow:  #ca8a04;
    --c-yellow-bg:#fefce8;
    --c-red:     #dc2626;
    --radius:    12px;
    --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Layout ===== */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main-layout {
    display: grid;
    gap: 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

@media (min-width: 720px) {
    .main-layout { grid-template-columns: 1fr 1fr; }
}

/* ===== Header ===== */
.site-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: .75rem 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--c-primary);
    text-decoration: none;
}

.logo-icon {
    background: var(--c-primary);
    color: #fff;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'DM Mono', monospace;
}

.nav-link {
    color: var(--c-muted);
    text-decoration: none;
    font-size: .9rem;
    margin-left: 1.25rem;
    transition: color .15s;
}

.nav-link:hover { color: var(--c-primary); }

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 100%);
    color: #fff;
    padding: 2.5rem 0 2rem;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -.02em;
}

.year-badge {
    display: inline-block;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 6px;
    padding: 0 .4em;
    font-size: .8em;
}

.hero-sub {
    margin-top: .5rem;
    opacity: .85;
    font-size: 1.05rem;
}

/* ===== Cards ===== */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--c-text);
}

/* ===== Form ===== */
.form-grid {
    display: grid;
    gap: 1rem;
}

.field { display: flex; flex-direction: column; gap: .3rem; }
.field-full { grid-column: 1 / -1; }

label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--c-text);
}

.field-hint { font-size: .75rem; color: var(--c-muted); }

input[type="number"],
select {
    border: 1.5px solid var(--c-border);
    border-radius: 8px;
    padding: .55rem .75rem;
    font-size: .95rem;
    font-family: inherit;
    color: var(--c-text);
    background: #fff;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

/* Toggle checkbox */
.toggle-label {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 18px; height: 18px;
    margin-top: 3px;
    accent-color: var(--c-primary);
    flex-shrink: 0;
}

.toggle-text { display: flex; flex-direction: column; gap: .1rem; }
.toggle-text small { font-size: .8rem; color: var(--c-muted); font-weight: 400; }

/* ===== Buttons ===== */
.btn-primary {
    margin-top: 1.25rem;
    width: 100%;
    background: var(--c-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: background .15s, transform .1s;
}

.btn-primary:hover { background: var(--c-primary-hover); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
    background: var(--c-green-bg);
    color: var(--c-green);
    border: 1.5px solid var(--c-green);
    border-radius: 8px;
    padding: .55rem 1.1rem;
    font-size: .9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
}

.btn-secondary:hover { background: #dcfce7; }

/* ===== KPI Grid ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.kpi {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: .75rem;
    text-align: center;
}

.kpi-netto {
    grid-column: 1 / -1;
    background: var(--c-green-bg);
    border-color: #86efac;
}

.kpi-label { font-size: .75rem; color: var(--c-muted); margin-bottom: .2rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.kpi-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--c-text);
}

.kpi-netto .kpi-value { font-size: 1.7rem; color: var(--c-green); }

/* ===== Chart ===== */
.chart-wrap {
    max-width: 260px;
    margin: 0 auto 1.25rem;
}

/* ===== Breakdown ===== */
.breakdown {
    margin-top: 1rem;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    overflow: hidden;
}

.breakdown summary {
    padding: .65rem .85rem;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    background: var(--c-bg);
    user-select: none;
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.breakdown-table tr:nth-child(even) td { background: #f8fafc; }

.breakdown-table td {
    padding: .45rem .85rem;
    border-top: 1px solid var(--c-border);
}

.breakdown-table td:first-child { color: var(--c-muted); font-weight: 500; }
.breakdown-table td:last-child { font-family: 'DM Mono', monospace; text-align: right; }

/* ===== Suggerimenti ===== */
.suggerimenti {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.suggerimento {
    font-size: .85rem;
    padding: .5rem .75rem;
    border-radius: 6px;
    border-left: 3px solid;
}

.sug-info  { background: #eff6ff; border-color: #3b82f6; color: #1e3a8a; }
.sug-warn  { background: var(--c-yellow-bg); border-color: var(--c-yellow); color: #713f12; }
.sug-error { background: #fef2f2; border-color: var(--c-red); color: #991b1b; }
.sug-ok    { background: var(--c-green-bg); border-color: #22c55e; color: #14532d; }

/* ===== Confronto ===== */
.confronto-card {
    margin-top: 1rem;
    background: var(--c-yellow-bg);
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: .75rem;
    font-size: .88rem;
}

.green-text { color: var(--c-green); font-weight: 700; }

/* ===== Premium bar ===== */
.premium-bar {
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.premium-tag {
    font-size: .7rem;
    font-weight: 700;
    background: var(--c-green);
    color: #fff;
    border-radius: 4px;
    padding: .15em .5em;
    letter-spacing: .04em;
}

/* ===== Ad placeholder ===== */
.ad-placeholder {
    border: 2px dashed var(--c-border);
    border-radius: 8px;
    padding: .75rem;
    text-align: center;
    color: var(--c-muted);
    font-size: .8rem;
    margin-top: 1rem;
}

/* ===== Footer ===== */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
    padding: 1rem 0;
    text-align: center;
    font-size: .8rem;
    color: var(--c-muted);
}

/* ===== Utilities ===== */
.hidden { display: none !important; }

.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

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

/* ===== Footer links ===== */
.footer-link {
    color: var(--c-muted);
    text-decoration: none;
    font-size: .8rem;
    transition: color .15s;
}
.footer-link:hover { color: var(--c-primary); }
