/* Fogli di stile condivisi dei report di esempio (pm.lixem.it).
   Documenti chiari e stampabili: usare "Stampa → Salva come PDF" per esportarli. */

:root {
  --brand: #00a56e;
  --brand-dark: #006f49;
  --brand-soft: #eafaf4;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg-soft: #f8fafc;
  --pos: #047857;
  --neg: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--ink);
  font-family:
    ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* Barra di esempio */
.sample-bar {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 20px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.sample-bar a {
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 600;
}

/* Intestazione */
.report__header {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 3px solid var(--brand);
  padding-bottom: 18px;
}

.report__logo {
  height: 42px;
  width: auto;
}

.report__title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.report__title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.report__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 24px;
  margin: 20px 0 8px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.report__meta dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.report__meta dd {
  margin: 2px 0 0;
  font-weight: 600;
}

h2 {
  margin: 32px 0 12px;
  font-size: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

h3 {
  margin: 22px 0 8px;
  font-size: 14px;
}

p {
  margin: 8px 0;
}

/* KPI */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.kpi--accent {
  background: var(--brand-soft);
  border-color: #cdf3e4;
}

.kpi__value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-dark);
}

.kpi__label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

/* Tabelle */
table.data {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

table.data th,
table.data td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

table.data thead th {
  background: var(--bg-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data tfoot td {
  background: var(--bg-soft);
  font-weight: 700;
  border-top: 2px solid var(--line);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pos {
  color: var(--pos);
  font-weight: 600;
}

.neg {
  color: var(--neg);
  font-weight: 600;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge--ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.badge--warn {
  background: #fef3c7;
  color: #92400e;
}

.badge--info {
  background: #e0f2fe;
  color: #075985;
}

/* Barre (mini grafico) */
.bars {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 76px 1fr 62px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.bar-track {
  height: 12px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

/* Riquadri */
.callout {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.callout--info {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.callout--warn {
  background: #fffbeb;
  border-color: #fde68a;
}

.sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 40px;
}

.sign div {
  border-top: 1px solid var(--ink);
  padding-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.footer-note {
  margin-top: 36px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* Filigrana ESEMPIO */
.watermark {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 0;
  font-size: 120px;
  font-weight: 900;
  color: rgba(0, 165, 110, 0.06);
  transform: rotate(-18deg);
  letter-spacing: 0.1em;
}

.page > * {
  position: relative;
  z-index: 1;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.index-card {
  display: block;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.index-card:hover {
  border-color: var(--brand);
}

.index-card strong {
  display: block;
  color: var(--brand-dark);
}

.index-card span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

@page {
  size: A4;
  margin: 14mm;
}

@media print {
  body {
    background: #fff;
  }
  .sample-bar {
    display: none;
  }
  .page {
    max-width: none;
    padding: 0;
  }
  .watermark {
    position: fixed;
  }
  table.data,
  .kpi,
  .callout {
    break-inside: avoid;
  }
  h2 {
    break-after: avoid;
  }
}