:root {
  --orange: #E95C1F;
  --orange-txt: #C24A14;
  --orange-pale: #FCE3D6;
  --marron: #5E3C2A;
  --marron-doux: #7A5A48;
  --beige: #FCF7EE;
  --bleu: #D1E7FE;
  --trait: #EADFD3;
  --blanc: #FFFFFF;
  --alerte: #8F330B;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--beige);
  color: var(--marron);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--marron); }

.page { max-width: 480px; margin: 0 auto; padding: 22px 18px 48px; display: flex; flex-direction: column; gap: 20px; }
.page.large { max-width: 1240px; }

.logo { font-weight: 800; font-size: 22px; letter-spacing: 1px; }
.playfair { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-weight: 700; }
.muted { color: var(--marron-doux); font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--marron); color: var(--beige); display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; border: none; cursor: pointer; font-family: inherit; font-size: 16px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.15; }
h2 { margin: 0; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
h3 { margin: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

.card { background: var(--blanc); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card.beige { background: var(--beige); }
.card.sombre { background: var(--marron); color: var(--beige); }
.card.alerte { border: 2px solid var(--orange); }

.hero { background: var(--orange); color: #fff; border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.hero .ligne { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hero .label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.hero .pct { font-size: 40px; font-weight: 800; }
.jauge { height: 14px; border-radius: 7px; background: rgba(255,255,255,0.35); overflow: hidden; }
.jauge > div { height: 100%; border-radius: 7px; background: #fff; }
.hero p { margin: 0; font-size: 19px; font-weight: 700; }

.jauge-o { height: 10px; border-radius: 5px; background: #F3E4D6; overflow: hidden; flex: 1; }
.jauge-o > div { height: 100%; background: var(--orange); border-radius: 5px; }

.tuiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tuile { background: var(--bleu); border-radius: 16px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.tuile b { font-size: 24px; font-weight: 800; }
.tuile span { font-size: 12px; font-weight: 600; }

.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; min-height: 48px; border-radius: 18px; padding: 14px 16px; border: none; font-family: inherit; font-size: 18px; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center; }
.btn small { font-size: 13px; font-weight: 600; opacity: 0.9; }
.btn.orange { background: var(--orange); color: #fff; }
.btn.marron { background: var(--marron); color: var(--beige); }
.btn.contour { background: transparent; color: var(--marron); border: 2px solid var(--marron); }
.btn.lien { background: transparent; color: var(--marron); font-size: 15px; text-decoration: underline; min-height: 44px; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn.petit { font-size: 15px; min-height: 44px; padding: 10px 14px; border-radius: 14px; width: auto; }

label.titre { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], select, textarea {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--marron);
  border: 2px solid var(--trait); border-radius: 14px; padding: 11px 13px; background: var(--beige);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); }
textarea { resize: vertical; }
textarea.victoire { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 17px; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > span { font-size: 14px; font-weight: 700; }
.grille2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grille3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.poids { display: flex; align-items: center; gap: 10px; }
.poids input { width: 140px; font-size: 26px; font-weight: 800; }
.poids span { font-size: 18px; font-weight: 700; }

.notes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.choix { font-family: inherit; min-height: 44px; border-radius: 12px; border: 2px solid var(--trait); background: var(--beige); color: var(--marron); font-size: 16px; font-weight: 700; cursor: pointer; padding: 6px; }
.choix.on { border-color: var(--orange); background: var(--orange); color: #fff; }
.choix.on-m { border-color: var(--marron); background: var(--marron); color: var(--beige); }
.routine { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.routine .choix { font-size: 14px; }
.ressenti-tete { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.ressenti-tete small { font-weight: 400; font-size: 12px; color: var(--marron-doux); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: inherit; font-size: 13px; font-weight: 600; background: var(--orange-pale); color: var(--marron); border: none; border-radius: 14px; padding: 7px 13px; cursor: pointer; min-height: 34px; }
.chip.on { background: var(--orange); color: #fff; font-weight: 700; }
.chip.sombre.on { background: var(--marron); color: var(--beige); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; background: var(--orange-pale); border-radius: 10px; padding: 3px 10px; }
.tag.alerte { color: var(--alerte); }

.case { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; font-weight: 600; min-height: 44px; cursor: pointer; }
.case input { width: 22px; height: 22px; accent-color: var(--orange); flex-shrink: 0; margin-top: 1px; }

details.plie { border: 2px dashed #C9B6A6; border-radius: 14px; padding: 0 16px; }
details.plie[open] { border-style: solid; border-color: var(--trait); background: var(--blanc); padding-bottom: 16px; }
details.plie summary { cursor: pointer; list-style: none; min-height: 48px; display: flex; align-items: center; font-weight: 700; font-size: 15px; }
details.plie summary::-webkit-details-marker { display: none; }
details.plie .contenu { display: flex; flex-direction: column; gap: 10px; }

.victoire-item { background: var(--blanc); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.victoire-item .tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.citation { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-weight: 600; font-size: 17px; line-height: 1.35; }

.message { padding: 12px 14px; border-radius: 14px; font-size: 15px; font-weight: 600; }
.message.ok { background: var(--bleu); }
.message.erreur { background: var(--orange-pale); color: var(--alerte); }

.photo-zone { display: flex; align-items: center; gap: 14px; }
.photo-zone img, .photo-vide { width: 96px; height: 96px; border-radius: 18px; object-fit: cover; background: var(--trait); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--marron-doux); font-size: 12px; text-align: center; }

.courbe { width: 100%; height: auto; }

/* Mur */
.mur-total { background: var(--marron); color: var(--beige); border-radius: 22px; padding: 18px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; text-align: center; }
.mur-total b { display: block; font-size: 30px; font-weight: 800; }
.mur-total span { font-size: 12px; font-weight: 600; }
.mur-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.mur-carte { background: var(--blanc); border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.mur-carte .tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mur-carte .nom { display: flex; align-items: center; gap: 10px; }
.mur-carte .nom img { width: 48px; height: 48px; border-radius: 24px; object-fit: cover; }
.mur-carte .prenom { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-weight: 700; font-size: 22px; }
.mur-carte .atteint { background: var(--orange); color: #fff; border-radius: 12px; padding: 8px 12px; font-size: 15px; font-weight: 800; text-align: center; }
.mur-carte .progr { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.mur-carte .stats { font-weight: 700; }

/* Carte à partager */
.apercu { width: 100%; max-width: 320px; margin: 0 auto; display: block; border-radius: 18px; box-shadow: 0 6px 24px rgba(94,60,42,0.18); }

/* Admin */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { background: var(--blanc); border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; }
.kpi b { font-size: 32px; font-weight: 800; }
.kpi span { font-size: 14px; font-weight: 600; }
.kpi.alerte { background: var(--orange-pale); }
.kpi.alerte b { color: #B23F0E; }
.kpi.bleu { background: var(--bleu); }
.table-box { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--marron-doux); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 10px; white-space: nowrap; }
td { padding: 11px 10px; border-top: 1px solid var(--trait); vertical-align: middle; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover { background: var(--beige); }
.colonnes { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.colonnes > .principal { flex: 999 1 560px; min-width: 0; }
.colonnes > .cote { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.mini { background: var(--beige); border-radius: 12px; padding: 10px; text-align: center; }
.mini b { display: block; font-size: 18px; font-weight: 800; }
.mini span { font-size: 12px; }
.mini.alerte { background: var(--orange-pale); color: var(--alerte); }
.fleche-haut { color: #2F6B2F; }

.chargement { padding: 60px 0; text-align: center; color: var(--marron-doux); }
.cache { display: none !important; }
