/* ============================================================
   AM Domus CRM — contract.css
   Documento contratto A4 + stili di stampa
   ============================================================ */

.contract-toolbar {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin-bottom: 16px;
}

/* Foglio A4 a schermo */
.sheet-scroll { display: flex; justify-content: center; padding: 8px 0 40px; }
.sheet {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  box-shadow: var(--shadow-lg);
  padding: 22mm 20mm;
  color: #1a1a1a;
  font-size: 11.5px;
  line-height: 1.55;
}
@media (max-width: 900px) { .sheet { width: 100%; padding: 16mm 12mm; } }

.sheet h1, .sheet h2, .sheet h3 { color: #111; }
.contract-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2px solid #1f4e6b; padding-bottom: 10px; margin-bottom: 18px;
}
.contract-header .co { font-size: 18px; font-weight: 700; color: #1f4e6b; letter-spacing: 0.5px; }
.contract-header .co small { display: block; font-size: 10px; font-weight: 400; color: #555; letter-spacing: 1px; }
.contract-header .doc-meta { text-align: right; font-size: 10px; color: #555; }

.contract-title { text-align: center; font-size: 15px; font-weight: 700; margin: 8px 0 18px; text-transform: uppercase; letter-spacing: 0.5px; }

.contract-section { margin-bottom: 14px; }
.contract-section h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid #ccc; padding-bottom: 3px; margin-bottom: 8px; color: #1f4e6b;
}
.contract-section p { margin-bottom: 7px; text-align: justify; }

.party-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.party-grid .pg-row { display: flex; gap: 6px; padding: 2px 0; border-bottom: 1px dotted #ddd; }
.party-grid .pg-row .k { color: #555; min-width: 110px; }
.party-grid .pg-row .v { font-weight: 600; }
.full { grid-column: 1 / -1; }

.econ-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 6px; }
.econ-table td { padding: 4px 6px; border-bottom: 1px solid #e5e5e5; }
.econ-table td.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.econ-table tr.tot td { border-top: 2px solid #1f4e6b; border-bottom: none; font-weight: 700; padding-top: 7px; }

.fill { font-weight: 600; border-bottom: 1px solid #999; padding: 0 3px; display: inline-block; }
.fill.blank { font-weight: 400; border-bottom: 1px solid #999; }
.contract-section ul { margin: 4px 0 8px 20px; }
.contract-section ul li { margin-bottom: 3px; text-align: justify; }
.concede { text-align: center !important; font-weight: 700; font-style: italic; margin: 10px 0 !important; color: #1f4e6b; }
.foglio-a { page-break-before: always; }
.placeholder-note {
  background: #fff8e6; border: 1px solid #e7d196; border-radius: 4px;
  padding: 8px 10px; font-size: 10px; color: #7a5d12; margin-bottom: 16px;
}

/* Firma */
.sign-area { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.sign-box { }
.sign-box .sign-canvas-wrap {
  border: 1px solid #888; border-radius: 4px; background: #fff;
  height: 120px; position: relative; overflow: hidden;
}
.sign-box canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.sign-box .sign-img { width: 100%; height: 100%; object-fit: contain; }
.sign-box .sign-label { font-size: 10px; color: #555; margin-top: 4px; text-align: center; }
.sign-box .sign-line { border-top: 1px solid #333; margin-top: 4px; padding-top: 3px; font-size: 10px; text-align: center; }
.sign-clear { font-size: 10px; }

.accept-block {
  margin-top: 20px; padding: 10px 12px; border: 1px solid #ccc; border-radius: 4px;
  background: #fafafa; font-size: 10.5px;
}

/* ============================================================
   STAMPA — solo il foglio, niente UI
   ============================================================ */
@page { size: A4; margin: 14mm; }

@media print {
  body { background: #fff; }
  .sidebar, .page-header, .contract-toolbar, .toast-host, .sign-clear, .no-print { display: none !important; }
  .app, .main { display: block; }
  .page-body { padding: 0; }
  .sheet-scroll { padding: 0; display: block; }
  .sheet {
    width: auto; min-height: auto; box-shadow: none; padding: 0; margin: 0;
    font-size: 10.5pt;
  }
  .contract-section, .sign-area, .party-grid .pg-row { page-break-inside: avoid; }
  .placeholder-note { border-color: #bbb; background: #f5f5f5; }
  a { color: #000; text-decoration: none; }
}
