/* The generator app: a calm internal tool for sales and developers. Light only (office use), colours as tokens. */
:root {
  --fond: #f2f4f1;
  --surface: #fcfdfc;
  --encre: #1b2423;
  --discret: #56625f;
  --trait: #d9dfda;
  --trait-fort: #c3ccc6;
  --accent: #0d6964;
  --accent-fonce: #094f4b;
  --accent-doux: #e1efec;
  --ok: #1b6f40;
  --ok-doux: #e1f0e6;
  --attente: #875a0e;
  --attente-doux: #f4ebd7;
  --erreur: #9f3527;
  --erreur-doux: #f6e1dc;
  --rayon: 10px;
  --rayon-petit: 7px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.55 var(--police); }
h1 { font-size: 19px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 17px; line-height: 1.25; margin: 0 0 16px; text-wrap: balance; }
p { margin: 0; }
a, button, input, select, summary { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Header and page */
.entete { background: var(--surface); border-bottom: 1px solid var(--trait); padding: 14px 16px; }
.entete-contenu { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.entete-sous-titre { color: var(--discret); font-size: 13px; margin-top: 2px; }
main.page { max-width: 1120px; margin: 0 auto; padding: 24px 16px 56px; display: grid; gap: 20px; }
.panneau { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 22px; min-width: 0; }
.aide { color: var(--discret); font-size: 13px; }

/* Buttons */
.bouton, button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 16px;
  border-radius: var(--rayon-petit); border: 1px solid var(--trait-fort);
  background: var(--surface); color: var(--encre);
  text-decoration: none; cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: transform 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.bouton:active, button:active { transform: scale(0.97); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fbfdfc; font-weight: 600; }
.bouton.secondaire { border-color: var(--accent); color: var(--accent-fonce); font-weight: 600; }
.bouton.discret { border-color: transparent; background: transparent; color: var(--discret); min-height: 38px; }
.bouton.petit { min-height: 32px; padding: 0 12px; font-size: 13px; }
.bouton.petit[aria-expanded="true"] { background: var(--accent-doux); border-color: var(--accent); color: var(--accent-fonce); }
/* A link that acts: it wraps like the text around it, so a long one never widens the card on a phone. */
.bouton-lien {
  min-height: 0; padding: 0; border: 0; background: none; color: var(--accent-fonce);
  font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
  white-space: normal; text-align: left;
}
@media (hover: hover) and (pointer: fine) {
  .bouton.principal:hover { background: var(--accent-fonce); }
  .bouton.secondaire:hover, button:hover { background: var(--accent-doux); }
  .bouton.discret:hover { color: var(--encre); background: transparent; }
  .bouton-lien:hover { color: var(--accent); background: none; }
}
button:disabled, .bouton[aria-disabled="true"] { cursor: not-allowed; opacity: 0.5; transform: none; }

/* Form groups */
.groupe { border: 0; margin: 0; padding: 0; min-width: 0; }
.groupe legend, .champ-graine label, .champ-date label { font-size: 13px; font-weight: 600; color: var(--discret); padding: 0; margin-bottom: 8px; }
input[type="text"], input[type="number"], input[type="date"] {
  min-height: 42px; padding: 0 12px; border: 1px solid var(--trait-fort); border-radius: var(--rayon-petit);
  background: var(--surface); color: var(--encre);
}
input::placeholder { color: #6b7673; }

/* Sector cards: radio inputs styled as cards */
.cartes-secteurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.carte-secteur {
  position: relative; display: grid; gap: 4px; padding: 14px 16px; cursor: pointer;
  border: 1px solid var(--trait-fort); border-radius: var(--rayon); background: var(--surface);
  transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.carte-secteur input { position: absolute; opacity: 0; pointer-events: none; }
.carte-secteur:has(input:checked) { border-color: var(--accent); background: var(--accent-doux); box-shadow: inset 0 0 0 1px var(--accent); }
.carte-secteur:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.carte-secteur:has(input:disabled) { cursor: not-allowed; opacity: 0.55; }
.carte-libelle { font-weight: 650; }
.carte-societe { color: var(--accent-fonce); font-size: 14px; font-weight: 500; }
.carte-achats { color: var(--discret); font-size: 13px; }

.reglages { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px 32px; margin-top: 22px; }

/* Segmented switches */
.segments { display: inline-flex; border: 1px solid var(--trait-fort); border-radius: var(--rayon-petit); overflow: hidden; background: var(--surface); }
.segment { position: relative; cursor: pointer; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-right: 1px solid var(--trait); font-weight: 500; }
.segment:last-child span { border-right: 0; }
.segment:has(input:checked) span { background: var(--accent); color: #fbfdfc; }
.segment:has(input:focus-visible) span { outline: 2px solid var(--accent); outline-offset: -3px; }
#detail-taille { margin-top: 6px; }
.champ-date { display: grid; gap: 0; margin-top: 12px; max-width: 220px; }

/* More options */
.options { margin-top: 18px; }
.options summary { cursor: pointer; color: var(--accent-fonce); font-weight: 600; font-size: 14px; width: max-content; }
.champ-graine { display: grid; gap: 0; margin-top: 12px; max-width: 420px; }
.champ-graine input { max-width: 200px; margin-bottom: 6px; }

/* The summary of the company a choice gives, with its two actions */
.resume {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  margin: 22px 0 10px; padding: 18px 20px; border: 1px solid var(--accent-doux); border-radius: var(--rayon);
  background: linear-gradient(0deg, var(--accent-doux), var(--accent-doux)) padding-box;
}
.resume-etiquette { font-size: 12px; font-weight: 600; color: var(--accent-fonce); letter-spacing: 0.02em; }
.resume-nom { font-size: 23px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 2px 0 4px; }
.resume-details { color: var(--discret); font-size: 14px; }
.resume-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.charger { display: flex; gap: 8px; }
.charger input { width: 180px; }
.message { min-height: 1.4em; margin-top: 8px; font-size: 14px; }
.message.erreur { color: var(--erreur); }
.message.succes { color: var(--ok); }
.message.alerte { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--rayon-petit); background: var(--erreur-doux); font-weight: 600; }

/* What Finareo should find: the planted problems, under the summary card and under a company in Odoo */
.resume-problemes { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-top: 8px; font-size: 14px; font-weight: 600; }
.resume-problemes.erreur { color: var(--erreur); font-weight: 500; }
.detail-problemes { margin: 6px 0 14px; }
.problemes { display: grid; gap: 10px; min-width: 0; }
.problemes-titre { font-size: 14px; }
.problemes .tableau { background: var(--surface); }
.table-problemes { font-size: 13px; }
.table-problemes td { vertical-align: top; }
.probleme-libelle { font-weight: 600; }
.remarque { display: block; max-width: 36ch; margin-top: 2px; color: var(--attente); font-size: 12px; }
.regle { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--accent-fonce); white-space: nowrap; }
.exemples { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; min-width: 280px; }
.exemple-date { color: var(--discret); white-space: nowrap; }
#societes tr.detail > td { background: var(--fond); padding: 14px 16px 16px; }
/* An open list takes the row's width without widening the companies' columns; its own table scrolls if it must. */
#societes tr.detail .problemes { width: 0; min-width: 100%; }
#societes td.action { text-align: right; }

/* Odoo connection */
.connexion-odoo { background: var(--fond); border-radius: var(--rayon-petit); padding: 14px 16px; margin-bottom: 16px; }
.connexion-titre { font-size: 13px; font-weight: 600; color: var(--discret); margin-bottom: 8px; }
.connexion-odoo dl { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px 20px; margin: 0 0 8px; }
.connexion-odoo dt { font-size: 12px; color: var(--discret); }
.connexion-odoo dd { margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.connexion-odoo dd span { overflow-wrap: anywhere; }
.copier { min-height: 30px; padding: 0 10px; font-size: 12px; }

/* Tables */
/* Positioned, so the hidden header labels (.sr-only, absolutely placed) scroll with the table instead of widening the
   page on a phone. */
.tableau { position: relative; overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--rayon-petit); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--trait); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--discret); background: var(--fond); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
td.vide, .lecture { color: var(--discret); }
td.date { white-space: nowrap; }
#chargements td:nth-child(2), #societes td:first-child { min-width: 170px; }
.panneau > .aide { max-width: 75ch; }
td.vide { text-align: center; padding: 20px; }

.pastille { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pastille.pret, .pastille.termine { background: var(--ok-doux); color: var(--ok); }
.pastille.partiel, .pastille.en_attente { background: var(--attente-doux); color: var(--attente); }
.pastille.en_cours { background: var(--accent-doux); color: var(--accent-fonce); }
.pastille.echec { background: var(--erreur-doux); color: var(--erreur); }
.pastille.inconnu { background: var(--fond); color: var(--discret); }
.detail-erreur { color: var(--erreur); font-size: 13px; }

/* A load's six phases */
.phases { display: flex; gap: 3px; width: 180px; margin-bottom: 5px; }
.phases span { flex: 1; height: 6px; border-radius: 3px; background: var(--trait); }
.phases span.fait { background: var(--accent); }
.phases span.encours { background: #7fb3ae; }
.phase-texte { font-size: 13px; color: var(--discret); }

/* Sign-in */
body.connexion { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.carte-connexion { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 28px 24px; display: grid; gap: 8px; }
.carte-connexion form { display: grid; gap: 8px; margin-top: 12px; }
.carte-connexion label { font-size: 13px; font-weight: 600; color: var(--discret); }
.carte-connexion input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--trait-fort); border-radius: var(--rayon-petit); }
.carte-connexion button { width: 100%; }
.sous-titre { color: var(--discret); font-size: 14px; }
button.principal { background: var(--accent); border-color: var(--accent); color: #fbfdfc; font-weight: 600; }

@media (max-width: 720px) {
  .panneau { padding: 18px 16px; }
  .connexion-odoo dl { grid-template-columns: 1fr; }
  .resume { flex-direction: column; align-items: stretch; }
  .resume-actions, .charger { flex-direction: column; align-items: stretch; }
  .charger input { width: 100%; }
  .resume .bouton { white-space: normal; text-align: center; }
  .segments { display: flex; }
  .segment { flex: 1; }
  .segment span { justify-content: center; width: 100%; }
}

@media (max-width: 480px) {
  .entete-sous-titre { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bouton, button, .carte-secteur { transition: none; }
  .bouton:active, button:active { transform: none; }
}
