/* Tomobelti web, comme la page de présentation : fond clair chaud, cartes blanches, orange pour agir.
   Thème sombre automatique si le téléphone est en mode sombre. Pensé d'abord pour le téléphone. */
:root {
  --fond: #f7f5f0; --surface: #ffffff; --surface2: #f2efe8; --bord: #e8e3d9; --bord-fort: #d6cfc2;
  --texte: #17150f; --discret: #6f6a60; --ambre: #c97a12; --ambre-clair: #e8a33d; --ambre-fonce: #ad6609; --sur-ambre: #ffffff;
  --vert: #1f8a4c; --rouge: #c8372d; --bleu: #1d64b8; --gris: #6f6a60;
  --ombre: 0 1px 2px rgba(23, 21, 15, .05), 0 6px 18px -12px rgba(23, 21, 15, .14);
  --mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --haut: env(safe-area-inset-top, 0px); --bas: env(safe-area-inset-bottom, 0px);
  --titres: Manrope, -apple-system, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --courbe: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #131211; --surface: #1b1a18; --surface2: #23211e; --bord: #2e2b27; --bord-fort: #45413b;
    --texte: #f3efe7; --discret: #9a948a; --ambre: #e8a33d; --ambre-clair: #f0b55c; --ambre-fonce: #d18f2a; --sur-ambre: #1a1206;
    --vert: #6fcf8e; --rouge: #ff8a7a; --bleu: #8db8e8; --gris: #9a948a; --ombre: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte);
  font: 16px/1.5 Geist, -apple-system, system-ui, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
::selection { background: var(--ambre); color: var(--sur-ambre); }
a { color: var(--ambre); }
h2 { font-size: 21px; margin: 0 0 8px; font-family: var(--titres); font-weight: 800; letter-spacing: -0.02em; }
h3 { font-size: 16px; margin: 0 0 12px; font-family: var(--titres); font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; color: var(--texte); }
/* Icônes de /icones.svg (mêmes que la page de présentation et la console) : i-… au trait, logo-… pleins. */
.ico { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.22em; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; }
.ico.plein { fill: currentColor; stroke: none; }
.tuile { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; color: var(--ambre); background: color-mix(in srgb, var(--ambre-clair) 16%, transparent); }
.tuile .ico { width: 22px; height: 22px; }
h4 { font: 500 11.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--discret); margin: 20px 0 4px; }
small { font-size: 13px; }
.discret { color: var(--discret); }
.petit { font-size: 13px; }
.vert { color: var(--vert); } .rouge { color: var(--rouge); } .ambre { color: var(--ambre); }
.centre-texte { text-align: center; }

button, input, select, textarea { font: inherit; color: inherit; }
button, .bouton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--bord); background: var(--surface2); color: var(--texte); border-radius: 8px; padding: 11px 16px; min-height: 44px;
  font-weight: 500; transition: background-color .15s, border-color .15s; }
button:hover, .bouton:hover { border-color: var(--bord-fort); }
button:active, .bouton:active { transform: translateY(1px); }
button:focus-visible, .bouton:focus-visible { outline: 2px solid var(--ambre); outline-offset: 2px; }
button.principal, .bouton.principal { background: var(--ambre); color: var(--sur-ambre); border-color: var(--ambre); font-weight: 700; border-radius: 999px; }
button.principal:hover, .bouton.principal:hover { background: var(--ambre-fonce); border-color: var(--ambre-fonce); }
button.danger { color: var(--rouge); border-color: color-mix(in srgb, var(--rouge) 40%, transparent); background: none; }
button.discret { background: none; border-color: transparent; color: var(--discret); }
button.discret:hover { color: var(--texte); }
button.large, .bouton.large { width: 100%; margin-top: 10px; }
button:disabled { opacity: .5; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--bord); border-radius: 6px; padding: 11px 13px; min-height: 46px;
  transition: border-color .15s; }
