/* Charte IDEOZ : teal pour la structure, bordeaux en accent rare. */
:root {
  --teal: #0F746B; --teal-fonce: #0A4F49; --teal-pale: #E6F0EE; --teal-trait: #C9E3DF;
  --bordeaux: #791618; --bordeaux-pale: #F6E7E7;
  --fond: #F6F8F7; --carte: #fff; --texte: #1A1C1C; --texte-2: #4A5A58;
  --bouton: #0F746B; --sur-bouton: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --teal: #6CCFC3; --teal-fonce: #C9E3DF; --teal-pale: #0F4D47; --teal-trait: #1B665F;
    --bordeaux: #F0A3A5; --bordeaux-pale: #4A1516;
    --fond: #073A36; --carte: #0A4F49; --texte: #F1F6F5; --texte-2: #B9D2CE;
    --bouton: #C9E3DF; --sur-bouton: #073A36;
  }
}

/* Polices de la charte, hébergées avec le site (rien n'est demandé à Google). */
@font-face { font-family: 'Quicksand'; font-weight: 400; font-display: swap; src: url('quicksand-400.woff2') format('woff2'); }
@font-face { font-family: 'Quicksand'; font-weight: 500; font-display: swap; src: url('quicksand-500.woff2') format('woff2'); }
@font-face { font-family: 'Quicksand'; font-weight: 600; font-display: swap; src: url('quicksand-600.woff2') format('woff2'); }
@font-face { font-family: 'Quicksand'; font-weight: 700; font-display: swap; src: url('quicksand-700.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 400; font-display: swap; src: url('nunito-sans-400.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 600; font-display: swap; src: url('nunito-sans-600.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 700; font-display: swap; src: url('nunito-sans-700.woff2') format('woff2'); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 'Nunito Sans', Arial, sans-serif;
}
h1, h2, .chiffre { font-family: 'Quicksand', 'Nunito Sans', Arial, sans-serif; }
h1 { margin: 0; font-size: 1.7rem; font-weight: 500; letter-spacing: .01em; color: var(--teal); }
h2 { margin: 0 0 18px; font-size: 1.25rem; font-weight: 500; letter-spacing: .01em; color: var(--teal); }
/* La « virgule » bordeaux de la charte, sous chaque titre de carte. */
h2::after { content: ''; display: block; width: 28px; height: 3px; margin-top: 8px; border-radius: 3px; background: var(--bordeaux); opacity: .8; }
h3 { margin: 24px 0 6px; font-size: 1rem; color: var(--texte); }
p { margin: 0 0 12px; }

header, main { max-width: 760px; margin: 0 auto; padding: 16px; }
/* Motif du logo (cercles reliés) en filigrane derrière l'en-tête. */
header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 28px;
  background: url('motif.svg') right -30px top -20px / 340px auto no-repeat; }
.titre { flex: 1 1 200px; }
/* Logo toujours sur pastille blanche ronde, y compris en mode sombre. */
.pastille { flex: none; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.surtitre {
  margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--bordeaux);
}
.surtitre::before { content: ''; display: inline-block; width: 18px; height: 2px; margin-right: 8px; vertical-align: middle; background: var(--bordeaux); }

.carte {
  background: var(--carte); border-radius: 22px; padding: 28px 24px; margin-bottom: 22px;
  box-shadow: 0 10px 30px -18px rgba(15, 116, 107, .45), 0 1px 2px rgba(0, 0, 0, .04);
}
.onglets { display: flex; gap: 4px; margin-bottom: 22px; padding: 4px; border-radius: 999px; background: var(--teal-pale); }
.onglets button { flex: 1; padding: 10px 8px; font-family: 'Quicksand', 'Nunito Sans', Arial, sans-serif; font-weight: 600; color: var(--teal); background: transparent; }
.onglets button[aria-pressed="true"] { color: var(--sur-bouton); background: var(--bouton); border-color: var(--bouton); }
.exercices { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.exercices button:disabled { cursor: default; }
.operations td:first-child { white-space: nowrap; }
.operations th:nth-child(2), .operations td:nth-child(2) { text-align: left; overflow-wrap: anywhere; }
.barre { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.barre label { flex: 1 1 140px; }

#message { padding: 12px 16px; border-radius: 12px; background: var(--teal-pale); font-weight: 600; }
#message.erreur { background: var(--bordeaux-pale); color: var(--bordeaux); }

form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
form .large, form button { grid-column: 1 / -1; }
label { display: block; font-size: .9rem; font-weight: 600; color: var(--texte-2); }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; min-height: 44px;
  font: inherit; color: var(--texte); background: var(--fond);
  border: 1px solid var(--teal-trait); border-radius: 10px;
}
.case { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.case input { width: 20px; height: 20px; min-height: 0; margin: 0; }
.propositions { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--teal-trait); border-radius: 10px; background: var(--carte); }
.propositions button {
  display: block; width: 100%; min-height: 44px; padding: 8px 10px; text-align: left; font-weight: 400;
  color: var(--texte); background: transparent; border-radius: 8px; overflow-wrap: anywhere;
}
.propositions button:hover, .propositions button:focus-visible { background: var(--teal-pale); }
.aide { margin: 0; font-size: .85rem; color: var(--texte-2); }

button {
  min-height: 44px; padding: 10px 18px; font: inherit; font-weight: 700; cursor: pointer;
  color: var(--sur-bouton); background: var(--bouton); border: 0; border-radius: 999px;
}
button.discret { color: var(--teal); background: transparent; border: 1px solid var(--teal-trait); font-weight: 600; }
button:disabled { opacity: .5; cursor: wait; }
:focus-visible { outline: 3px solid var(--bordeaux); outline-offset: 2px; }

/* Chiffres clés en grand */
.personne { margin: 0 0 4px; font-weight: 700; }
.chiffres { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
/* Un cercle fin dans l'angle de chaque chiffre clé, rappel du logo. */
.chiffres div { position: relative; overflow: hidden; flex: 1 1 180px; padding: 20px; border-radius: 18px;
  background: linear-gradient(140deg, var(--teal-pale), transparent 130%); border: 1px solid var(--teal-trait); }
.chiffres div::after { content: ''; position: absolute; right: -26px; top: -26px; width: 84px; height: 84px;
  border: 1px solid var(--teal); border-radius: 50%; opacity: .25; }
.chiffre { display: block; margin-bottom: 6px; font-size: 2.3rem; font-weight: 400; line-height: 1.1; letter-spacing: -.01em; color: var(--teal-fonce); }
.legende { font-size: .85rem; color: var(--texte-2); }

table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
th, td { padding: 11px 4px; text-align: right; border-bottom: 1px solid var(--teal-pale); }
th:first-child, td:first-child { text-align: left; }
thead th { font-size: .8rem; font-weight: 700; color: var(--texte-2); }
tr.vide td { color: var(--texte-2); opacity: .6; }
tfoot td { font-weight: 700; border-bottom: 0; background: var(--teal-pale); }
tfoot td:first-child { padding-left: 12px; border-radius: 12px 0 0 12px; }
tfoot td:last-child { padding-right: 12px; border-radius: 0 12px 12px 0; }

.lignes { list-style: none; margin: 0 0 16px; padding: 0; }
.lignes li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--teal-trait); }
.lignes li > div { min-width: 0; overflow-wrap: anywhere; }
.lignes small { display: block; color: var(--texte-2); }
.lignes .km { flex: none; font-weight: 700; white-space: nowrap; text-align: right; }
.lignes li { flex-wrap: wrap; }
.lignes li > div:first-child { flex: 1 1 220px; }
.lignes .boutons { display: flex; gap: 8px; flex-wrap: wrap; }
.lignes .transfere { color: var(--teal); font-weight: 700; }
.lignes .alerte { color: var(--bordeaux); font-weight: 700; }

/* Tableau libéral */
details { padding: 4px 0; border-bottom: 1px solid var(--teal-pale); }
summary { min-height: 44px; padding: 12px 0; font-weight: 600; cursor: pointer; }
summary::marker { color: var(--teal); }
summary span { float: right; font-family: 'Quicksand', 'Nunito Sans', Arial, sans-serif; font-size: 1.1rem; font-weight: 500; color: var(--teal-fonce); }
.detail { flex: 1 1 100%; }
p.alerte { padding: 12px 16px; border-radius: 12px; background: var(--bordeaux-pale); color: var(--bordeaux); font-weight: 600; }
p.transfere { color: var(--teal); font-weight: 700; }
h3 { font-family: 'Quicksand', 'Nunito Sans', Arial, sans-serif; font-weight: 600; color: var(--teal); }
.organisme td:first-child { color: var(--texte-2); }
@media (prefers-color-scheme: dark) { header { background-image: none; } }
.legende, .note { display: block; }
.note { margin-top: 6px; font-size: .85rem; font-weight: 700; color: var(--teal); }
header button { background: var(--fond); }
#onglet-lib td:not(:first-child), #onglet-lib th { white-space: nowrap; }
#onglet-lib .operations td:nth-child(2) { white-space: normal; }
@media (max-width: 560px) { header { background-position: right -150px top -40px; } }
@media (max-width: 560px) {
  .carte { padding: 24px 16px; }
  #onglet-lib table { font-size: .9rem; }
  #onglet-lib thead th { font-size: .75rem; }
}

/* Tableau mensuel en colonnes : la page s'élargit sur grand écran, le tableau défile sur petit écran. */
body:has(#onglet-lib:not([hidden])) :is(header, main) { max-width: 1180px; }
.defile { overflow-x: auto; margin-bottom: 12px; }
.colonnes { margin: 0; font-size: .85rem; }
.colonnes th, .colonnes td { padding: 10px 5px; }
.colonnes td:first-child { position: sticky; left: 0; min-width: 120px; white-space: normal; background: var(--carte); }
.colonnes .fort td { font-weight: 700; background: var(--teal-pale); }
.colonnes td:nth-last-child(-n+2), .colonnes th:nth-last-child(-n+2) { border-left: 1px solid var(--teal-trait); font-weight: 700; }
.colonnes td:last-child { color: var(--texte-2); font-weight: 400; }

.colonnes .titre td { font-weight: 700; color: var(--teal-fonce); border-top: 1px solid var(--teal-trait); }
.colonnes .sous td { color: var(--texte-2); font-size: .8rem; }
.colonnes .sous td:first-child { padding-left: 18px; }
tfoot tr + tr td { border-top: 4px solid var(--carte); }

/* Synthèse en tête : bandeau de couleur plein, pictogramme cerclé, puis la phrase et le conseil. */
.verdict { padding: 0; overflow: hidden; border: 2px solid var(--teal); }
.verdict > :not(.bandeau) { margin-left: 24px; margin-right: 24px; }
.verdict > table { width: calc(100% - 48px); }
.verdict .bandeau { display: flex; align-items: center; gap: 16px; padding: 22px 24px; margin-bottom: 20px; color: #fff; background: #0F746B; }
.verdict .picto { flex: none; display: grid; place-items: center; width: 64px; height: 64px; font-size: 2rem; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .35); }
.verdict .surtitre { color: #fff; opacity: .85; }
.verdict .surtitre::before { background: #fff; }
.verdict h2 { margin: 4px 0 0; font-size: 1.7rem; font-weight: 700; line-height: 1.15; color: #fff; }
.verdict h2::after { display: none; }
.verdict .phrase { font-size: 1.05rem; }
.verdict .phrase strong { font-size: 1.15rem; color: var(--teal-fonce); white-space: nowrap; }
.verdict .conseil { padding: 14px 16px; border-radius: 14px; border: 2px dashed var(--teal); background: var(--teal-pale); }
.verdict > .aide { margin-bottom: 24px; }
.verdict.pasbon { border-color: #791618; }
.verdict.pasbon .bandeau { background: #791618; }
.verdict.pasbon .conseil { border-color: var(--bordeaux); background: var(--bordeaux-pale); color: var(--bordeaux); }
@media (max-width: 560px) {
  .verdict > :not(.bandeau) { margin-left: 16px; margin-right: 16px; }
  .verdict > table { width: calc(100% - 32px); }
  .verdict h2 { font-size: 1.35rem; }
  .verdict .picto { width: 52px; height: 52px; font-size: 1.6rem; }
}
#onglet-lib .verdict th { white-space: normal; }

/* Saisie des journées travaillées : douze petites cases, une par mois. */
form.jours { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); margin-bottom: 12px; }

/* Calendrier des journées travaillées : plein = journée entière, moitié = demi-journée. */
.calendrier { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 460px; margin: 0 auto 12px; }
.calendrier .entete { font-size: .75rem; font-weight: 700; text-align: center; color: var(--texte-2); }
.calendrier button { min-width: 0; min-height: 44px; padding: 0; border-radius: 12px; font-weight: 600; color: var(--texte); background: var(--fond); border: 1px solid var(--teal-trait); }
.calendrier .plein, .pastille-jour.plein { color: var(--sur-bouton); background: var(--bouton); border-color: var(--bouton); }
.calendrier .demi, .pastille-jour.demi { background: linear-gradient(135deg, var(--teal-trait) 50%, var(--fond) 50%); border-color: var(--teal); }
.legende-calendrier { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--texte-2); }
.pastille-jour { display: inline-block; width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--teal-trait); }
.pastille-jour.demi { margin-left: 12px; }

/* ---------- Corrections de l'audit design ---------- */
/* 16 px dans les champs : en dessous, l'iPhone zoome sur la page à chaque saisie. */
input, select { font-size: 1rem; }
/* Le message de confirmation ou d'erreur reste visible, où que l'on soit dans la page. */
#message { position: sticky; top: 8px; z-index: 5; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .35); }
/* Chiffres de même largeur : les montants s'alignent en colonnes. */
table, .chiffre { font-variant-numeric: tabular-nums; }
/* Hors tableau mensuel, les en-têtes passent à la ligne plutôt que de pousser le tableau hors de sa carte. */
#onglet-lib table:not(.colonnes) th { white-space: normal; }
#onglet-lib table:not(.colonnes) td:first-child { hyphens: auto; }
@media (max-width: 560px) {
  #onglet-lib table:not(.colonnes) { font-size: .85rem; }
  .calendrier { gap: 4px; }
}

/* « En attente » : information manquante, à compléter par le praticien. */
.attente { padding: 12px 16px; border-radius: 12px; border: 2px dashed var(--teal-trait); background: var(--fond); }
