/* Interface de l'outil : accueil, éditeur, tableau des réponses */
:root {
  --bg: #f6f2ea; --card: #fffdf9; --ink: #2b2b27; --muted: #6a675e; --line: #e2dccf;
  --accent: #56653f; --accent-h: #6b7b58; --soft: #eef0e6;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
body { font-variant-numeric: lining-nums; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 500; font-size: 16px; color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 13px 26px; cursor: pointer; text-decoration: none; transition: background .2s; }
.btn:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.light { background: transparent; color: var(--accent); }
.btn.light:hover { background: var(--soft); }
.btn.small { padding: 8px 16px; font-size: 14px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--card); }
.logo { font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--ink); text-decoration: none; }
.logo i { color: var(--accent-h); }
.proto { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

/* Cadre de téléphone */
.phone { height: min(650px, calc(100dvh - 150px)); min-height: 420px; aspect-ratio: 320 / 650; width: auto; border-radius: 42px; background: #1f1f1d; padding: 11px; box-shadow: 0 30px 60px rgba(60, 50, 30, .22); flex: none; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 32px; background: #fff; display: block; }

/* Accueil */
.hero { max-width: 1080px; margin: 0 auto; padding: 56px 24px 40px; display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(40px, 6vw, 62px); text-wrap: balance; }
.hero h1 em { color: var(--accent-h); }
.hero .phone { height: 650px; }
.hero .lead { font-size: 19px; color: var(--muted); max-width: 30em; margin: 20px 0 28px; }
.hero .sous { font-size: 14px; color: var(--muted); margin-top: 14px; }
.etapes { max-width: 1080px; margin: 0 auto; padding: 28px 24px 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.etape { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.etape b { font-family: var(--serif); font-size: 34px; font-weight: 500; color: var(--accent-h); display: block; line-height: 1; margin-bottom: 10px; }
.etape h3 { font-size: 24px; margin-bottom: 6px; }
.etape p { margin: 0; color: var(--muted); }
.prix { max-width: 620px; margin: 30px auto 70px; padding: 34px 28px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; text-align: center; }
.prix .montant { font-family: var(--serif); font-size: 64px; line-height: 1; margin: 6px 0; }
.prix ul { list-style: none; padding: 0; margin: 18px auto 24px; display: inline-grid; gap: 6px; text-align: left; color: var(--muted); }
.prix li::before { content: '✓'; color: var(--accent-h); margin-right: 10px; font-weight: 500; }

/* Éditeur */
.editor { display: grid; grid-template-columns: minmax(340px, 480px) 1fr; height: calc(100vh - 59px); height: calc(100dvh - 59px); }
.panel { overflow-y: auto; padding: 22px 22px 120px; background: var(--card); border-right: 1px solid var(--line); }
.panel h1 { font-size: 32px; margin-bottom: 4px; }
.panel .intro { color: var(--muted); margin: 0 0 18px; }
.stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; overflow: hidden; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 18px 0 8px; min-width: 0; }
legend { font-family: var(--serif); font-size: 24px; font-weight: 500; padding: 0 10px 0 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f { display: grid; gap: 5px; margin-bottom: 12px; }
.f > span { font-size: 14px; color: var(--muted); }
.f input, .f textarea, .f select { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; width: 100%; min-width: 0; }
.f input:focus, .f textarea:focus { outline: none; border-color: var(--accent-h); box-shadow: 0 0 0 3px rgba(107, 123, 88, .18); }
.f textarea { resize: vertical; }
.bloc { background: var(--bg); border-radius: 12px; padding: 14px 14px 4px; margin-bottom: 12px; }
.bloc-t { font-weight: 500; font-size: 14px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 0 0 10px; }
.prog-row { display: grid; grid-template-columns: 84px 1fr 38px; gap: 8px; margin-bottom: 8px; }
.prog-row input { font: inherit; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; min-width: 0; background: #fff; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; font-size: 18px; color: var(--muted); }
.icon-btn:hover { color: #a3392b; border-color: #a3392b; }
.palettes { display: flex; gap: 10px; flex-wrap: wrap; }
.pal { position: relative; cursor: pointer; }
.pal input { position: absolute; opacity: 0; }
.pal span { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px 7px 8px; background: #fff; }
.pal span::before { content: ''; width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
.pal input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pal input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-zone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-zone img { width: 54px; height: 72px; object-fit: cover; border-radius: 27px 27px 6px 6px; border: 1px solid var(--line); }
.publish { position: fixed; left: 0; bottom: 0; width: min(480px, 100%); padding: 14px 22px; background: linear-gradient(transparent, var(--card) 30%); display: grid; gap: 6px; }
.publish small { color: var(--muted); text-align: center; }
.tabs { display: none; }
.err { color: #a3392b; font-weight: 500; margin: 0; }

/* Fenêtre de confirmation */
dialog { border: 0; border-radius: 20px; padding: 30px 26px; width: min(520px, calc(100% - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(40, 36, 28, .55); }
dialog h2 { font-size: 34px; margin-bottom: 8px; }
.linkbox { display: flex; gap: 8px; margin: 8px 0 16px; }
.linkbox input { flex: 1; min-width: 0; font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--bg); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.note { font-size: 14px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 16px 0 0; }

/* Tableau des réponses */
.dash { max-width: 980px; margin: 0 auto; padding: 30px 22px 80px; }
.dash h1 { font-size: 40px; }
.dash .sub { color: var(--muted); margin: 4px 0 24px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat b { font-family: var(--serif); font-size: 42px; font-weight: 500; line-height: 1; display: block; }
.stat span { color: var(--muted); font-size: 14px; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: center; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.tag.oui { background: #e3ecd6; color: #3d5222; }
.tag.non { background: #f1e1dc; color: #8a3a2a; }
.empty { text-align: center; color: var(--muted); padding: 44px 20px; }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 36px; gap: 36px; }
  .hero .lead { margin-left: auto; margin-right: auto; }
  .hero .phone { margin: 0 auto; }
  .etapes { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .editor { display: block; height: auto; }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); }
  .tabs button { font: inherit; font-weight: 500; padding: 12px; border: 0; background: none; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
  .tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
  .panel { border-right: 0; overflow: visible; }
  .stage { padding: 20px 10px 110px; }
  .editor[data-tab="form"] .stage, .editor[data-tab="apercu"] .panel { display: none; }
  .publish { width: 100%; }
  .phone { height: 600px; min-height: 0; }
  .hero .phone { height: 600px; }
}
