/* ============================================================
   Devis Auto-Entrepreneur — feuille de style
   Design system : Minimalisme / Swiss + Trust & Authority
   Couleurs : navy #1E3A5F (primaire) · bleu #2563EB (interaction)
              vert #059669 (CTA unique) · gris Slate
   Typo : Lexend (titres) · Source Sans 3 (texte)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700;800&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  --navy: #1E3A5F;
  --navy-fonce: #16304F;
  --bleu: #2563EB;
  --bleu-fonce: #1E3A5F;
  --bleu-clair: #eff4ff;
  --cta: #059669;
  --cta-fonce: #047857;
  --vert: #16a34a;
  --rouge: #dc2626;
  --gris-900: #0f172a;
  --gris-700: #334155;
  --gris-500: #64748b;
  --gris-300: #cbd5e1;
  --gris-100: #f1f5f9;
  --blanc: #ffffff;
  --jaune: #facc15;
  --radius: 14px;
  --radius-sm: 9px;
  --ombre: 0 10px 30px rgba(15, 23, 42, .08);
  --ombre-sm: 0 2px 8px rgba(15, 23, 42, .06);
  --police: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --police-titres: "Lexend", "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--police);
  color: var(--gris-900);
  background: #f8fafc;
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4, .logo, .btn, .tab-btn { font-family: var(--police-titres); }

a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Focus visible (clavier) ---------- */
:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .6);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ---------- En-tête ---------- */
.site-header {
  background: linear-gradient(135deg, var(--navy-fonce), var(--navy));
  color: #fff;
  padding: 14px 0;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 800; font-size: 1.15rem; letter-spacing: -.3px; }
.logo span { color: var(--jaune); }
.site-header nav a { color: #dbeafe; margin-left: 18px; font-size: .95rem; }
.site-header nav a:hover { color: #fff; }

/* ---------- Héro / outil ---------- */
.hero {
  background: linear-gradient(135deg, #eef4ff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--gris-100);
  padding: 34px 0 26px;
}
.hero h1 {
  font-size: 2.1rem;
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: -.5px;
  font-weight: 700;
}
.hero .lede {
  font-size: 1.08rem;
  color: var(--gris-700);
  margin: 0 0 22px;
  max-width: 720px;
}

/* ---------- Carte outil ---------- */
.tool-card {
  background: var(--blanc);
  border: 1px solid var(--gris-100);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  overflow: hidden;
}
.tool-card .tool-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gris-100);
  display: flex; align-items: center; gap: 10px;
  background: var(--bleu-clair);
}
.tool-card .tool-head h2 { margin: 0; font-size: 1.1rem; color: var(--navy); }
.tool-ico { display: inline-flex; color: var(--navy); }
.tool-ico svg { width: 22px; height: 22px; }
.tool-card .tool-body { padding: 20px; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--gris-300);
  background: var(--blanc);
  color: var(--gris-700);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  transition: border-color .2s, color .2s, background .2s;
}
.tab-btn svg { width: 16px; height: 16px; }
.tab-btn:hover { border-color: var(--bleu); color: var(--bleu); }
.tab-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

label { font-weight: 600; font-size: .9rem; color: var(--gris-700); display: block; margin-bottom: 6px; }

