/* ============================================================
   AM Domus CRM — client.css
   Schermata di firma cliente (modalità distraction-free) +
   widget di upload documenti. Ottimizzata per tablet/telefono.
   ============================================================ */

/* In modalità cliente la sidebar gestionale sparisce */
body.client-mode .sidebar { display: none; }
body.client-mode .main { background: var(--c-bg); }

.client-topbar {
  background: var(--c-primary-d);
  padding: 14px 20px;
  position: sticky; top: 0; z-index: 10;
}
.client-topbar .brand { padding: 0; border: none; }
.client-topbar .brand-text strong { color: #fff; }
.client-topbar .brand-text span { color: #8fa3b3; }

.client-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  display: flex; flex-direction: column; gap: 16px;
}

.client-intro h1 { font-size: var(--fs-2xl); margin-bottom: 6px; }
.client-intro p { color: var(--c-text-2); font-size: var(--fs-md); }

.client-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.client-step-title {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-md); font-weight: 600; margin-bottom: 14px;
}
.client-step-title .dot {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  background: var(--c-primary); color: #fff; display: grid; place-items: center;
  font-size: var(--fs-sm); font-weight: 700;
}

/* ---------- Upload documenti ---------- */
.doc-person { margin-bottom: 16px; }
.doc-person:last-child { margin-bottom: 0; }
.doc-person-title {
  font-size: var(--fs-sm); font-weight: 600; color: var(--c-text-2);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px;
}
.doc-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .doc-slots { grid-template-columns: 1fr; } }

.doc-slot {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--c-surface-2);
}
.doc-slot-label { font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-2); margin-bottom: 8px; }

.doc-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  height: 110px; border: 2px dashed var(--c-border-2); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--c-muted); transition: border-color 0.12s, background 0.12s; text-align: center;
}
.doc-drop:hover { border-color: var(--c-primary); background: var(--c-primary-l); color: var(--c-primary); }
.doc-drop-icon { font-size: 26px; line-height: 1; }
.doc-drop-txt { font-size: var(--fs-sm); }

.doc-preview {
  height: 110px; border-radius: var(--radius-sm); overflow: hidden;
  background: #f0f2f5; display: grid; place-items: center;
}
.doc-preview img { width: 100%; height: 100%; object-fit: cover; }
.doc-pdf {
  width: 46px; height: 58px; border-radius: 4px; background: var(--c-danger-l); color: var(--c-danger);
  display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm);
}
.doc-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.doc-name { font-size: var(--fs-xs); color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Contratto da leggere ---------- */
.client-contract-scroll {
  max-height: 420px; overflow-y: auto;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: 4px; background: #f0f2f5;
}
.client-contract-scroll .sheet {
  width: 100%; min-height: auto; box-shadow: none; padding: 16mm 14mm; margin: 0;
}

/* ---------- Firma ---------- */
.sign-pad-block { margin-bottom: 14px; }
.sign-canvas-wrap.big { height: 180px; border: 1px solid #888; border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.sign-canvas-wrap.big canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.accept-line { align-items: flex-start; gap: 10px; font-size: var(--fs-base); line-height: 1.5; }
.accept-line input { margin-top: 2px; }

/* ---------- Footer azione ---------- */
.client-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  position: sticky; bottom: 0;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow);
}
.btn.lg { padding: 11px 22px; font-size: var(--fs-md); }

/* ---------- Post-firma ---------- */
.success-card { text-align: center; }
.success-mark {
  width: 56px; height: 56px; border-radius: 50%; background: var(--c-success-l); color: var(--c-success);
  display: grid; place-items: center; font-size: 30px; margin: 0 auto 12px;
}
.success-actions { margin-top: 16px; display: flex; justify-content: center; gap: 8px; }
.doc-review { display: flex; flex-direction: column; gap: 14px; }
.doc-review-thumbs { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.doc-thumb { width: 130px; }
.doc-thumb img { width: 130px; height: 84px; object-fit: cover; border-radius: 4px; border: 1px solid var(--c-border); }
.doc-thumb figcaption { font-size: var(--fs-xs); color: var(--c-muted); margin-top: 3px; text-align: center; }
.doc-thumb.empty { font-size: var(--fs-sm); color: var(--c-muted); }

/* ---------- Login gestionale ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--c-bg); }
.login-card {
  width: 100%; max-width: 360px; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 28px 26px;
}

/* ---------- Badge stato "inviato" ---------- */
.badge.inviato { background: #ece9fb; color: #5a43b8; }

/* ---------- Modale condivisione link ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,30,45,0.45); z-index: 200;
  display: grid; place-items: center; padding: 16px;
}
.modal {
  background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; overflow: hidden;
}
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: var(--fs-md); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.link-box {
  display: flex; gap: 6px;
}
.link-box input { flex: 1; font-family: var(--font-mono); font-size: var(--fs-sm); padding: 8px 9px; border: 1px solid var(--c-border-2); border-radius: var(--radius-sm); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.share-row .btn { flex: 1; justify-content: center; }
.modal .note { font-size: var(--fs-xs); color: var(--c-muted); background: var(--c-warning-l); border-radius: var(--radius-sm); padding: 8px 10px; }

@media print {
  body.client-mode .client-topbar, .client-footer, .success-actions, .client-intro { display: none !important; }
  .client-wrap { max-width: none; padding: 0; }
  .client-card { display: none; }
  .client-card.success-card { display: none; }
}