input:hover, select:hover { border-color: var(--bord-fort); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ambre); }
select option { background: var(--surface2); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--discret); margin-top: 10px; }
label.coche { display: flex; align-items: center; gap: 10px; color: var(--texte); font-size: 15px; }
label.coche input { width: 22px; height: 22px; min-height: 0; accent-color: var(--ambre); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.deux label { margin-top: 10px; }
.erreur { color: var(--rouge); background: color-mix(in srgb, var(--rouge) 12%, transparent); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }

.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; box-shadow: var(--ombre); padding: 16px; margin: 0 0 12px; display: block; width: 100%; text-align: left; }
button.carte:hover { border-color: var(--bord-fort); background: var(--surface); }
.ligne { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; }
.ligne.lien { width: 100%; border: 0; background: none; padding: 8px 0; border-bottom: 1px solid var(--bord); border-radius: 0; text-align: left; }
.ligne.total { border-top: 1px solid var(--bord); margin-top: 6px; padding-top: 10px; font-size: 18px; }
.pastille { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
  background: color-mix(in srgb, currentColor 14%, transparent); }
.pastille.vert { color: var(--vert); } .pastille.ambre { color: var(--ambre); } .pastille.rouge { color: var(--rouge); }
.pastille.bleu { color: var(--bleu); } .pastille.gris { color: var(--gris); }
.vide { text-align: center; color: var(--discret); padding: 40px 10px; }

/* Écrans de démarrage, connexion, blocage */
.centre { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; padding: calc(24px + var(--haut)) 20px calc(24px + var(--bas)); }
.connexion .carte, .bloque { width: min(400px, calc(100vw - 32px)); display: grid; gap: 4px; }
.bloque { gap: 12px; }
.marque { display: flex; align-items: center; gap: 12px; }
.marque b { display: block; font-size: 20px; font-family: var(--titres); font-weight: 800; }
.logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; flex: none; }
.marque .logo { width: 56px; height: 56px; border-radius: 14px; }
.logo.initiale { display: grid; place-items: center; background: var(--ambre); color: var(--sur-ambre); font-weight: 800; font-size: 20px; }
/* Logo de marque de véhicule : initiale dessous, logo par-dessus s'il se charge. */
.logo-marque { position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 6px;
  background: #fff; color: #5b6270; font-weight: 800; font-size: 18px; overflow: hidden; }
.logo-marque img { position: absolute; inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); object-fit: contain; background: #fff; }
.avec-logo { display: flex; align-items: center; gap: 12px; text-align: start; }
.avec-logo > .fiche { flex: 1; }

/* Connexion : photo (en haut sur téléphone, à gauche sur ordinateur) puis le formulaire, comme la page de présentation. */
.ecran-connexion { min-height: 100dvh; display: grid; grid-template-columns: 1fr; gap: 18px; align-content: start;
  padding: calc(16px + var(--haut)) 16px calc(24px + var(--bas)); }
.connexion-visuel { position: relative; height: 210px; border-radius: 24px; overflow: hidden; background: var(--surface2); }
.connexion-visuel img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 62% 70%; }
.connexion-visuel::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(19, 18, 17, .92), rgba(19, 18, 17, .1) 60%); }
.connexion-visuel div { position: absolute; left: 20px; right: 20px; bottom: 18px; z-index: 1; color: #fff; display: grid; gap: 4px; }
.connexion-visuel b { font: 800 21px/1.2 var(--titres); }
.connexion-visuel span { font-size: 14px; color: rgba(255, 255, 255, .8); }
.connexion { display: grid; gap: 16px; justify-items: center; }
@media (min-width: 860px) {
  .ecran-connexion { grid-template-columns: minmax(0, 1fr) 420px; gap: 40px; align-items: center; align-content: center;
    padding-inline: max(24px, calc((100vw - 1040px) / 2)); }
  .connexion-visuel { height: min(640px, calc(100dvh - 48px)); border-radius: 28px; }
  .connexion-visuel div { left: 28px; right: 28px; bottom: 26px; }
  .connexion-visuel b { font-size: 28px; }
}
.roue { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--bord); border-top-color: var(--ambre); animation: tour 1s linear infinite; }
@keyframes tour { to { transform: rotate(1turn); } }

