/* ============================================================
   Design system Boîte à outils Maud Planner
   Fond bleu #145da0 · Orange #e18b22 (accents et boutons)
   Pêche #ffc0a7 / #fad5c7 (éléments discrets)
   Poppins (titres) · Comfortaa (corps)
   ============================================================ */

:root {
  --bleu: #145da0;
  --bleu-fonce: #0e4578;
  --bleu-clair: #2b74b8;
  --orange: #e18b22;
  --orange-fonce: #c67716;
  --peche: #ffc0a7;
  --peche-pale: #fad5c7;
  --blanc: #ffffff;
  --encre: #23364a;
  --vert: #4caf7d;
  --rouge: #e05252;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Comfortaa', system-ui, sans-serif;
  background: var(--bleu);
  color: var(--blanc);
  min-height: 100vh;
  line-height: 1.55;
}

h1, h2, h3, .btn, .revelation-chiffre {
  font-family: 'Poppins', system-ui, sans-serif;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.hidden { display: none !important; }

/* ---------- Boutons ---------- */

.btn {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 22px;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--orange);
  color: var(--blanc);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
.btn-primary:hover { background: var(--orange-fonce); }

.btn-large {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.05rem;
}

/* Un lien <a> stylé en bouton (ex. CTA « Découvrir le Planificateur ») */
a.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

.btn-ghost {
  background: transparent;
  color: var(--blanc);
  border: 2px solid rgba(255, 255, 255, 0.45);
}
.btn-ghost:hover { border-color: var(--blanc); }

.btn-danger {
  background: var(--rouge);
  color: var(--blanc);
}

.btn-back {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: var(--blanc);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Cartes ---------- */

.card {
  border-radius: var(--radius);
  padding: 16px 18px;
}

.card-peche {
  background: var(--peche-pale);
  color: var(--encre);
}
.card-peche strong { color: var(--bleu-fonce); }

/* ---------- Header d'écran ---------- */

.screen-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.step-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--peche);
}
.screen-header h2 { font-size: 1.35rem; line-height: 1.2; }

.screen-intro {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 14px;
}

/* ---------- Écran connexion ---------- */

.screen-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-inner {
  max-width: 460px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}
.auth-titre {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
}
.auth-titre .accent { color: var(--orange); }
.auth-sous { font-size: 0.95rem; color: rgba(255, 255, 255, 0.9); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input[type="email"] {
  width: 100%;
  text-align: center;
  padding: 14px;
  font-size: 1rem;
}
.auth-msg {
  font-size: 0.9rem;
  min-height: 1.2em;
  padding: 0 4px;
}
.auth-msg.ok { color: var(--peche); }
.auth-msg.erreur { color: #ffb3b3; }
.auth-note {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
}

.btn-logout {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 4px;
  padding: 6px;
}
.btn-logout:hover { color: var(--blanc); }

/* ---------- Écran accueil ---------- */

.screen-accueil { padding-top: 24px; }
.accueil-inner { display: flex; flex-direction: column; gap: 18px; }

.brand {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--peche);
}

.accueil-titre {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 800;
}
.accueil-titre .accent { color: var(--orange); }

.accueil-promesse { font-size: 1.05rem; }
.accueil-promesse strong { color: var(--peche); }

.accueil-etapes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.92rem;
}
.accueil-etapes li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.accueil-etapes .num {
  background: var(--orange);
  color: var(--blanc);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.accueil-etapes em { color: var(--peche); font-style: normal; }

.accueil-note {
  font-size: 0.78rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Cadre de travail ---------- */

.card-cadre {
  background: var(--bleu-fonce);
  padding: 0;
  margin-bottom: 14px;
  overflow: hidden;
}
.cadre-toggle {
  width: 100%;
  background: none;
  border: none;
  color: var(--blanc);
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.88rem;
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  cursor: pointer;
  text-align: left;
}
.cadre-toggle:active { background: rgba(255, 255, 255, 0.06); }

.cadre-toggle-ligne {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.cadre-toggle-cta {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--peche);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cadre-resume {
  color: var(--peche);
  font-size: 0.78rem;
  white-space: normal;
  line-height: 1.35;
}
.chevron { color: var(--peche); }

.cadre-body { padding: 0 16px 16px; }
.cadre-hint {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 10px;
}
.cadre-hint em { color: var(--peche); font-style: normal; }

.day-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.day-chip {
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: var(--blanc);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
}
.day-chip.active {
  background: var(--orange);
  border-color: var(--orange);
}

.cadre-heures-groupe { margin-top: 12px; }
.cadre-heures-groupe:first-of-type { margin-top: 4px; }
.cadre-heures-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--peche);
  margin-bottom: 6px;
}

.cadre-heures { display: flex; gap: 14px; font-size: 0.88rem; align-items: center; }
.cadre-heures select {
  margin-left: 6px;
}

select, input[type="text"] {
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--blanc);
  color: var(--encre);
}