textarea, input[type=text], input[type=number], input[type=email], select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--gris-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--gris-900);
}
textarea { min-height: 150px; resize: vertical; }
textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy); color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 12px 20px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: background .2s, transform .1s, box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--navy-fonce); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.cta, .btn.green { background: var(--cta); }
.btn.cta:hover, .btn.green:hover { background: var(--cta-fonce); }
.btn.secondary { background: var(--gris-100); color: var(--gris-700); }
.btn.secondary:hover { background: var(--gris-300); }
.btn.ghost { background: transparent; color: var(--bleu); border: 1px solid var(--bleu); }
.btn.ghost:hover { background: var(--bleu-clair); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- Microphone ---------- */
.mic-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mic-btn {
  width: 56px; height: 56px; min-width: 56px; border-radius: 50%;
  background: var(--rouge); color: #fff; border: none;
  cursor: pointer; transition: background .2s;
  display: flex; align-items: center; justify-content: center;
}
.mic-btn svg { width: 24px; height: 24px; }
.mic-btn:hover { background: #b91c1c; }
.mic-btn:disabled { opacity: .5; cursor: not-allowed; }
.mic-btn.recording { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(220,38,38,.5);} 70%{box-shadow:0 0 0 14px rgba(220,38,38,0);} 100%{box-shadow:0 0 0 0 rgba(220,38,38,0);} }
.privacy-note {
  flex: 1; min-width: 240px;
  font-size: .82rem; color: var(--gris-500);
  background: var(--gris-100); border-left: 3px solid var(--bleu);
  padding: 9px 12px; border-radius: 6px; margin: 10px 0 0;
}
.privacy-note b { color: var(--gris-700); }

.upload-hint { font-size: .85rem; color: var(--gris-500); margin-top: 8px; }

/* ---------- Tableau d'articles ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
.items-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.items-table th {
  text-align: left; font-size: .8rem; text-transform: uppercase;
  color: var(--gris-500); padding: 8px 6px; border-bottom: 2px solid var(--gris-300);
}
.items-table td { padding: 6px; border-bottom: 1px solid var(--gris-100); vertical-align: middle; }
.items-table input { padding: 8px 9px; font-size: .92rem; }
.items-table .col-des { width: 42%; }
.items-table .col-qty, .items-table .col-pu, .items-table .col-unit, .items-table .col-total { width: 13%; }
.items-table .col-del { width: 6%; }
.items-table .total-cell { font-weight: 700; text-align: right; white-space: nowrap; }
.del-btn {
  background: none; border: none; color: var(--rouge); cursor: pointer;
  width: 40px; height: 40px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: background .2s;
}
.del-btn:hover { background: #fee2e2; }

/* ---------- Panneau conformité ---------- */
.compliance {
  margin-top: 22px;
  border: 1px solid var(--gris-100); border-radius: var(--radius);
  background: #fff; box-shadow: var(--ombre-sm);
}
.compliance summary {
  cursor: pointer; padding: 14px 18px; font-weight: 700; color: var(--navy);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.compliance summary svg { width: 18px; height: 18px; flex: none; }
.compliance summary::-webkit-details-marker { display: none; }
.compliance .c-body { padding: 6px 18px 18px; }
.compliance .row { margin-bottom: 10px; }
.badge-ok { background: #dcfce7; color: #166534; font-size: .75rem; padding: 2px 8px; border-radius: 999px; font-weight: 700; }

/* ---------- Aperçu récapitulatif ---------- */
.preview {
  margin-top: 24px; background: #fff;
  border: 1px solid var(--gris-100); border-radius: var(--radius);
  box-shadow: var(--ombre); padding: 28px 32px;
}
.preview h3 { margin: 0 0 4px; font-size: 1.4rem; }
.preview .doc-meta { color: var(--gris-500); font-size: .85rem; margin-bottom: 18px; }
.preview .parties { display: flex; gap: 30px; flex-wrap: wrap; margin-bottom: 18px; }
.preview .parties .col { flex: 1; min-width: 220px; }
.preview .parties h4 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; color: var(--gris-500); }
.preview table.recap { width: 100%; border-collapse: collapse; margin: 10px 0 18px; }
.preview table.recap th, .preview table.recap td { border: 1px solid var(--gris-300); padding: 9px 10px; text-align: left; font-size: .92rem; }
.preview table.recap th { background: var(--gris-100); }
.preview .totaux { margin-left: auto; width: 320px; max-width: 100%; }
.preview .totaux .ligne { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--gris-300); }
.preview .totaux .ligne.grand { font-size: 1.15rem; font-weight: 800; border-bottom: none; color: var(--navy); }
.preview .mention-tva {
  margin: 14px 0; padding: 10px 14px; background: #fef9c3;
  border: 1px solid #fde047; border-radius: 8px; font-weight: 700; color: #854d0e; font-size: .95rem;
}
.preview .mentions-legales { font-size: .82rem; color: var(--gris-500); margin-top: 18px; border-top: 1px solid var(--gris-100); padding-top: 12px; }
.preview .sign { margin-top: 26px; display: flex; gap: 40px; flex-wrap: wrap; }
.preview .sign .case { border-top: 1px solid var(--gris-700); padding-top: 6px; font-size: .85rem; color: var(--gris-700); min-width: 220px; }

.empty-preview { color: var(--gris-500); text-align: center; padding: 40px 0; }

/* ---------- Sections landing ---------- */
.section { padding: 40px 0; border-bottom: 1px solid var(--gris-100); }
.section h2 { font-size: 1.7rem; margin: 0 0 10px; letter-spacing: -.3px; font-weight: 700; }
.section h3 { font-size: 1.15rem; margin: 22px 0 8px; color: var(--navy); }
.section p { color: var(--gris-700); }
.section ul { color: var(--gris-700); }
.section li { margin-bottom: 6px; }
.h2-ico { display: inline-flex; align-items: center; gap: 10px; }
.h2-ico svg { width: 26px; height: 26px; color: var(--cta); flex: none; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
.card {
  background: #fff; border: 1px solid var(--gris-100); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--ombre-sm);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--ombre); transform: translateY(-2px); }
.card h3 { margin-top: 0; color: var(--navy); }
.card .ico { color: var(--navy); margin-bottom: 8px; display: inline-flex; }
.card .ico svg { width: 28px; height: 28px; }

.steps { counter-reset: step; margin-top: 14px; }
.steps .step { position: relative; padding: 14px 0 14px 56px; border-bottom: 1px dashed var(--gris-100); }
.steps .step:before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 12px;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.steps .step h4 { margin: 0 0 4px; }
.steps .step p { margin: 0; font-size: .92rem; }

.exemple { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.exemple .box { background: #fff; border: 1px solid var(--gris-100); border-radius: var(--radius); padding: 18px; box-shadow: var(--ombre-sm); }
.exemple .box h4 { margin: 0 0 8px; font-size: .9rem; color: var(--gris-500); text-transform: uppercase; }
.exemple pre { white-space: pre-wrap; font-family: var(--police); margin: 0; font-size: .9rem; }

.faq-item { border: 1px solid var(--gris-100); border-radius: var(--radius-sm); margin-top: 12px; overflow: hidden; background: #fff; }
.faq-item summary { cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item .r { padding: 0 18px 16px; color: var(--gris-700); font-size: .95rem; }

.internal-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.internal-links a { background: var(--bleu-clair); color: var(--navy); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.internal-links a:hover { background: var(--navy); color: #fff; text-decoration: none; }

.note-maj { font-size: .82rem; color: var(--gris-500); margin-top: 14px; }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--gris-900); color: #cbd5e1; padding: 30px 0; font-size: .9rem; }
.site-footer a { color: #93c5fd; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

/* ---------- Alertes ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin: 12px 0; font-size: .92rem; }
.alert.info { background: var(--bleu-clair); color: var(--navy); border: 1px solid #bfdbfe; }
.alert.warn { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .hero h1 { font-size: 1.6rem; }
  .grid-3, .grid-2, .exemple { grid-template-columns: 1fr; }
  .preview { padding: 18px; }
  .preview .parties { flex-direction: column; gap: 14px; }
  .items-table .col-unit { display: none; }
  .items-table .col-qty, .items-table .col-pu { width: 20%; }
  .tool-card .tool-body { padding: 14px; }
  .btn-row .btn { flex: 1 1 auto; }
}
@media (max-width: 420px) {
  .hero h1 { font-size: 1.42rem; }
  .section h2 { font-size: 1.4rem; }
  .site-header nav a { margin-left: 12px; font-size: .88rem; }
}

/* ---------- Impression (Télécharger PDF) ---------- */
@media print {
  body * { visibility: hidden; }
  #preview, #preview * { visibility: visible; }
  #preview {
    position: absolute; left: 0; top: 0; width: 100%;
    box-shadow: none; border: none; padding: 0; margin: 0;
  }
  .no-print { display: none !important; }
  .tool-card, .tool-body, .hero, .site-header, .site-footer { overflow: visible !important; box-shadow: none !important; }
  .preview .mentions-legales { font-size: 11px; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .card:hover { transform: none; }
}
