* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f2f5; color: #1a1a2e; min-height: 100vh; }

.screen { display: none; }
.screen.active { display: block; }

/* DASHBOARD */
.dashboard { max-width: 800px; margin: 0 auto; padding: 24px 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; font-weight: 700; color: #2563eb; margin-bottom: 28px; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.dash-header h1 { font-size: 1.5rem; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat-num { font-size: 2rem; font-weight: 700; color: #2563eb; }
.stat-label { font-size: .8rem; color: #888; margin-top: 4px; }
.contracts-list { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08); min-height: 200px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 160px; gap: 12px; color: #bbb; }
.contract-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.contract-item:last-child { border-bottom: none; }
.contract-item:hover { background: #fafafa; }
.ci-left { display: flex; flex-direction: column; gap: 3px; }
.ci-name { font-weight: 600; }
.ci-sub { font-size: .8rem; color: #888; }
.ci-right { display: flex; gap: 8px; align-items: center; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-en-cours { background: #dbeafe; color: #1d4ed8; }
.badge-termine { background: #d1fae5; color: #065f46; }

/* BUTTONS */
.btn-primary { background: #2563eb; color: #fff; border: none; border-radius: 10px; padding: 12px 24px; font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .2s; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f1f5f9; color: #374151; border: none; border-radius: 10px; padding: 12px 24px; font-size: .95rem; font-weight: 600; cursor: pointer; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: #16a34a; color: #fff; border: none; border-radius: 10px; padding: 14px 24px; font-size: 1rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; justify-content: center; }
.btn-success:hover { background: #15803d; }
.btn-back { background: none; border: none; color: #2563eb; font-size: .95rem; cursor: pointer; font-weight: 500; }
.btn-clear { background: none; border: 1px solid #ddd; border-radius: 6px; padding: 4px 12px; font-size: .8rem; cursor: pointer; color: #888; margin-top: 6px; }
.full { width: 100%; }

/* WIZARD */
.wizard { max-width: 680px; margin: 0 auto; padding: 0 16px 40px; }
.wizard-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; margin-bottom: 8px; }
.wizard-title { font-weight: 700; font-size: 1rem; }
.wizard-steps { display: flex; align-items: center; gap: 0; }
.step { width: 28px; height: 28px; border-radius: 50%; background: #e5e7eb; color: #9ca3af; font-size: .8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: all .3s; }
.step.active { background: #2563eb; color: #fff; }
.step.done { background: #16a34a; color: #fff; }
.step-line { width: 20px; height: 2px; background: #e5e7eb; }

.step-content { display: none; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.step-content.active { display: block; }
.step-content h2 { font-size: 1.3rem; margin-bottom: 20px; color: #1a1a2e; }
.step-desc { color: #666; margin-bottom: 16px; font-size: .9rem; }

/* FORM */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span2 { grid-column: span 2; }
.form-group label { font-size: .82rem; font-weight: 600; color: #374151; }
.form-group input, .form-group select, .form-group textarea { border: 1.5px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; font-size: .9rem; outline: none; transition: border .2s; background: #fff; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #2563eb; }

/* STEP FOOTER */
.step-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid #f0f0f0; }
.step-footer .btn-primary, .step-footer .btn-success { flex: 1; }

/* PHOTOS */
.photo-zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.photo-zone { cursor: pointer; }
.photo-preview { border: 2px dashed #d1d5db; border-radius: 10px; height: 90px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: .78rem; color: #9ca3af; transition: border .2s; background: #fafafa; overflow: hidden; }
.photo-preview:hover { border-color: #2563eb; background: #eff6ff; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.photo-preview.has-photo { border-color: #16a34a; background: #f0fdf4; }
.photo-extra { margin-top: 4px; }
.extra-photos-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.extra-photo-thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; }

/* SIGNATURE */
.signature-section { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.signature-block { display: flex; flex-direction: column; gap: 8px; }
.signature-block label { font-size: .85rem; font-weight: 600; color: #374151; }
.canvas-wrap { border: 1.5px solid #e5e7eb; border-radius: 10px; overflow: hidden; background: #fafafa; cursor: crosshair; }
.canvas-wrap canvas { display: block; width: 100%; height: 150px; touch-action: none; }
.conditions { background: #f8fafc; border-radius: 10px; padding: 14px; margin-top: 4px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; font-size: .85rem; color: #4b5563; cursor: pointer; line-height: 1.5; }
.checkbox-label input { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; }

/* LOADING */
.loading-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; gap: 20px; color: #666; }
.spinner { width: 44px; height: 44px; border: 4px solid #e5e7eb; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* PHOTO SOURCE MODAL */
.photo-source-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; display: flex; align-items: center; justify-content: center; }
.psm-inner { background: #fff; border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; min-width: 260px; text-align: center; }
.psm-inner p { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }

/* MOBILE */
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span2 { grid-column: span 1; }
  .photo-zones { grid-template-columns: repeat(2, 1fr); }
  .signature-section { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card { padding: 14px 8px; }
  .stat-num { font-size: 1.5rem; }
  .wizard-steps { display: none; }
  .step-footer { flex-direction: column; }
}
