/* Bilan du soir et page de comparaison — style moderne et sobre (pas de pixel art). Tout est préfixé .pharmasim-bilan / pb-. */

.pharmasim-bilan, .pharmasim-compare {
  --pb-fond: #f6f6f4;
  --pb-surface: #ffffff;
  --pb-surface-2: #f0efec;
  --pb-bord: #e2e1dc;
  --pb-texte: #1b1b1a;
  --pb-texte-2: #52514e;
  --pb-texte-3: #77766f;
  --pb-accent: #2a78d6;
  --pb-accent-texte: #ffffff;
  --pb-ok: #0b7a0b;
  --pb-ok-fond: #e6f4e6;
  --pb-g1: #8a6d00;
  --pb-g1-fond: #fdf3d3;
  --pb-g2: #b4521f;
  --pb-g2-fond: #fde9df;
  --pb-g3: #c02f2f;
  --pb-g3-fond: #fbe3e3;
  --pb-ombre: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 1px rgba(0, 0, 0, .03);
  --pb-rayon: 10px;
  color-scheme: light;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--pb-texte);
  background: var(--pb-fond);
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pharmasim-bilan, :root:not([data-theme="light"]) .pharmasim-compare {
    --pb-fond: #121211; --pb-surface: #1c1c1b; --pb-surface-2: #262624; --pb-bord: #34342f;
    --pb-texte: #f0efec; --pb-texte-2: #c3c2b7; --pb-texte-3: #98978d;
    --pb-accent: #3987e5; --pb-ok: #4cc24c; --pb-ok-fond: #17301a;
    --pb-g1: #e0b73a; --pb-g1-fond: #33290b; --pb-g2: #ec835a; --pb-g2-fond: #3a2116; --pb-g3: #ef6b6b; --pb-g3-fond: #3d1a1a;
    --pb-ombre: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] .pharmasim-bilan, :root[data-theme="dark"] .pharmasim-compare {
  --pb-fond: #121211; --pb-surface: #1c1c1b; --pb-surface-2: #262624; --pb-bord: #34342f;
  --pb-texte: #f0efec; --pb-texte-2: #c3c2b7; --pb-texte-3: #98978d;
  --pb-accent: #3987e5; --pb-ok: #4cc24c; --pb-ok-fond: #17301a;
  --pb-g1: #e0b73a; --pb-g1-fond: #33290b; --pb-g2: #ec835a; --pb-g2-fond: #3a2116; --pb-g3: #ef6b6b; --pb-g3-fond: #3d1a1a;
  --pb-ombre: none; color-scheme: dark;
}

.pharmasim-bilan { box-sizing: border-box; min-height: 100%; padding: 24px clamp(16px, 3vw, 40px) 40px; overflow: auto; }
.pharmasim-bilan *, .pharmasim-compare * { box-sizing: border-box; }
.pharmasim-bilan h1, .pharmasim-compare h1 { font-size: 24px; line-height: 1.2; margin: 2px 0 6px; font-weight: 650; letter-spacing: -.01em; }
.pharmasim-bilan h2, .pharmasim-compare h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
.pharmasim-bilan h3, .pharmasim-compare h3 { font-size: 14px; margin: 16px 0 8px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.pharmasim-bilan code, .pharmasim-compare code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.pb-entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 auto 20px; max-width: 1200px; }
.pb-surtitre { color: var(--pb-texte-3); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.pb-meta { display: flex; gap: 16px; color: var(--pb-texte-2); font-size: 13px; flex-wrap: wrap; }
.pb-meta code { background: var(--pb-surface-2); padding: 1px 6px; border-radius: 4px; color: var(--pb-texte); }
.pb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pb-bouton { font: inherit; font-weight: 550; border: 1px solid var(--pb-bord); background: var(--pb-surface); color: var(--pb-texte); border-radius: 8px; padding: 8px 14px; cursor: pointer; box-shadow: var(--pb-ombre); }
.pb-bouton:hover { background: var(--pb-surface-2); }
.pb-bouton:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 2px; }
.pb-bouton.pb-principal { background: var(--pb-accent); border-color: var(--pb-accent); color: var(--pb-accent-texte); }
.pb-bouton.pb-principal:hover { filter: brightness(1.07); }

.pb-carte { background: var(--pb-surface); border: 1px solid var(--pb-bord); border-radius: var(--pb-rayon); padding: 18px 20px; box-shadow: var(--pb-ombre); max-width: 1200px; margin: 0 auto 16px; }
.pb-haut { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; max-width: 1200px; margin: 0 auto 16px; }
.pb-haut > .pb-carte { margin: 0; }
@media (max-width: 860px) { .pb-haut { grid-template-columns: 1fr; } }

.pb-score-titre { color: var(--pb-texte-2); font-size: 13px; font-weight: 550; }
.pb-score-nombre { display: flex; align-items: baseline; margin: 2px 0 2px; }
.pb-score-total { font-size: 52px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pb-score-max { color: var(--pb-texte-3); font-size: 18px; margin-left: 4px; }
.pb-score-sous { color: var(--pb-texte-2); font-size: 12.5px; margin-bottom: 14px; }
.pb-score-barres { display: grid; gap: 10px; }
.pb-barre-tete { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--pb-texte-2); margin-bottom: 4px; }
.pb-barre-valeur { font-variant-numeric: tabular-nums; color: var(--pb-texte); font-weight: 550; }
.pb-barre-piste { height: 8px; border-radius: 4px; background: var(--pb-surface-2); overflow: hidden; }
.pb-barre-remplie { height: 100%; border-radius: 4px; background: var(--pb-accent); }

