/* Étincelles — charte « ciel rose » : rose #F2B9BC, jaune #F1E5B4, bleu #BDDEE2, pêche #FDD0AF.
   Polices libres hébergées ici (aucun appel à un service externe). Pour changer une police : modifier les 4 variables --f-* */
@font-face { font-family: 'Dancing Script'; font-weight: 600; font-display: swap; src: url(/fonts/dancing-script-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Dancing Script'; font-weight: 700; font-display: swap; src: url(/fonts/dancing-script-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 400; font-display: swap; src: url(/fonts/nunito-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url(/fonts/nunito-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-display: swap; src: url(/fonts/nunito-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Courgette'; font-weight: 400; font-display: swap; src: url(/fonts/courgette-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Caveat Brush'; font-weight: 400; font-display: swap; src: url(/fonts/caveat-brush-latin-400-normal.woff2) format('woff2'); }

:root {
  --rose: #F2B9BC; --rose-2: #EEACBA; --jaune: #F1E5B4; --bleu: #BDDEE2; --peche: #FDD0AF;
  --fond: #FFF6F3; --carte: #FFFFFF; --ink: #4A3550; --ink-2: #7A6680; --prune: #7A4A6B; --prune-2: #5E3652;
  --ok: #3F9A74; --danger: #C9495A; --ligne: #F0DDE0;
  --f-titre: 'Dancing Script', 'Snell Roundhand', cursive;
  --f-sous: 'Courgette', 'Dancing Script', cursive;
  --f-texte: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --f-note: 'Caveat Brush', 'Courgette', cursive;
  --rayon: 18px;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-texte); color: var(--ink); line-height: 1.5;
  background: linear-gradient(180deg, #FDE7EA 0%, var(--fond) 260px) no-repeat, var(--fond); min-height: 100vh; }
#app { width: 100%; min-height: 100vh; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-family: var(--f-titre); font-size: 2.6rem; font-weight: 700; line-height: 1.1; }
h2 { font-family: var(--f-sous); font-size: 1.5rem; font-weight: 400; }
h3 { font-size: 1.05rem; font-weight: 700; }
a { color: var(--prune); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---- En-tête et menu ---- */
.entete { position: sticky; top: 0; z-index: 20; background: rgba(255,246,243,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ligne); padding: calc(10px + env(safe-area-inset-top)) 24px 10px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--prune-2); }
.logo img { width: 42px; height: 42px; border-radius: 12px; }
.logo span { font-family: var(--f-titre); font-size: 2rem; font-weight: 700; }
.menu { display: flex; gap: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a { font-family: var(--f-sous); text-decoration: none; color: var(--ink); padding: 8px 18px; border-radius: 999px; white-space: nowrap; background: transparent; border: 2px solid transparent; }
.menu a.on { background: var(--jaune); border-color: var(--peche); }
.menu a:hover { background: #FBE3E6; }
.menu a.on:hover { background: var(--jaune); }
.reglages { text-decoration: none; font-size: 1.4rem; color: var(--ink-2); }

main { padding: 26px 24px 120px; width: 100%; }
.titre-page { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.sous { color: var(--ink-2); margin: 4px 0 0; }

/* ---- Boutons ---- */
.btn { border: 0; border-radius: 999px; padding: 10px 22px; background: var(--prune); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--prune-2); }
.btn.clair { background: #fff; color: var(--prune); border: 2px solid var(--rose); }
.btn.clair:hover { background: #FBE3E6; }
.btn.jaune { background: var(--jaune); color: var(--prune-2); border: 2px solid var(--peche); }
.btn.petit { padding: 6px 14px; font-size: .9rem; }
.btn.danger { background: #fff; color: var(--danger); border: 2px solid #F3C4CA; }
.btn:disabled { opacity: .5; cursor: default; }
.icone { border: 0; background: #FBE3E6; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; color: var(--prune); }
.icone:disabled { opacity: .3; }

/* ---- Cartes ---- */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.carte { background: var(--carte); border-radius: var(--rayon); padding: 18px 20px; box-shadow: 0 2px 14px rgba(122,74,107,.08); border: 1px solid var(--ligne); position: relative; }
.carte.lien { cursor: pointer; transition: transform .12s; }
.carte.lien:hover { transform: translateY(-2px); }
.carte h3 { font-family: var(--f-sous); font-weight: 400; font-size: 1.3rem; margin-bottom: 4px; }
.carte p { margin: 4px 0; color: var(--ink-2); }
.rang { position: absolute; top: -10px; left: -6px; background: var(--jaune); border: 2px solid var(--peche); color: var(--prune-2); font-weight: 800; border-radius: 999px; min-width: 32px; height: 32px; display: grid; place-items: center; }
.carte .actions { display: flex; gap: 6px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.pastille { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--bleu); color: var(--ink); }
.pastille.cours { background: var(--jaune); } .pastille.pause { background: #E9DDF0; } .pastille.fini { background: #CDEBDC; } .pastille.idee { background: #FBE3E6; }
.palette { display: flex; height: 22px; border-radius: 8px; overflow: hidden; margin: 8px 0; }
.palette i { flex: 1; }
.vide { color: var(--ink-2); font-family: var(--f-sous); padding: 30px 10px; text-align: center; }

/* ---- Onglets internes ---- */
.onglets { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.onglets a { text-decoration: none; padding: 8px 20px; border-radius: 999px; background: #fff; border: 2px solid var(--ligne); color: var(--ink); font-weight: 700; }
.onglets a.on { background: var(--rose); border-color: var(--rose-2); }
.onglets a small { opacity: .7; margin-left: 6px; }

/* ---- Formulaires ---- */
.section { background: var(--carte); border-radius: var(--rayon); border: 1px solid var(--ligne); padding: 20px 24px; margin-bottom: 22px; box-shadow: 0 2px 14px rgba(122,74,107,.06); }
.section > h2 { margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.section > h2 b { font-family: var(--f-texte); background: var(--jaune); border: 2px solid var(--peche); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; font-size: 1rem; }
.champ { margin-bottom: 14px; }
.champ label { display: block; font-weight: 700; margin-bottom: 4px; font-size: .95rem; }
.champs2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 20px; }
input[type=text], input[type=url], input[type=password], select, textarea { width: 100%; padding: 10px 14px; border: 2px solid var(--ligne); border-radius: 14px; background: #FFFCFB; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rose-2); background: #fff; }
textarea { min-height: 120px; resize: vertical; }
textarea.grand { min-height: 260px; }
.puces { display: flex; gap: 8px; flex-wrap: wrap; }
.puce { border: 2px solid var(--ligne); background: #fff; border-radius: 999px; padding: 6px 16px; cursor: pointer; font-weight: 700; }
.puce.on { background: var(--bleu); border-color: #9CCBD2; }
.ligne-ajout { display: flex; gap: 8px; }
.ligne-ajout input { flex: 1; }
.liste-simple { list-style: none; padding: 0; margin: 10px 0; }
.liste-simple li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--ligne); }
.liste-simple li .texte { flex: 1; word-break: break-word; }
.liste-simple li.fait .texte { text-decoration: line-through; opacity: .55; }
.note { font-family: var(--f-note); font-size: 1.25rem; line-height: 1.25; }
.vignettes { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.vignette { position: relative; }
.vignette img { height: 110px; max-width: 220px; object-fit: cover; border-radius: 12px; border: 1px solid var(--ligne); display: block; cursor: zoom-in; background: #fff; }
.vignette button { position: absolute; top: -8px; right: -8px; }
.vignettes.petites .vignette img { height: 56px; }
.vignettes.grandes .vignette img { height: min(380px, 60vw); max-width: 100%; }
.choix-mb { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.choix-mb .carte { padding: 12px; cursor: pointer; border: 3px solid transparent; }
.choix-mb .carte.on { border-color: var(--prune); }
.envoi { width: 100%; min-height: 220px; font-size: .88rem; font-family: ui-monospace, Menlo, monospace; background: #FFFCFB; }
.barre-etat { position: sticky; bottom: 10px; display: flex; justify-content: center; pointer-events: none; }
.barre-etat span { background: var(--prune); color: #fff; padding: 6px 18px; border-radius: 999px; font-size: .9rem; opacity: 0; transition: opacity .3s; }
.barre-etat span.on { opacity: .95; }
.avert { background: #FFF1D6; border: 2px solid var(--peche); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; }

/* ---- Statistiques ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-bottom: 22px; }
.chiffre { font-family: var(--f-titre); font-size: 3.2rem; font-weight: 700; color: var(--prune); line-height: 1; }
.barre { height: 16px; border-radius: 999px; background: #F8E9EB; overflow: hidden; margin: 4px 0 10px; }
.barre i { display: block; height: 100%; background: linear-gradient(90deg, var(--rose-2), var(--peche)); }

/* ---- Note rapide ---- */
.fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 30; border: 0; cursor: pointer; border-radius: 999px; padding: 14px 22px; background: var(--jaune); color: var(--prune-2); border: 3px solid var(--peche); font-family: var(--f-note); font-size: 1.3rem; box-shadow: 0 6px 20px rgba(122,74,107,.25); }
.voile { position: fixed; inset: 0; background: rgba(74,53,80,.45); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modale { background: #fff; border-radius: 22px; padding: 22px 24px; width: min(560px, 100%); max-height: 92vh; overflow: auto; }
.modale h2 { margin-bottom: 12px; }
.apercu { max-width: 94vw; max-height: 90vh; border-radius: 14px; }

/* ---- Connexion ---- */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.connexion .carte { width: min(440px, 100%); padding: 28px; text-align: center; }
.connexion img { width: 84px; border-radius: 22px; margin-bottom: 8px; }
.connexion .champ { text-align: left; }
.erreur { color: var(--danger); font-weight: 700; min-height: 1.4em; }

@media (max-width: 640px) {
  html { font-size: 106%; }
  h1 { font-size: 2.1rem; } main { padding: 18px 14px 120px; } .entete { padding-left: 14px; padding-right: 14px; gap: 10px; }
  .section { padding: 16px; } .grille { grid-template-columns: 1fr; }
}
@media (prefers-color-scheme: dark) { .reglages { color: #999; } }
