:root {
  --fond: #f3f5f9; --carte: #ffffff; --encre: #16203a; --doux: #5b6680; --trait: #dde2ec;
  --accent: #2f5bd3; --accent-doux: #e6ecfb; --ok: #1f8a5b; --alerte: #b8730a; --alerte-doux: #fbf1df;
  --rouge: #c0392b; --rouge-doux: #fbe7e4; --ombre: 0 1px 2px rgba(22, 32, 58, .06), 0 4px 16px rgba(22, 32, 58, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #10151f; --carte: #18202e; --encre: #e7ecf5; --doux: #9aa6bd; --trait: #2a3446;
    --accent: #7b9cf5; --accent-doux: #22305a; --ok: #4cc28c; --alerte: #e9a53b; --alerte-doux: #3a2d14;
    --rouge: #f07a6c; --rouge-doux: #3d1f1c; --ombre: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #10151f; --carte: #18202e; --encre: #e7ecf5; --doux: #9aa6bd; --trait: #2a3446;
  --accent: #7b9cf5; --accent-doux: #22305a; --ok: #4cc28c; --alerte: #e9a53b; --alerte-doux: #3a2d14;
  --rouge: #f07a6c; --rouge-doux: #3d1f1c; --ombre: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
#appli, .connexion { max-width: 640px; margin: 0 auto; padding: 12px 16px calc(32px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0; font-weight: 600; text-transform: capitalize; }
h3 { font-size: .95rem; margin: 0 0 10px; color: var(--doux); font-weight: 600; }
.muted { color: var(--doux); }
.centre { text-align: center; font-size: .85rem; }
.ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.entete { position: sticky; top: 0; z-index: 2; background: var(--fond); padding: 4px 0 8px; }
.onglets { display: flex; gap: 6px; margin: 10px 0; overflow-x: auto; scrollbar-width: none; }
.onglets button {
  border: 1px solid var(--trait); background: var(--carte); border-radius: 999px; padding: 6px 14px; white-space: nowrap;
}
.onglets button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.mois { display: flex; align-items: center; justify-content: center; gap: 16px; }
.rond { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--trait); background: var(--carte); font-size: 1.2rem; line-height: 1; }
.discret { background: none; border: 0; color: var(--accent); padding: 6px 0; }
.principal { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; }

.carte { background: var(--carte); border-radius: 14px; padding: 16px; margin: 12px 0; box-shadow: var(--ombre); border: 1px solid var(--trait); }
.hero .eyebrow { margin: 0; color: var(--doux); font-size: .9rem; }
.hero .gros { font-size: 2.3rem; font-weight: 700; margin: 2px 0; letter-spacing: -.02em; }
.hero .gros.rouge { color: var(--rouge); }
.hero .parjour { margin: 0 0 12px; color: var(--doux); font-size: .9rem; }
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
.chiffres div { background: var(--fond); border-radius: 10px; padding: 8px 10px; }
.chiffres dt { font-size: .75rem; color: var(--doux); }
.chiffres dd { margin: 0; font-weight: 600; font-size: .95rem; }

.jauge { position: relative; height: 8px; background: var(--trait); border-radius: 99px; overflow: visible; }
.jauge i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.jauge.alerte i { background: var(--alerte); }
.jauge.depasse i { background: var(--rouge); }
.jauge b { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--encre); opacity: .45; }
.legende { font-size: .78rem; color: var(--doux); margin: 6px 0 0; }

.bandeau { display: block; width: 100%; text-align: left; border-radius: 12px; padding: 10px 14px; margin: 12px 0; background: var(--accent-doux); border: 0; font-size: .92rem; }
.bandeau.action { background: var(--alerte-doux); font-weight: 600; }
.erreur { background: var(--rouge-doux); color: var(--rouge); border-radius: 12px; padding: 10px 14px; }

