:root {
  --primary: #1e3a8a;
  --primary-light: #3b5bd9;
  --accent: #c9a84c;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --bg: #f5f7fb;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(30, 58, 138, 0.06);
  --shadow: 0 6px 24px rgba(30, 58, 138, 0.10);
  --shadow-lg: 0 16px 48px rgba(30, 58, 138, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Poppins', -apple-system, sans-serif;
  background: linear-gradient(135deg, #f5f7fb 0%, #eef2ff 100%);
  min-height: 100vh;
  color: var(--gray-800);
  line-height: 1.5;
}

.secure-bar {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  gap: 10px;
  flex-wrap: wrap;
}
.secure-bar .left { display: flex; gap: 16px; align-items: center; }
.secure-bar .badge {
  background: rgba(255,255,255,0.15);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.secure-bar .badge i { color: #34d399; }
.secure-bar .domain { opacity: 0.9; font-family: monospace; font-size: 12px; }
.timer { display: flex; gap: 8px; align-items: center; }
.timer span { font-weight: 700; }

.loading-state, .error-state {
  max-width: 420px;
  margin: 80px auto;
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-600);
}
.spinner {
  width: 50px; height: 50px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-state i { font-size: 48px; color: var(--danger); margin-bottom: 14px; }
.error-state h2 { font-size: 20px; color: var(--gray-900); margin-bottom: 8px; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.agency-header {
  text-align: center;
  margin-bottom: 24px;
  padding: 24px 0;
}
.agency-logo {
  width: 90px; height: 90px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.agency-logo img { width: 100%; height: 100%; object-fit: contain; }
.agency-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0.5px;
}
.agency-tagline { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.card-subtitle { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }

.hero-offer {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-bottom: 20px;
  text-align: center;
}
.hero-offer .eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 8px;
}
.hero-offer h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.hero-offer p { font-size: 14px; opacity: 0.9; }

.mandat-badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.offer-box {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.offer-box.counter { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-color: var(--warning); }
.offer-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #047857;
}
.offer-box.counter .offer-label { color: #92400e; }
.offer-amount {
  font-size: 38px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  margin: 4px 0;
}
.offer-amount-letters { font-size: 12px; color: var(--gray-600); font-style: italic; margin-bottom: 16px; }

.btn {
  padding: 16px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
.btn-accept { background: linear-gradient(135deg, var(--success), #059669); color: white; box-shadow: 0 4px 16px rgba(16,185,129,0.3); }
.btn-accept:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-reject { background: white; color: var(--danger); border: 2px solid var(--gray-200); }
.btn-reject:hover { background: #fef2f2; border-color: var(--danger); }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-lg { padding: 18px 28px; font-size: 16px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.action-buttons { display: flex; flex-direction: column; gap: 10px; }

.signature-wrap {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  background: #fafbfd;
  padding: 4px;
}
.signature-canvas {
  display: block;
  width: 100%;
  height: 180px;
  background: white;
  border-radius: 10px;
  touch-action: none;
  cursor: crosshair;
}
.signature-actions { display: flex; gap: 8px; margin-top: 10px; }
.signature-mode-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 12px;
}
.signature-mode-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 8px;
}
.signature-mode-tab.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }

.checkbox-row {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: var(--gray-50);
  border-radius: 10px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
}
.checkbox-row label { font-size: 13px; color: var(--gray-700); cursor: pointer; line-height: 1.5; }

.call-agent-box {
  margin-top: 18px;
  padding: 14px 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.call-agent-box i { color: #0284c7; font-size: 20px; margin-top: 2px; }
.call-agent-box a { color: #0284c7; font-weight: 600; text-decoration: none; }

.form-input, .form-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: white;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,58,138,0.1);
}
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-textarea { min-height: 80px; resize: vertical; }

/* Timeline / historique tours */
.timeline {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.timeline-title { font-size: 13px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; }
.timeline-item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
}
.timeline-dot.acq { background: var(--primary); }
.timeline-dot.prop { background: var(--accent); }
.timeline-amount { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.timeline-who { font-size: 11px; color: var(--gray-500); text-transform: uppercase; font-weight: 600; }
.timeline-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* Succès */
.success-screen { text-align: center; padding: 40px 20px; }
.success-icon {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, var(--success), #059669);
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 42px;
  animation: scaleIn 0.4s ease-out;
}
@keyframes scaleIn { from { transform: scale(0); } to { transform: scale(1); } }

/* Pied de page légal */
.legal-footer {
  margin-top: 40px;
  padding: 24px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  font-size: 11px;
  color: var(--gray-600);
  line-height: 1.6;
}
.legal-footer-header { display: flex; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--gray-100); align-items: center; }
.legal-footer-logo { width: 48px; height: 48px; }
.legal-footer-logo img { width: 100%; height: 100%; object-fit: contain; }
.legal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.legal-block-title { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.legal-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.legal-badge { display: inline-flex; gap: 4px; padding: 4px 8px; background: var(--gray-50); border-radius: 6px; font-size: 10px; color: var(--gray-600); }
.legal-badge i { color: var(--primary); }

@media (max-width: 600px) {
  .secure-bar { flex-direction: column; gap: 6px; padding: 8px 12px; }
  .offer-amount { font-size: 32px; }
}
