body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f3f4f6;
}

/* HEADER TOP */
.topbar {
  background: #111827;
  color: white;
  padding: 20px;
  text-align: center;
}

/* LAYOUT */
.container {
  max-width: 480px;
  margin: 20px auto;
  padding: 0 16px;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,.07);
}

/* REPORT HEADER */
.report-header {
  background: linear-gradient(180deg, #0f172a, #020617);
  color: white;
  padding: 16px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.report-user {
  text-align: right;
}

/* DATI INSERITI */
.dati-box {
  background: #f1f5f9;
}

.dati-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 14px;
}

/* FORM */
label {
  display: block;
  margin-bottom: 14px;
}

input, select {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.radio-group {
  display: flex;
  gap: 10px;
}

.radio-group label {
  flex: 1;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 10px;
  text-align: center;
}

.radio-group input {
  display: none;
}

.radio-group input:checked + span {
  background: #111827;
  color: white;
  padding: 10px;
  border-radius: 8px;
  display: block;
}

/* BUTTONS */
.primary, .secondary {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  margin-top: 12px;
}

.primary { background: #2563eb; color: white; }
.secondary { background: #e5e7eb; }

/* SCENARI */
.scenario-box {
  color: white;
  padding: 16px;
  border-radius: 14px;
}

.scenario-a { background: #facc15; }
.scenario-b { background: #f59e0b; }
.scenario-c { background: #ef4444; }

.highlight {
  background: #fff7ed;
  padding: 14px;
  border-radius: 12px;
  margin: 16px 0;
}

/* TABLE */
table {
  width: 100%;
  border-collapse: collapse;
}

td {
  padding: 8px 0;
  border-bottom: 1px solid #ddd;
}

/* PDF SAFE */
#pdf-area, .card, .scenario-box {
  page-break-inside: avoid;
}
/* ================= PDF MULTIPAGE FIX ================= */

/* evita tagli a metà */
.report-header,
.dati-box,
.scenario-box,
.highlight,
.alert,
table {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* consenti continuazione su nuova pagina */
#details {
  page-break-before: auto;
}

/* spaziatura sana nel PDF */
#pdf-area > * {
  margin-bottom: 16px;
}

/* larghezza corretta A4 */
#pdf-area {
  max-width: 100%;
}
``