/* ---------- Grille semaine ---------- */

.grille-wrap {
  background: var(--bleu-fonce);
  border-radius: var(--radius);
  padding: 10px 8px 12px;
}

.grille {
  display: grid;
  grid-template-columns: 30px repeat(7, 1fr);
  gap: 0 3px;
  user-select: none;
  -webkit-user-select: none;
}

.g-head {
  font-family: 'Poppins', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: center;
  padding: 4px 0 6px;
  color: var(--peche);
}

.g-time {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
  padding-right: 4px;
  transform: translateY(-6px);
}

.daycol {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
}

.slot {
  height: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}
.slot.in-window { background: rgba(255, 255, 255, 0.13); }
.slot.hour-line { border-bottom-color: rgba(255, 255, 255, 0.16); }

.bloc {
  position: absolute;
  left: 1px;
  right: 1px;
  border-radius: 5px;
  font-size: 0.58rem;
  line-height: 1.15;
  padding: 2px 3px;
  overflow: hidden;
  cursor: pointer;
  font-family: 'Comfortaa', sans-serif;
  word-break: break-word;
}
.bloc-vie {
  background: var(--peche-pale);
  color: var(--encre);
}
.bloc-perso {
  background: var(--orange);
  color: var(--blanc);
  font-weight: 700;
}
.bloc-tache {
  background: var(--blanc);
  color: var(--bleu-fonce);
  border-left: 3px solid var(--bleu-clair);
  font-weight: 600;
}
.bloc-tache.picked {
  outline: 2px solid var(--orange);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

.slot.placeable {
  background: rgba(255, 192, 167, 0.4);
  box-shadow: inset 0 0 0 1px rgba(255, 192, 167, 0.8);
  cursor: pointer;
}
.slot.placeable:hover { background: rgba(255, 192, 167, 0.6); }

.legende {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 12px 0;
  font-size: 0.72rem;
  flex-wrap: wrap;
}
.leg { display: inline-flex; align-items: center; gap: 5px; }
.leg::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}
.leg-vie::before { background: var(--peche-pale); }
.leg-perso::before { background: var(--orange); }
.leg-cadre::before { background: rgba(255, 255, 255, 0.25); }
.leg-tache::before { background: var(--blanc); box-shadow: inset 3px 0 0 var(--bleu-clair); }

.perso-rappel { margin-bottom: 14px; }
.perso-rappel p + p { margin-top: 6px; font-size: 0.88rem; }

/* ---------- Écran révélation ---------- */

.revelation-inner {
  text-align: center;
  padding: 30px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.revelation-avant { font-size: 1.05rem; }
.revelation-chiffre {
  font-size: 5rem;
  font-weight: 800;
  color: var(--orange);
  line-height: 1;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}
.revelation-apres { font-size: 1.05rem; }
.revelation-punch {
  font-size: 1rem;
  color: var(--peche);
  margin-top: 8px;
  max-width: 320px;
}
.revelation-marge {
  margin-top: 22px;
  text-align: left;
  font-size: 0.92rem;
}
.marge-detail {
  margin-top: 8px;
  font-size: 0.8rem;
  color: rgba(35, 54, 74, 0.75);
}

/* ---------- Écran tâches ---------- */

.jauge-sticky {
  position: sticky;
  top: 0;
  background: var(--bleu);
  padding: 10px 0 12px;
  z-index: 5;
}
.jauge-infos {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 6px;
}
#jauge-restant { color: var(--peche); }

.jauge-bar {
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.jauge-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--vert);
  transition: width 0.35s ease, background 0.35s ease;
}
.jauge-fill.orange { background: var(--orange); }
.jauge-fill.rouge { background: var(--rouge); }