.env { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--trait); padding: 10px 0; }
.env:first-child { border-top: 0; padding-top: 0; }
.env[aria-pressed="true"] .env-nom { color: var(--accent); }
.env-haut { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.env-nom { font-weight: 600; }
.env-num { font-size: .88rem; color: var(--doux); text-align: right; }
.env-num strong { color: var(--encre); }
.pastille { font-size: .7rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; }
.pastille.depasse { background: var(--rouge-doux); color: var(--rouge); }
.pastille.alerte { background: var(--alerte-doux); color: var(--alerte); }

.jour { font-size: .78rem; color: var(--doux); margin: 14px 0 4px; text-transform: capitalize; }
.jour:first-child { margin-top: 0; }
.op { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--trait); padding: 9px 0; }
.op-lib { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-mt { font-weight: 600; text-align: right; }
.op-mt.plus { color: var(--ok); }
.op-cat { font-size: .8rem; color: var(--doux); }
.op-cat .todo { color: var(--alerte); font-weight: 600; }
.op-tag { font-size: .72rem; color: var(--doux); text-align: right; }
.vide { color: var(--doux); font-size: .9rem; margin: 0; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100% - 24px)); background: var(--carte); color: var(--encre); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }
dialog form { padding: 18px; }
dialog h3 { color: var(--encre); font-size: 1.05rem; margin-bottom: 2px; }
fieldset { border: 0; padding: 0; margin: 12px 0; }
legend { font-size: .85rem; color: var(--doux); margin-bottom: 8px; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puces button { border: 1px solid var(--trait); background: var(--fond); border-radius: 999px; padding: 6px 12px; font-size: .9rem; }
.puces button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.puces button.speciale { border-style: dashed; }
.case { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; margin: 6px 0 14px; }
.case input { margin-top: 3px; }
.boutons { justify-content: flex-end; }

.connexion { padding-top: 15vh; }
.connexion form { display: grid; gap: 8px; margin: 18px 0; }
.connexion input { font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--trait); background: var(--carte); color: var(--encre); }

@media (max-width: 380px) { .hero .gros { font-size: 2rem; } .chiffres dd { font-size: .85rem; } }

/* Vue Ensemble */
:root { --p-commun: #2f5bd3; --p-perso: #1f8a5b; --p-julie: #b5489a; --p-pro: #b8730a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --p-commun: #7b9cf5; --p-perso: #4cc28c; --p-julie: #e07ac8; --p-pro: #e9a53b; } }
:root[data-theme="dark"] { --p-commun: #7b9cf5; --p-perso: #4cc28c; --p-julie: #e07ac8; --p-pro: #e9a53b; }
.p-commun { background: var(--p-commun); } .p-perso { background: var(--p-perso); } .p-julie { background: var(--p-julie); } .p-pro { background: var(--p-pro); }
.barres { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 110px; }
.barre { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; background: none; border: 0; padding: 0; gap: 4px; }
.barre .remp { width: 100%; border-radius: 4px 4px 0 0; background: var(--trait); }
.barre.on .remp { background: var(--accent); }
.barre .lab { font-size: .68rem; color: var(--doux); text-transform: uppercase; }
.legende-payeurs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--doux); margin-bottom: 8px; }
.legende-payeurs i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pole { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--trait); padding: 10px 0; }
.pole:first-child { border-top: 0; }
.pole-haut { display: flex; justify-content: space-between; gap: 10px; }
.pole-haut em { font-style: normal; color: var(--doux); font-size: .88rem; }
.empile { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--trait); margin: 7px 0 5px; gap: 1px; }
.empile i { display: block; height: 100%; }
.qui { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--doux); }
.detail { list-style: none; margin: 0 0 8px; padding: 0; font-size: .85rem; }
.detail li { display: grid; grid-template-columns: 4.2em 1fr auto; gap: 8px; padding: 4px 0; border-top: 1px dashed var(--trait); }
.detail .d { color: var(--doux); }
.detail small { color: var(--doux); }
.detail .sous { font-weight: 600; grid-template-columns: 4.2em 1fr auto; }
.projets p { display: flex; justify-content: space-between; margin: 6px 0; }
