/* styles.css */
:root{
  --bg: #f5f0e6;
  --card: rgba(255,255,255,.78);
  --card-strong: rgba(255,255,255,.90);
  --text: #1f2428;
  --muted: rgba(31,36,40,.68);
  --line: rgba(31,36,40,.12);
  --shadow: 0 12px 34px rgba(31,36,40,.10);
  --radius: 18px;

  --accent: #b9894d;
  --accent-2: #e7d2b5;

  --danger-bg: rgba(180, 70, 70, .10);
  --danger-line: rgba(180, 70, 70, .22);

  --focus: rgba(185,137,77,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1100px 500px at 20% -10%, rgba(185,137,77,.18), transparent 60%),
              radial-gradient(800px 480px at 80% 0%, rgba(185,137,77,.10), transparent 55%),
              var(--bg);
}

body.isOver{
  background: radial-gradient(1100px 500px at 20% -10%, rgba(185,137,77,.18), transparent 60%),
              radial-gradient(800px 480px at 80% 0%, rgba(185,137,77,.10), transparent 55%),
              linear-gradient(0deg, var(--danger-bg), var(--danger-bg)),
              var(--bg);
}

/* Header figé */
.topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(245,240,230,.92);
  border-bottom: 1px solid var(--line);
}
.topbar-inner{
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px; /* marge gauche / droite */
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 240px;
}

.brand-logo{
  width: 76px;
  height: auto;
  display:block;
}

.brand-titles{
  display:flex;
  flex-direction:column;
  gap: 2px;
}

.brand-title{
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .2px;
}

.brand-subtitle{
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}

.topbar-kpis{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 14px;
  min-width: 360px;
}

.kpi{
  display:flex;
  flex-direction:column;
  gap: 4px;
  min-width: 90px;
}

.kpi-wide{
  min-width: 240px;
  flex:1;
}

.kpi-label{
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value{
  font-size: 16px;
  font-weight: 800;
}

.muted{ color: var(--muted); }

.meter{
  height: 12px;
  border-radius: 999px;
  background: rgba(31,36,40,.10);
  border: 1px solid rgba(31,36,40,.12);
  overflow:hidden;
}

.meter-fill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #d0a36f);
  border-radius: 999px;
}

.page{
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px;
  padding-top: 110px; /* <-- au lieu de 20px */
}