.jauge-message {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--peche);
  min-height: 1.2em;
}
.jauge-message.alerte { color: #ffb3b3; }

.tache-form {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.tache-form input { flex: 1; min-width: 0; }
.tache-form select { width: 92px; flex-shrink: 0; }
.tache-form .btn { padding: 10px 16px; font-size: 1.2rem; flex-shrink: 0; }

.tache-compteur {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
  text-align: right;
}

.tache-liste {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.tache-item {
  background: var(--bleu-fonce);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tache-item.prio { outline: 2px solid var(--orange); }

.tache-star {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
  padding: 2px;
}
.tache-star.on { color: var(--orange); }

.tache-label {
  flex: 1;
  font-size: 0.88rem;
  word-break: break-word;
}

.tache-duree-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.tache-duree-ctrl button {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: var(--blanc);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.tache-duree-val {
  font-size: 0.8rem;
  min-width: 44px;
  text-align: center;
  color: var(--peche);
}

.tache-suppr {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px;
}

.prio-hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
}

/* ---------- Écran finale ---------- */

.finale-message { margin-bottom: 14px; }
.finale-message p { font-size: 0.95rem; }

.finale-hint {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 10px;
}
.finale-hint.actif { color: var(--peche); font-weight: 700; }

.finale-acaser { margin: 14px 0 4px; }
.acaser-titre {
  font-size: 0.82rem;
  color: var(--peche);
  margin-bottom: 8px;
}
.acaser-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.acaser-chip {
  background: var(--blanc);
  color: var(--bleu-fonce);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.acaser-chip.picked { border-color: var(--orange); }

.agenda-card { margin: 18px 0; }
.agenda-lien-ligne {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.agenda-lien-ligne input {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  padding: 10px 12px;
  color: var(--encre);
}
.agenda-lien-ligne .btn {
  flex-shrink: 0;
  padding: 10px 16px;
}
.agenda-avertissement {
  margin-top: 10px;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.75);
}

.finale-recap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.recap-jour {
  background: var(--bleu-fonce);
  border-radius: 12px;
  padding: 12px 14px;
}
.recap-jour h4 {
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  color: var(--peche);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.recap-jour ul { list-style: none; font-size: 0.85rem; }
.recap-jour li { display: flex; gap: 8px; padding: 2px 0; }
.recap-heure { color: var(--peche); flex-shrink: 0; font-size: 0.78rem; width: 84px; }
.recap-perso-tag { color: var(--orange); }

.recap-taches {
  background: var(--bleu-fonce);
  border-radius: 12px;
  padding: 12px 14px;
}
.recap-taches h4 {
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  color: var(--peche);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.recap-taches ul { list-style: none; font-size: 0.85rem; }
.recap-taches li { display: flex; gap: 8px; padding: 2px 0; }
.recap-taches .t-dur { margin-left: auto; color: var(--peche); font-size: 0.78rem; flex-shrink: 0; }
.recap-taches .t-star { color: var(--orange); }

.footer-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 50, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: var(--blanc);
  color: var(--encre);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px 30px;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 {
  font-size: 1.15rem;
  margin-bottom: 14px;
  color: var(--bleu-fonce);
}

.modal-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--bleu);
  margin: 12px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal input[type="text"], .modal select {
  background: #f2f5f8;
  width: 100%;
}
.modal select { width: auto; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  background: var(--peche-pale);
  color: var(--encre);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
}
.chip:active { background: var(--peche); }

.modal-row { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-label-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--bleu);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 12px;
}

.type-toggle { display: flex; gap: 8px; flex-wrap: wrap; }
.type-btn {
  border: 2px solid var(--peche);
  background: var(--blanc);
  color: var(--encre);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: 'Comfortaa', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
}
.type-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--blanc);
  font-weight: 700;
}

.check-recurrent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: 0.85rem;
  cursor: pointer;
}
.check-recurrent input { margin-top: 3px; accent-color: var(--orange); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--encre);
  color: var(--blanc);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow);
}

/* ---------- Shake (refus de surcharge) ---------- */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.shake { animation: shake 0.45s ease; }

@media (min-width: 480px) {
  .slot { height: 17px; }
  .bloc { font-size: 0.64rem; }
  .accueil-titre { font-size: 2.3rem; }
}