.pb-tuiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-content: start; }
@media (max-width: 1180px) { .pb-tuiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.pb-tuile { background: var(--pb-surface); border: 1px solid var(--pb-bord); border-radius: var(--pb-rayon); padding: 12px 14px; box-shadow: var(--pb-ombre); }
.pb-tuile-libelle { color: var(--pb-texte-2); font-size: 12.5px; }
.pb-tuile-valeur { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pb-tuile-detail { color: var(--pb-texte-3); font-size: 12px; margin-top: 2px; }
.pb-tuile-alerte { border-left: 3px solid var(--pb-g2); }
.pb-tuile-ok { border-left: 3px solid var(--pb-ok); }

.pb-sommaire { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.pb-puce { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; color: var(--pb-texte); background: var(--pb-surface-2); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }
.pb-puce:hover { outline: 1px solid var(--pb-bord); }
.pb-compte { background: var(--pb-surface-2); color: var(--pb-texte-2); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 600; }
.pb-erreurs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pb-erreur { border: 1px solid var(--pb-bord); border-left-width: 4px; border-radius: 8px; padding: 10px 12px; background: var(--pb-surface); }
.pb-bord-g1 { border-left-color: var(--pb-g1); }
.pb-bord-g2 { border-left-color: var(--pb-g2); }
.pb-bord-g3 { border-left-color: var(--pb-g3); }
.pb-erreur-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--pb-texte-3); }
.pb-erreur-lieu { font-variant-numeric: tabular-nums; }
.pb-code { margin-left: auto; color: var(--pb-texte-3); }
.pb-erreur-message { margin: 6px 0 4px; font-weight: 550; }
.pb-erreur-explication { margin: 0; color: var(--pb-texte-2); font-size: 13px; }
.pb-regle { font-weight: 600; color: var(--pb-texte-2); }
.pb-gravite { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 650; border-radius: 999px; padding: 1px 8px; text-transform: uppercase; letter-spacing: .03em; }
.pb-g1 { color: var(--pb-g1); background: var(--pb-g1-fond); }
.pb-g2 { color: var(--pb-g2); background: var(--pb-g2-fond); }
.pb-g3 { color: var(--pb-g3); background: var(--pb-g3-fond); }
.pb-pastille { display: inline-block; border-radius: 999px; padding: 0 8px; font-weight: 650; font-size: 12.5px; }
.pb-ok { color: var(--pb-ok); font-weight: 600; }
.pb-sans-erreur p { color: var(--pb-ok); font-weight: 550; margin: 0; }

.pb-positif .pb-liste-ok { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; color: var(--pb-texte-2); }
.pb-remarques ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pb-remarques li { border-left: 3px solid var(--pb-accent); padding: 4px 10px; }

.pb-defile { overflow-x: auto; }
.pb-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.pb-table th { text-align: left; font-weight: 600; color: var(--pb-texte-2); font-size: 12px; border-bottom: 1px solid var(--pb-bord); padding: 8px 10px; white-space: nowrap; position: sticky; top: 0; background: var(--pb-surface); }
.pb-table td { border-bottom: 1px solid var(--pb-bord); padding: 7px 10px; white-space: nowrap; }
.pb-table tbody tr:hover td { background: var(--pb-surface-2); }
.pb-table tfoot td { border-bottom: none; color: var(--pb-texte-2); }
.pb-table .pb-total td { font-weight: 650; color: var(--pb-texte); border-top: 1px solid var(--pb-bord); }
.pb-num { text-align: right !important; }
.pb-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.pb-discret { color: var(--pb-texte-3); }
.pb-vide { text-align: center; color: var(--pb-texte-3); padding: 18px !important; }

.pb-semaine-grille { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 20px; align-items: end; margin-bottom: 14px; }
@media (max-width: 700px) { .pb-semaine-grille { grid-template-columns: 1fr; } }
.pb-jours { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; height: 150px; align-items: end; border-bottom: 1px solid var(--pb-bord); padding-bottom: 0; }
.pb-jour { display: grid; grid-template-rows: 1fr auto; height: 100%; text-align: center; }
.pb-jour-valeur { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.pb-jour-piste { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 0; }
.pb-jour-barre { width: 60%; max-width: 44px; background: var(--pb-accent); border-radius: 4px 4px 0 0; }
.pb-jour-nom { padding-top: 4px; }
.pb-jour-nom { font-size: 12px; color: var(--pb-texte-2); text-transform: capitalize; }

.pb-pied { max-width: 1200px; margin: 8px auto 0; color: var(--pb-texte-3); font-size: 12px; }

@media (max-width: 520px) {
  .pharmasim-bilan { padding: 16px; }
  .pb-score-total { font-size: 42px; }
  .pb-actions { width: 100%; }
  .pb-actions .pb-bouton { flex: 1; }
}
