/* Carnet moto — thème sombre unique (demande du propriétaire). Pensé pour le GSM d'abord ; menu latéral dès 900 px.
   Aucun style en ligne : la politique de sécurité (style-src 'self') les refuserait. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; src: url("fonts/ibm-plex-sans-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; src: url("fonts/ibm-plex-sans-500.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; src: url("fonts/ibm-plex-sans-600.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; src: url("fonts/ibm-plex-sans-700.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; src: url("fonts/ibm-plex-mono-500.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; src: url("fonts/ibm-plex-mono-600.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: dark;
  --fond: #0E1116; --fond-2: #12161D; --carte: #171C24; --carte-2: #1E2633; --bord: #262D38; --bord-2: #3A4350;
  --texte: #E8ECF2; --secondaire: #A4AEBC; --lien: #7EA6FF; --lien-survol: #B7CCFF;
  --action: #2563EB; --action-fond: #1B2A4A; --action-texte: #C5D6FF;
  --retard: #B42318; --retard-texte: #FF8A7A; --retard-jauge: #F0483A;
  --bientot: #4A3310; --bientot-texte: #FFD79A; --bientot-titre: #FFC46B; --bientot-jauge: #F2A93B;
  --ajour: #23303F; --ajour-texte: #C9D8EA; --ajour-jauge: #5B83B8;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { background: var(--fond); }
body { margin: 0; background: var(--fond); color: var(--texte); font: 400 15px/1.45 "IBM Plex Sans", system-ui, sans-serif; }
a { color: var(--lien); text-decoration: none; }
a:hover { color: var(--lien-survol); }
h1 { margin: 0 0 4px; font-size: 26px; font-weight: 700; line-height: 1.2; }
h2 { margin: 22px 0 8px; font-size: 14px; font-weight: 700; color: var(--secondaire); }
h2.retard { color: var(--retard-texte); }
h2.bientot { color: var(--bientot-titre); }
p { margin: 0 0 10px; }
.secondaire { color: var(--secondaire); }
.petit { font-size: 13px; }
.km { font-family: var(--mono); font-weight: 600; white-space: nowrap; }

/* Mise en page */
.cadre { min-height: 100vh; }
.contenu { padding: 18px 16px 104px; max-width: 760px; margin: 0 auto; }
.menu-lateral { display: none; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.entete .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.retour { display: inline-block; min-height: 32px; color: var(--secondaire); font-size: 14px; }

/* Navigation du bas (GSM) */
.nav-bas { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  height: 72px; background: var(--fond-2); border-top: 1px solid var(--bord); z-index: 10; }
.nav-bas a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; font-weight: 500; color: var(--secondaire); }
.nav-bas a[aria-current="page"] { color: var(--lien); font-weight: 700; }
.nav-bas svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-bas a.plus span { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px;
  border-radius: 16px; background: var(--action); color: #FFFFFF; }
.nav-bas a.plus svg { width: 26px; height: 26px; stroke-width: 2.5; }

/* PC : menu latéral à la place de la navigation du bas */
@media (min-width: 900px) {
  .cadre { display: flex; }
  .menu-lateral { display: flex; flex-direction: column; gap: 4px; width: 230px; flex: none; min-height: 100vh;
    padding: 20px 12px; background: #0A0D12; border-right: 1px solid var(--bord); position: sticky; top: 0; height: 100vh; }
  .menu-lateral a { display: block; min-height: 44px; line-height: 44px; padding: 0 12px; border-radius: 10px; color: #B8C2D1; }
  .menu-lateral a[aria-current="page"] { background: var(--action); color: #FFFFFF; font-weight: 600; }
  .menu-lateral .marque { font-weight: 700; font-size: 18px; color: var(--texte); padding-bottom: 8px; }
  .contenu { flex: 1; min-width: 0; padding: 28px 32px 40px; max-width: 1100px; }
  .nav-bas { display: none; }
}

/* Cartes et listes */
.carte { background: var(--carte); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.carte.relevee { background: var(--carte-2); border: 1px solid #303A49; }
.motos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 8px; }
.motos a { display: flex; flex-direction: column; gap: 4px; color: var(--texte); background: var(--carte-2);
  border: 1px solid #303A49; border-radius: 14px; padding: 12px; }
.motos .nom { font-weight: 600; }
.motos .km { font-size: 19px; }
.motos .resume { font-size: 12px; color: #B8C2D1; }
a.ligne, div.ligne { display: flex; align-items: center; gap: 12px; color: var(--texte); background: var(--carte);
  border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; min-height: 44px; }
.ligne .texte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ligne .titre { font-weight: 600; }
.ligne .detail { font-size: 12px; color: var(--secondaire); }

/* Pastilles d'état */
.pastille { flex: none; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 5px 8px; white-space: nowrap; }
.pastille.retard { background: var(--retard); color: #FFFFFF; }
.pastille.bientot { background: var(--bientot); color: var(--bientot-texte); }
.pastille.a_jour { background: var(--ajour); color: var(--ajour-texte); }
.pastille.neutre { border: 1px dashed #6B7280; color: #C3CBD6; padding: 4px 7px; }

/* Jauge d'une échéance */
.echeance { display: flex; flex-direction: column; gap: 6px; background: var(--carte); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.echeance .haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.echeance .titre { font-weight: 600; }
.echeance .detail { font-size: 12px; color: var(--secondaire); }
.jauge { display: block; width: 100%; height: 6px; border-radius: 3px; overflow: hidden; background: #2A313C; border: 0; }
.jauge::-webkit-meter-bar { background: #2A313C; border: 0; border-radius: 3px; height: 6px; }
.jauge::-webkit-meter-optimum-value, .jauge::-webkit-meter-suboptimum-value, .jauge::-webkit-meter-even-less-good-value { border-radius: 3px; }
.jauge.retard::-webkit-meter-optimum-value { background: var(--retard-jauge); }
.jauge.bientot::-webkit-meter-optimum-value { background: var(--bientot-jauge); }
.jauge.a_jour::-webkit-meter-optimum-value { background: var(--ajour-jauge); }
.jauge.retard::-moz-meter-bar { background: var(--retard-jauge); }
.jauge.bientot::-moz-meter-bar { background: var(--bientot-jauge); }
.jauge.a_jour::-moz-meter-bar { background: var(--ajour-jauge); }

/* Bandeaux */
.bandeau { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--action-fond); color: var(--action-texte);
  border-radius: 12px; padding: 8px 8px 8px 12px; margin-bottom: 12px; }
.bandeau > span { flex: 1; min-width: 160px; }
.bandeau form { display: flex; gap: 8px; align-items: center; }
.bandeau input { width: 120px; }
.flash { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.flash.erreur { background: #3A1512; color: #FFC2B8; }
.flash.succes { background: #12301F; color: #A7F0C4; }
.flash.info { background: var(--action-fond); color: var(--action-texte); }
.vide { background: var(--carte); border: 1px dashed var(--bord-2); border-radius: 14px; padding: 18px; text-align: center; }

/* Boutons */
.bouton, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px; background: var(--action); color: #FFFFFF;
  font: 600 14px "IBM Plex Sans", system-ui, sans-serif; cursor: pointer; text-align: center; }
.bouton:hover, button:hover { color: #FFFFFF; filter: brightness(1.08); }
.secondaire-bouton { background: var(--carte); border-color: var(--bord-2); color: var(--texte); }
.secondaire-bouton:hover { color: var(--texte); }
.danger { background: var(--retard); }
.lien-bouton { background: transparent; border: 0; color: var(--lien); padding: 0 4px; }
.lien-bouton:hover { color: var(--lien-survol); }
.pleine-largeur { width: 100%; }

/* Formulaires */
form.formulaire { display: flex; flex-direction: column; gap: 14px; }
.champ { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--secondaire); }
.champ .aide { font-weight: 400; font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--bord-2); border-radius: 10px; padding: 0 11px;
  background: var(--fond-2); color: var(--texte); font: 400 15px "IBM Plex Sans", system-ui, sans-serif; }
textarea { padding: 9px 11px; min-height: 90px; resize: vertical; }
input.km-saisie { font-family: var(--mono); font-weight: 600; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--lien); outline-offset: 2px; }
.deux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.case { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; color: var(--texte); font-size: 14px; }
.case input { width: 20px; height: 20px; accent-color: var(--action); }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px;
  min-width: 0; /* sinon un tableau large élargit toute la page (min-width: min-content par défaut) */ }
legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--secondaire); }

/* Pastilles à cocher (postes faits, choix exclusifs) */
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { position: relative; }
.puce input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.puce span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--bord-2); background: var(--carte); color: var(--texte); font-size: 13px; font-weight: 500; cursor: pointer; }
.puce input:checked + span { background: var(--action); border-color: var(--action); color: #FFFFFF; font-weight: 600; }
.puce input:checked + span::before { content: "✓ "; white-space: pre; }
.puce input:focus-visible + span { outline: 2px solid var(--lien); outline-offset: 2px; }

/* Tableaux (pièces, grille, postes) */
.tableau { overflow-x: auto; background: var(--carte); border-radius: 14px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--secondaire); font-weight: 700; }
td.centre, th.centre { text-align: center; }
td.coche { text-align: center; font-weight: 700; color: var(--lien); }
.tableau input, .tableau select { min-width: 72px; }
table.grille { min-width: 640px; }

/* Accueil : états calmes, groupes repliés */
.calme { color: var(--secondaire); background: var(--carte); border-radius: 12px; padding: 12px; margin: 14px 0 8px; }
.vide p { margin-bottom: 14px; }
.replies { margin-top: 14px; }
a.deplier { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px;
  border-radius: 12px; border: 1px dashed var(--bord-2); margin-bottom: 8px; font-weight: 600; }
h2 .replier { margin-left: 10px; font-weight: 600; font-size: 13px; }
a.ligne:hover { background: var(--carte-2); color: var(--texte); }

/* Fiche d'une moto */
.compteur-rapide { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 14px; }
.compteur-rapide .champ { flex: 1; max-width: 260px; }
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 12px; overflow-x: auto; }
.onglets a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--secondaire);
  font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.onglets a[aria-current="page"] { color: var(--lien); border-bottom-color: var(--lien); }
details.groupe { margin-top: 10px; }
details.groupe summary { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px dashed var(--bord-2); color: var(--lien); font-weight: 600; cursor: pointer; list-style: none; margin-bottom: 8px; }
details.groupe summary::-webkit-details-marker { display: none; }
details.groupe summary::before { content: "▸"; margin-right: 8px; }
details.groupe[open] summary::before { content: "▾"; }
td.titre { font-weight: 600; }
table.grille th a { color: var(--secondaire); }
table.grille th a:hover { color: var(--lien-survol); }

/* Historique */
.recherche { display: flex; align-items: flex-end; gap: 8px; margin: 10px 0 12px; }
.recherche .champ { flex: 1; }
.filtres { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
a.filtre { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--bord-2); background: var(--carte); color: var(--texte); font-size: 13px; font-weight: 500; }
a.filtre[aria-current="true"] { background: var(--texte); border-color: var(--texte); color: var(--fond); font-weight: 600; }
.entree { display: flex; flex-direction: column; gap: 5px; background: var(--carte); border-radius: 12px; padding: 12px; margin-bottom: 8px; color: var(--texte); }
a.entree:hover { background: var(--carte-2); color: var(--texte); }
.entree .haut { display: flex; justify-content: space-between; gap: 8px; }
.entree .titre { font-weight: 700; }
.entree .detail { font-size: 12px; color: var(--secondaire); }
.entree .pieces, .entree .notes { font-size: 13px; }
.entree .notes { color: var(--secondaire); white-space: pre-line; }

/* Paramètres des postes */
.barre-enregistrer { position: sticky; top: 0; z-index: 5; display: flex; justify-content: flex-end; padding: 8px 0;
  background: var(--fond); }
.poste-reglage { background: var(--carte); border-radius: 12px; padding: 10px 12px; scroll-margin-top: 70px; }
.poste-reglage legend { float: left; width: 100%; margin-bottom: 8px; color: var(--texte); font-size: 14px; }
.poste-reglage legend + * { clear: both; }
.poste-reglage.inactif { opacity: 0.6; }
.trois { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.revenir { align-self: flex-start; font-size: 13px; }
form.carte { padding: 14px; }
.ligne .bouton, .ligne .lien-bouton { flex: none; }

/* Retouches après la relecture du lot 1 */
.postes-grille { display: grid; gap: 10px; }
@media (min-width: 900px) { .postes-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
details.source summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none;
  font-size: 13px; color: var(--secondaire); }
details.source summary::-webkit-details-marker { display: none; }
details.source summary::after { content: "  ✎"; white-space: pre; color: var(--lien); }
details.source[open] summary::after { content: ""; }
details.autres-postes { margin-top: 6px; }
.menu-lateral a.sous { padding-left: 26px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Menu latéral : déconnexion en bas */
.pied-menu { margin-top: auto; }
.pied-menu .lien-bouton { width: 100%; justify-content: flex-start; padding: 0 12px; color: var(--secondaire); font-weight: 500; }

/* Connexion */
.connexion { max-width: 400px; margin: 10vh auto 0; }
.connexion h1 { margin-bottom: 16px; }