.card{
  background: var(--card);
  border: 1px solid rgba(31,36,40,.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px;
  margin: 16px 0;
}

.card h2{
  margin: 0 0 12px;
  font-size: 26px;
  letter-spacing: -.02em;
}

.card h3{
  margin: 18px 0 10px;
  font-size: 18px;
}

.lead{
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.prose p{
  margin: 0 0 12px;
  line-height: 1.6;
}

.prose .strong{
  font-weight: 800;
}

.small{
  font-size: 13px;
  line-height: 1.5;
}

.sep{
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field label{
  display:block;
  font-weight: 700;
  margin-bottom: 6px;
}

.field input{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(31,36,40,.22);
  background: rgba(255,255,255,.88);
  outline:none;
  font-size: 14px;
}

.field input:focus{
  border-color: rgba(185,137,77,.7);
  box-shadow: 0 0 0 4px var(--focus);
}

.help{
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.invite{
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(31,36,40,.10);
  border-radius: 16px;
  padding: 14px 14px;
  margin-top: 12px;
}

.invite-title{
  font-weight: 800;
  margin-bottom: 10px;
  display:flex;
  align-items:center;
  gap: 10px;
}

.tag{
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(185,137,77,.16);
  border: 1px solid rgba(185,137,77,.30);
  color: rgba(31,36,40,.86);
}

.muted-tag{
  background: rgba(31,36,40,.06);
  border: 1px solid rgba(31,36,40,.12);
  color: rgba(31,36,40,.70);
}

.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.ruleBox{
  background: rgba(255,255,255,.60);
  border: 1px solid rgba(31,36,40,.10);
  border-radius: 16px;
  padding: 12px 14px;
}

.ruleBox.isOver{
  border-color: var(--danger-line);
  background: rgba(255,255,255,.58);
}

.ruleLine{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 12px;
  padding: 6px 0;
}

.ruleLabel{
  font-weight: 800;
  color: rgba(31,36,40,.85);
}

.ruleValue{
  font-weight: 800;
}

.btn{
  appearance:none;
  border: 1px solid rgba(31,36,40,.18);
  background: rgba(255,255,255,.75);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  cursor:pointer;
  transition: transform .05s ease, background .15s ease;
}

.btn:hover{ background: rgba(255,255,255,.92); }
.btn:active{ transform: translateY(1px); }

.btn.primary{
  background: linear-gradient(180deg, var(--accent), #d0a36f);
  border-color: rgba(185,137,77,.55);
  color: white;
}

.btn.primary:hover{ filter: brightness(1.03); }

.btn.ghost{
  background: rgba(255,255,255,.0);
  border-color: rgba(31,36,40,.18);
}

.btnRow{
  display:flex;
  align-items:center;
  gap: 14px;
  flex-wrap: wrap;
}

.hiddenTextArea{
  position:absolute;
  left:-9999px;
  top:-9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Questionnaire */
.questionList{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 12px;
}

.qRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(31,36,40,.10);
}

.qLeft{
  display:flex;
  align-items:flex-start;
  gap: 12px;
  min-width: 0;
}

.qNum{
  flex: 0 0 auto;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .08em;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(185,137,77,.14);
  border: 1px solid rgba(185,137,77,.28);
}

.qText{
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.qRight{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.scoreInput{
  width: 86px;
  text-align:center;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(31,36,40,.22);
  background: rgba(255,255,255,.92);
  font-weight: 900;
  font-size: 14px;
  outline:none;
}

.scoreInput:focus{
  border-color: rgba(185,137,77,.7);
  box-shadow: 0 0 0 4px var(--focus);
}

.scoreHint{
  font-size: 12px;
  color: var(--muted);
}

/* Résultats (cachés tant que total != 30) */
.resultsWrap{
  display:none;
}

.resultsWrap.isVisible{
  display:block;
}

.table{
  width:100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(31,36,40,.10);
  border-radius: 14px;
  overflow:hidden;
}

.table th, .table td{
  padding: 12px 12px;
  border-bottom: 1px solid rgba(31,36,40,.08);
}

.table thead th{
  font-size: 12px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--muted);
  text-align:left;
}

.table tr:last-child td{
  border-bottom: 0;
}

.right{ text-align:right; }

.footer{
  margin: 18px 0 40px;
  color: var(--muted);
  font-size: 13px;
  text-align:left;
}

/* Responsive */
@media (max-width: 820px){
  .topbar-inner{ flex-direction:column; align-items:flex-start; }
  .topbar-kpis{ width:100%; min-width: 0; justify-content:flex-start; }
  .grid2{ grid-template-columns: 1fr; }
  .brand{ min-width: 0; }
  .kpi-wide{ min-width: 0; }
}
/* ===== Résultats (barres) ===== */
.resultsCard { display:none; }
.resultsCard.isVisible { display:block; }

.bars { margin-top: 14px; display: grid; gap: 14px; }

.barRow {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: center;
}

.barLeft { display:flex; flex-direction:column; gap:6px; }
.barLabel { font-weight: 700; letter-spacing: .2px; color: rgba(25,25,25,.92); }
.barMeta { font-size: 13px; color: rgba(25,25,25,.60); }

.barTrack{
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,.03));
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
  overflow: hidden;
  position: relative;
}

.barFill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(185,137,77,.92), rgba(210,162,102,.95));
  box-shadow: 0 6px 18px rgba(185,137,77,.20);
  transition: width 260ms ease;
}

/* Option: quand total dépasse 30, on “rougit” légèrement */
body.isOver .barTrack{
  background: linear-gradient(180deg, rgba(190,40,40,.08), rgba(190,40,40,.04));
}
body.isOver .barFill{
  background: linear-gradient(90deg, rgba(190,40,40,.85), rgba(220,90,90,.85));
  box-shadow: 0 6px 18px rgba(190,40,40,.18);
}

@media (max-width: 640px){
  .barRow{ grid-template-columns: 1fr; gap: 8px; }
  .barLeft{ flex-direction: row; justify-content: space-between; align-items: baseline; }
}
.kpi-status--low {
  color: #000; /* noir */
}

.kpi-status--ok {
  color: #2e7d32; /* vert */
  font-weight: 600;
}

.kpi-status--high {
  color: #c62828; /* rouge */
  font-weight: 600;
}
/* Lien-bouton (copie email) */
.linkLike{
  border:0;
  background:transparent;
  padding:0;
  font:inherit;
  color:inherit;
  text-decoration:underline;
  cursor:pointer;
}
.linkLike:hover{ opacity:.85; }
.linkLike:focus-visible{
  outline:2px solid rgba(0,0,0,.35);
  outline-offset:2px;
  border-radius:6px;
}

/* Mini feedback “copié” */
.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  padding:10px 12px;
  border-radius:12px;
  background:rgba(20,20,20,.92);
  color:#fff;
  font-size:14px;
  z-index:99999;
  box-shadow:0 10px 24px rgba(0,0,0,.18);
  opacity:0;
  pointer-events:none;
  transition:opacity .15s ease, transform .15s ease;
}
.toast.show{
  opacity:1;
  transform:translateX(-50%) translateY(-4px);
}
/* Texte plus compact – section Transmettre mes résultats */
.card[aria-label="Transmettre mes résultats"] .lead{
  line-height: 1.35;
  margin-bottom: 0.6em;
}
.emailCopy{
  border:0;
  background:none;
  padding:0;
  font:inherit;
  color:inherit;
  text-decoration:underline;
  cursor:pointer;
}
.emailCopy:hover{ opacity:.85; }
.emailCopy:focus-visible{
  outline:2px solid rgba(0,0,0,.35);
  outline-offset:2px;
  border-radius:4px;
}
.home {
  max-width: 900px;
  margin: 0 auto;
  padding: 64px 24px;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.2em;
}

.hero h2 {
  font-weight: 400;
  color: #666;
  margin-bottom: 1.5em;
}

.hero p {
  line-height: 1.6;
  margin-bottom: 1em;
}

.hero .note {
  margin-top: 1.5em;
  font-style: italic;
}

.cta {
  margin-top: 2.5em;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
/* Bouton "Retour à l’accueil" - topbar */
.topLink{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.18);
  background:rgba(255,255,255,.65);
  color:#2b2b2b;
  text-decoration:none;
  font-weight:600;
  line-height:1;
  box-shadow:0 1px 0 rgba(0,0,0,.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.topLink:hover{
  transform: translateY(-1px);
  background:rgba(255,255,255,.9);
  border-color: rgba(0,0,0,.28);
}
.topLink:active{
  transform: translateY(0);
}
.topLink:focus-visible{
  outline:2px solid rgba(0,0,0,.35);
  outline-offset:2px;
}
.topLink-ico{
  font-size:18px;
  opacity:.85;
}
.topLink-txt{
  font-size:14px;
  letter-spacing:.1px;
}
.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.brand-titles{
  display:flex;
  flex-direction:column;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:16px;
}

/* Optionnel : éviter que ça casse trop tôt */
.topbar-kpis{
  display:flex;
  align-items:center;
  gap:14px;
}
.topbar-inner{
  display:flex;
  align-items:center;
  gap:20px;
}

/* Bloc gauche */
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  flex-shrink:0;
}

/* KPI = bloc principal */
.topbar-kpis{
  display:flex;
  align-items:center;
  gap:16px;
  flex:1;                /* ← PREND LA PLACE */
  justify-content:center;
}

/* Barre centrale plus large */
.kpi-wide{
  flex:1;
  min-width:220px;
}

/* Bouton retour tout à droite */
.topLink{
  display:flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:8px;
  text-decoration:none;
  font-size:0.9rem;
  white-space:nowrap;
  opacity:.7;
  transition:opacity .2s, background .2s;
}

.topLink:hover{
  opacity:1;
  background:rgba(0,0,0,.05);
}
.topLink{
  display:inline-flex;
  align-items:center;
  gap:6px;

  background: linear-gradient(180deg, var(--accent), #d0a36f);
  color: #fff;

  padding:8px 14px;
  border-radius:999px;
  font-size:0.9rem;
  font-weight:600;
  text-decoration:none;

  border:1px solid rgba(185,137,77,.55);
  box-shadow:0 2px 6px rgba(0,0,0,.15);

  transition:transform .15s, box-shadow .15s, filter .15s;
}

.topLink:hover{
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow:0 4px 10px rgba(0,0,0,.2);
}

.topLink:active{
  transform: translateY(1px);
}

.topLink,
.topLink:visited{
  color:#fff;
}