/* Application */
.barre { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--haut)) max(16px, calc((100% - 728px) / 2)) 10px;
  background: var(--fond); border-bottom: 1px solid var(--bord); }
.barre .titre { flex: 1; min-width: 0; }
.barre .titre b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--titres); font-weight: 800; }
.barre .titre small { color: var(--discret); }
.hors-ligne { font-size: 12px; color: var(--ambre); }
.bandeau { margin: 12px auto 0; width: min(728px, calc(100% - 32px)); padding: 12px 14px; border-radius: 8px; font-size: 14px; color: var(--texte);
  background: var(--surface); border: 1px solid var(--bord); border-inline-start: 3px solid var(--ambre); }
.page { padding: 16px 16px calc(100px + var(--bas)); max-width: 760px; margin: 0 auto; }
/* Barre d'onglets en bas, pleine largeur ; l'onglet actif marqué d'un trait ambre. */
.onglets { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 0 max(4px, calc((100% - 760px) / 2)) var(--bas); background: var(--fond); border-top: 1px solid var(--bord); }
.onglets button { flex-direction: column; gap: 3px; background: none; border: 0; border-top: 2px solid transparent; border-radius: 0; font-size: 11px;
  color: var(--discret); padding: 6px 0 4px; min-height: 56px; }
.onglets button:hover { color: var(--texte); }
.onglets button .ico { width: 23px; height: 23px; }
.onglets button.actif { color: var(--ambre); font-weight: 600; border-top-color: var(--ambre); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 12px; }
.kpi { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; box-shadow: var(--ombre); padding: 14px; display: grid; gap: 3px; }
.kpi:first-child { border-top: 3px solid var(--ambre); }
.kpi small { color: var(--discret); }
.kpi > small:first-child { font: 500 11.5px var(--mono); letter-spacing: .03em; }
.kpi b { font: 800 23px/1.2 var(--titres); letter-spacing: -0.02em; color: var(--texte); font-variant-numeric: tabular-nums; }
.recherche { margin-bottom: 10px; }
.filtres { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.filtres button { white-space: nowrap; border-radius: 99px; min-height: 36px; padding: 6px 14px; font-size: 14px; color: var(--discret); }
.filtres button { border-radius: 999px; }
.filtres button.actif { background: var(--texte); color: var(--fond); border-color: var(--texte); font-weight: 600; }
.fiche { cursor: pointer; display: grid; gap: 6px; color: var(--texte); font-size: 15px; }
.ajout { position: fixed; right: max(16px, calc((100% - 760px) / 2 + 16px)); bottom: calc(76px + var(--bas)); z-index: 4;
  background: var(--ambre); color: var(--sur-ambre); border: 1px solid var(--ambre); border-radius: 999px; padding: 14px 22px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45); }
.ajout:hover { background: var(--ambre-fonce); border-color: var(--ambre-fonce); }
.ajout .ico { stroke-width: 2.4; }
.ligne.alerte { justify-content: flex-start; }
.ligne.alerte > span:nth-child(2) { flex: 1; min-width: 0; }

/* Menu « Plus » */
.menu-pages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.menu-pages button { flex-direction: column; gap: 8px; min-height: 100px; border-radius: 14px; font-size: 13px; background: var(--surface); box-shadow: var(--ombre); }

/* CA des 6 derniers mois */
.barres { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 150px; align-items: end; }
.barre-mois { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 11px; color: var(--discret); }
.barre-mois i { display: block; width: 100%; border-radius: 2px; background: var(--bord-fort); }
.barre-mois i.courant { background: var(--ambre); }

