:root {
  --fond: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #efedf7;
  --texte: #1c1a2b;
  --texte-doux: #5f5b75;
  --bord: #e2dff0;
  --accent: #e8771a;        /* orange chaud */
  --accent-doux: #fdeedf;
  --violet: #4b3fa8;        /* bleu-violet du ciel de la petite planète */
  --violet-doux: #e9e6fa;
  --danger: #c23a3a;
  --danger-doux: #fbe6e6;
  --ok: #2f8a57;
  --ok-doux: #e2f4ea;
  --ombre: 0 1px 2px rgba(28, 26, 43, .06), 0 4px 16px rgba(28, 26, 43, .05);
  --rayon: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #13121c;
    --surface: #1c1a29;
    --surface-2: #252336;
    --texte: #eeecf7;
    --texte-doux: #a6a2bf;
    --bord: #2f2c45;
    --accent: #ff9a45;
    --accent-doux: #3a2717;
    --violet: #9d93ff;
    --violet-doux: #2a2650;
    --danger: #ff7b7b;
    --danger-doux: #3d1d22;
    --ok: #6fd39b;
    --ok-doux: #17352a;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #13121c; --surface: #1c1a29; --surface-2: #252336; --texte: #eeecf7; --texte-doux: #a6a2bf;
  --bord: #2f2c45; --accent: #ff9a45; --accent-doux: #3a2717; --violet: #9d93ff; --violet-doux: #2a2650;
  --danger: #ff7b7b; --danger-doux: #3d1d22; --ok: #6fd39b; --ok-doux: #17352a; --ombre: 0 1px 2px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }

.entete {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bord);
}
.entete h1 { font-size: 20px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 30px; height: 30px; flex: none; }
.icone-btn {
  border: 0; background: var(--surface-2); width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.sous-titre { color: var(--texte-doux); font-size: 13px; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-doux); margin: 24px 4px 10px; }
h2:first-child { margin-top: 4px; }

.carte {
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 14px 16px; margin-bottom: 10px; display: block;
}
a.carte:active { transform: scale(.99); }
.carte h3 { margin: 0 0 4px; font-size: 17px; }
.carte p { margin: 4px 0; }
.doux { color: var(--texte-doux); }
.petit { font-size: 13px; }
.ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.puce {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--texte-doux); white-space: nowrap;
}
.puce.actif { background: var(--ok-doux); color: var(--ok); }
.puce.retard { background: var(--danger-doux); color: var(--danger); }
.puce.accent { background: var(--accent-doux); color: var(--accent); }
.puce.violet { background: var(--violet-doux); color: var(--violet); }

.action { display: flex; gap: 12px; align-items: flex-start; }
.action .rond { width: 10px; height: 10px; border-radius: 50%; background: var(--violet); margin-top: 8px; flex: none; }
.action.retard .rond { background: var(--danger); }
.action .corps { flex: 1; min-width: 0; }

.bloc { margin-bottom: 14px; }
.bloc h4 { margin: 0 0 2px; font-size: 13px; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .05em; }
.bloc p { margin: 0; }
.prochaine { border-left: 4px solid var(--accent); }

.onglets {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; margin: 8px 0 4px;
  scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }
.onglet {
  border: 1px solid var(--bord); background: var(--surface); border-radius: 999px; padding: 7px 14px;
  cursor: pointer; white-space: nowrap; font-size: 14px;
}
.onglet[aria-selected="true"] { background: var(--violet); border-color: var(--violet); color: #fff; }

.suggestion { border-style: dashed; background: var(--accent-doux); }
.citation { border-left: 3px solid var(--bord); padding-left: 10px; color: var(--texte-doux); font-style: italic; margin: 6px 0; }

.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 20px rgba(232, 119, 26, .4);
}

form .champ { display: block; margin-bottom: 14px; }
form label { display: block; font-size: 14px; color: var(--texte-doux); margin-bottom: 6px; }
textarea, input[type="password"], input[type="text"], select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--bord);
  background: var(--surface); outline: none;
}
textarea { min-height: 130px; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-doux); }
.bouton {
  width: 100%; padding: 13px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--violet); color: #fff; font-weight: 600; font-size: 16px;
}
.bouton:disabled { opacity: .6; }
.bouton.secondaire { background: var(--surface-2); color: var(--texte); }

.message { padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
.message.ok { background: var(--ok-doux); color: var(--ok); }
.message.erreur { background: var(--danger-doux); color: var(--danger); }
.message.info { background: var(--surface-2); color: var(--texte-doux); }

.markdown h1, .markdown h2, .markdown h3 { text-transform: none; letter-spacing: 0; color: var(--texte); }
.markdown h1 { font-size: 20px; } .markdown h2 { font-size: 17px; margin: 18px 0 6px; } .markdown h3 { font-size: 15px; }
.markdown ul { padding-left: 20px; margin: 6px 0; }
.markdown li { margin: 3px 0; }
.markdown blockquote { margin: 6px 0; border-left: 3px solid var(--bord); padding-left: 10px; color: var(--texte-doux); }
.markdown code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 14px; }

.vide { text-align: center; color: var(--texte-doux); padding: 28px 12px; }
.chargement { text-align: center; color: var(--texte-doux); padding: 40px; }

/* connexion */
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.page-connexion .carte { width: 100%; max-width: 380px; padding: 28px 22px; text-align: center; }
.page-connexion .logo { width: 64px; height: 64px; margin-bottom: 8px; }
.page-connexion form { text-align: left; margin-top: 18px; }
