/* Studio FG – Aggiornamento ISTAT del canone. Tutte le regole sono limitate a .sfg-istat per non toccare il tema. */
.sfg-istat {
  --bg: #f4f5f6; --surface: #ffffff; --ink: #1d2630; --muted: #5c6773; --line: #dce0e4;
  --acc: #2a5d70; --acc-soft: #e2edf1; --up: #1f6f4a; --warn: #8f5500; --warn-soft: #fbefd9;
  --paper: #ffffff; --paper-ink: #1b1f24; --paper-line: #d9d6cf;
  color: var(--ink); font-size: 15px; line-height: 1.5; margin: 0 auto 32px; max-width: 1120px;
}
.sfg-istat * { box-sizing: border-box; }
.sfg-istat [hidden] { display: none !important; }
.sfg-istat .grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 880px) { .sfg-istat .grid { grid-template-columns: minmax(0, 1fr); } }
.sfg-istat .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.sfg-istat form { display: grid; gap: 22px; margin: 0; }
.sfg-istat fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 14px; min-width: 0; }
.sfg-istat legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--acc); padding: 0; margin-bottom: 12px; }
.sfg-istat .field { display: grid; gap: 6px; min-width: 0; }
.sfg-istat .field label, .sfg-istat .field .lbl { font-weight: 600; font-size: 14px; margin: 0; }
.sfg-istat .hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.sfg-istat input[type="number"], .sfg-istat input[type="text"], .sfg-istat input[type="date"], .sfg-istat select, .sfg-istat textarea {
  width: 100%; max-width: 100%; height: auto; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; box-shadow: none; margin: 0; min-width: 0;
}
.sfg-istat textarea { resize: vertical; min-height: 60px; }
.sfg-istat input:focus-visible, .sfg-istat select:focus-visible, .sfg-istat textarea:focus-visible, .sfg-istat button:focus-visible, .sfg-istat summary:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.sfg-istat .euro { position: relative; }
.sfg-istat .euro input[type="number"] { padding-left: 26px; font-variant-numeric: tabular-nums; }
.sfg-istat .euro::before { content: "€"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.sfg-istat .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sfg-istat .seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.sfg-istat .seg label { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-weight: 500; font-size: 13.5px; cursor: pointer; display: flex; gap: 8px; align-items: center; margin: 0; }
.sfg-istat .seg input { accent-color: var(--acc); margin: 0; }
.sfg-istat .seg label:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); }
.sfg-istat .check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 0; }
.sfg-istat .check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--acc); flex: none; }
.sfg-istat details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--acc); }
.sfg-istat details[open] summary { margin-bottom: 14px; }
.sfg-istat .results { display: grid; gap: 20px; min-width: 0; }
.sfg-istat .verdict { padding: 22px; border-radius: 10px; background: var(--acc-soft); display: grid; gap: 14px; }
.sfg-istat .verdict .big { font-size: clamp(1.35rem, 2.6vw, 1.8rem); font-weight: 700; line-height: 1.2; margin: 0; text-wrap: balance; }
.sfg-istat .verdict p { margin: 0; color: var(--muted); }
.sfg-istat .verdict p.big { color: var(--ink); }
.sfg-istat .figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .sfg-istat .figs { grid-template-columns: minmax(0, 1fr); } }
.sfg-istat .fig { background: var(--surface); border-radius: 8px; padding: 12px 14px; }
.sfg-istat .fig span { display: block; font-size: 12.5px; color: var(--muted); }
.sfg-istat .fig strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.sfg-istat .fig strong.up { color: var(--up); }
.sfg-istat .alert { padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.sfg-istat dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 14px; }
.sfg-istat dt { color: var(--muted); font-weight: 400; margin: 0; }
.sfg-istat dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sfg-istat dt.tot, .sfg-istat dd.tot { color: var(--ink); font-weight: 700; border-top: 1px solid var(--line); padding-top: 8px; }
.sfg-istat h2 { font-size: 15px; margin: 0 0 12px; }
.sfg-istat .bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.sfg-istat .bar h2 { margin: 0; }
.sfg-istat .lettera > .hint { margin-bottom: 10px; }
.sfg-istat .btn { display: inline-block; font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 6px; cursor: pointer; text-decoration: none; line-height: 1.3; }
.sfg-istat .btn.ghost { background: transparent; color: var(--ink); }
.sfg-istat .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sfg-istat .copied { font-size: 13px; color: var(--up); }
.sfg-istat .sheet-wrap { overflow-x: auto; background: var(--line); border-radius: 10px; padding: 18px; }
.sfg-istat .sheet { background: var(--paper); color: var(--paper-ink); width: 100%; max-width: 680px; margin: 0 auto; padding: 48px 52px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.55; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
@media (max-width: 560px) { .sfg-istat .sheet { padding: 28px 22px; font-size: 14px; } .sfg-istat .sheet-wrap { padding: 10px; } }
.sfg-istat .sheet p { margin: 0 0 12px; }
.sfg-istat .sheet .mitt { margin-bottom: 26px; }
.sfg-istat .sheet .dest { margin-left: auto; width: fit-content; max-width: 100%; margin-bottom: 26px; }
.sfg-istat .sheet .via { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.sfg-istat .sheet .luogo { margin-bottom: 18px; }
.sfg-istat .sheet .ogg { font-weight: 700; margin-bottom: 18px; }
.sfg-istat .sheet table { border-collapse: collapse; width: 100%; margin: 6px 0 16px; font-size: 14px; font-variant-numeric: tabular-nums; border: 0; }
.sfg-istat .sheet td { padding: 5px 0; border: 0; border-bottom: 1px solid var(--paper-line); background: none; }
.sfg-istat .sheet td:last-child { text-align: right; }
.sfg-istat .sheet tr.tot td { font-weight: 700; border-bottom: 0; }
.sfg-istat .sheet .firma { margin-top: 30px; margin-left: auto; width: fit-content; text-align: center; }
.sfg-istat .sheet .firma .riga { margin-top: 34px; border-top: 1px solid var(--paper-ink); width: 200px; }
.sfg-istat .ph { background: #fff1c2; border-radius: 2px; padding: 0 2px; }
.sfg-istat .cta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.sfg-istat .cta p { margin: 0; max-width: 52ch; }
.sfg-istat .notes { font-size: 12.5px; color: var(--muted); }
.sfg-istat .notes ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }

/* Stampa: il JS copia la lettera in #sfgi-print, figlio diretto di body; si stampa solo quello */
#sfgi-print { display: none; }
@media print {
  @page { margin: 2cm; }
  body.sfgi-stampa > *:not(#sfgi-print) { display: none !important; }
  body.sfgi-stampa #sfgi-print { display: block; }
  #sfgi-print .sheet { max-width: none; padding: 0; box-shadow: none; font-size: 12pt; }
  #sfgi-print .ph { background: none; color: transparent; border-bottom: 1px dotted #888; }
}