/* Calendrier */
.mois-nav b { font-size: 17px; }
.mois-nav button { min-width: 48px; font-size: 22px; }
.calendrier { overflow-x: auto; }
.cal-ligne { display: grid; grid-template-columns: 96px 1fr; align-items: center; height: 34px; gap: 6px; }
.cal-ligne > span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ligne.entete { height: 18px; }
.piste { position: relative; height: 26px; border-radius: 4px; background: var(--surface2); }
.entete .piste { background: none; }
.piste small { position: absolute; font-size: 10px; color: var(--discret); }
.bloc { position: absolute; top: 0; bottom: 0; min-height: 0; padding: 0 3px; border: 0; border-radius: 5px; overflow: hidden;
  font-size: 9px; color: #fff; justify-content: flex-start; white-space: nowrap; }
.bloc.en_cours { background: var(--ambre); } .bloc.reserve { background: var(--bleu); } .bloc.termine { background: color-mix(in srgb, var(--gris) 55%, transparent); }
.aujourdhui { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--rouge); }
.legende { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

/* Statistiques */
.jauge-ca { flex: 1; height: 8px; border-radius: 2px; background: var(--surface2); overflow: hidden; }
.jauge-ca i { display: block; height: 100%; background: var(--ambre); }

/* Droits par page d'un utilisateur */
.droits { display: grid; gap: 2px; }
.droit { display: grid; grid-template-columns: 1fr repeat(4, 52px); align-items: center; min-height: 40px; font-size: 14px; }
.droit input { width: 22px; height: 22px; min-height: 0; margin: 0 auto; accent-color: var(--ambre); }
.droit.entete small { text-align: center; font-size: 11px; color: var(--discret); }

/* Plateforme */
.trois { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.trois .bouton, .trois button { padding: 10px 6px; }
.pastilles { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.fiche .marque b { font-size: 16px; }

/* Feuilles plein écran (formulaires, détail, documents) */
.feuille { position: fixed; inset: 0; z-index: 10; background: var(--fond); display: flex; flex-direction: column; animation: feuille .3s var(--courbe); }
@keyframes feuille { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .feuille { animation: none; } }
.barre-feuille { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: calc(8px + var(--haut)) 12px 8px; border-bottom: 1px solid var(--bord); }
.barre-feuille b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; font-family: var(--titres); font-weight: 700; }
.barre-feuille button { min-height: 40px; padding: 8px 12px; }
.corps-feuille { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px calc(32px + var(--bas)); max-width: 760px; width: 100%; margin: 0 auto; }
details { margin-top: 12px; background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; padding: 13px 14px; }
summary { cursor: pointer; font-weight: 600; }
.pieces { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.pieces label.coche { font-size: 14px; margin-top: 8px; }
#totaux { margin-top: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(80px + var(--bas)); transform: translateX(-50%) translateY(20px); z-index: 20; opacity: 0;
  background: var(--texte); color: var(--fond); border: 0; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); padding: 12px 16px; max-width: calc(100vw - 32px);
  transition: opacity .2s, transform .2s; pointer-events: none; }
#toast.visible { opacity: 1; transform: translateX(-50%); }
#toast.ko { background: var(--rouge); color: #1a0d0b; }

/* Contrat et facture : page A4, toujours sur fond blanc */
.papier { margin-top: 12px; background: #fff; color: #16191d; border-radius: 8px; padding: 16px; overflow-x: auto; }
.doc { width: 100%; min-width: 640px; max-width: 800px; margin: 0 auto; font-size: 11px; color: #16191d; }
.doc-entete { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #e8a33d; padding-bottom: 8px; margin-bottom: 10px; }
.doc-agence { display: flex; gap: 10px; align-items: center; }
.doc-agence b { font-size: 16px; display: block; }
.doc-agence small, .doc-titre small { display: block; color: #6b7280; font-size: 10px; }
.doc-logo { width: 54px; height: 54px; object-fit: contain; border-radius: 6px; }
.doc-logo.initiale { display: grid; place-items: center; background: #e8a33d; color: #fff; font-weight: 800; font-size: 26px; }
.doc-titre { text-align: right; }
.doc-titre b { font-size: 16px; display: block; }
.doc-titre .ambre { color: #b8760f; font-weight: 700; display: block; }
.doc-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.encadre { border: 1px solid #d5d9df; border-radius: 8px; padding: 8px 10px; }
.encadre h4 { color: #b8760f; font-size: 9px; margin: 0 0 6px; }
.encadre h5 { color: #6b7280; font-size: 8.5px; margin: 8px 0 4px; letter-spacing: .05em; border-top: 1px solid #eef0f3; padding-top: 6px; }
.encadre b { display: block; }
.encadre small { display: block; color: #6b7280; }
.doc dl { display: grid; grid-template-columns: 38% 62%; gap: 2px 6px; margin: 0; }
.doc dt { color: #6b7280; } .doc dd { margin: 0; font-weight: 600; }
.jauge { display: inline-block; width: 70px; height: 6px; background: #e5e7eb; border-radius: 3px; vertical-align: middle; }
.jauge i { display: block; height: 100%; background: #1e8e4a; border-radius: 3px; }
.etat-corps { display: flex; gap: 12px; align-items: flex-start; }
.schema { width: 90px; flex: none; }
.etat-corps p { margin: 4px 0 0; color: #6b7280; }
.doc .vert { color: #1e8e4a; } .doc .rouge { color: #c62828; }
.montants { width: 100%; border-collapse: collapse; }
.montants td { padding: 2px 0; } .montants td:last-child { text-align: right; }
.montants .gras td { font-weight: 700; border-top: 1px solid #eef0f3; padding-top: 4px; }
.total { display: flex; justify-content: space-between; background: #e8a33d; color: #16191d; border-radius: 6px; padding: 7px 10px; margin: 6px 0; font-weight: 700; font-size: 12px; }
.conditions ul { columns: 2; margin: 0; padding: 0; list-style: none; }
.conditions li { margin: 2px 0; }
.signatures .encadre { min-height: 80px; display: flex; flex-direction: column; justify-content: space-between; }
.attention { font-size: 9px; color: #6b7280; margin: 6px 0; }
.doc-pied { text-align: center; color: #6b7280; font-size: 9px; margin-top: 14px; }
.designations { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.designations th { background: #f3f4f6; text-align: left; padding: 6px; font-size: 10px; color: #6b7280; }
.designations td { padding: 6px; border-bottom: 1px solid #eef0f3; }
.designations th:not(:first-child), .designations td:not(:first-child) { text-align: right; }
.cachet { min-height: 90px; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  body * { visibility: hidden; }
  .doc, .doc * { visibility: visible; }
  .doc { position: absolute; left: 0; top: 0; min-width: 0; max-width: none; }
  .feuille, .corps-feuille, .papier { position: static; overflow: visible; padding: 0; background: #fff; }
}
/* Aperçu sur téléphone : la page A4 réduite pour tenir dans l'écran (l'impression reste en taille réelle). */
@media screen and (max-width: 699px) {
  .papier { padding: 8px; overflow: hidden; }
  .papier .doc { zoom: .5; }
}
@media (min-width: 700px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
}

/* Demande d'abonnement dans le bandeau d'essai et l'écran « Essai terminé ». */
.bandeau > button.principal { display: flex; margin-top: 10px; }
.formulaire-abonnement { display: grid; gap: 12px; margin-top: 12px; color: var(--texte); text-align: start; }
.formulaire-abonnement .choix { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.formulaire-abonnement .choix legend { font-size: 13px; color: var(--discret); margin-bottom: 6px; }
.formulaire-abonnement .choix label { display: flex; flex-direction: row; align-items: center; gap: 10px; color: var(--texte); font-size: 15px;
  background: var(--surface2); border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.formulaire-abonnement .choix label:has(input:checked) { border-color: var(--ambre); }
.formulaire-abonnement .choix input { width: auto; margin: 0; accent-color: var(--ambre); }
.formulaire-abonnement .rangee { display: flex; flex-wrap: wrap; gap: 8px; }
.bandeau .ok, .bloque .ok { display: flex; gap: 8px; align-items: center; color: var(--vert); margin: 10px 0 0; }
