/* CRM Support 7G : même langage que les outils 7G. Bleu 7G, Lexend, surfaces douces, clair / sombre. */
@font-face { font-family: "Lexend"; src: url(/polices/lexend.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
:root {
  --bleu: #0C3D63; --bleu-2: #15507F;
  --bg: #EEF2F6; --surface: #FFFFFF; --surface2: #F4F7FA; --ink: #0E2233; --ink-soft: #43566A; --muted: #6B7D90;
  --line: #DDE4EC; --line-2: #C9D4DE; --accent: #0C3D63; --accent-doux: #DCE8F2; --sur-accent: #FFFFFF;
  --vert: #1F8A55; --vert-doux: #DDF3E6; --rouge: #C23A3E; --rouge-doux: #FBE3E3; --orange: #B8741A; --orange-doux: #FBEFD9;
  --mark: #FFE9A8; --mark-ink: #4A3700;
  --shadow: 0 1px 0 rgba(12,61,99,.04), 0 10px 24px -16px rgba(12,61,99,.30);
  --r: 12px; --f: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1724; --surface: #112233; --surface2: #0E1D2C; --ink: #E6EEF5; --ink-soft: #B6C4D2; --muted: #8FA2B4;
    --line: #1F3345; --line-2: #2A4259; --accent: #6FB1E3; --accent-doux: #173149; --sur-accent: #06202F;
    --vert: #57C98F; --vert-doux: #143427; --rouge: #EE7B7E; --rouge-doux: #3A1C1F; --orange: #E5A954; --orange-doux: #38291A;
    --mark: #5A4A14; --mark-ink: #FFEDB8; --shadow: 0 10px 24px -16px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1724; --surface: #112233; --surface2: #0E1D2C; --ink: #E6EEF5; --ink-soft: #B6C4D2; --muted: #8FA2B4;
  --line: #1F3345; --line-2: #2A4259; --accent: #6FB1E3; --accent-doux: #173149; --sur-accent: #06202F;
  --vert: #57C98F; --vert-doux: #143427; --rouge: #EE7B7E; --rouge-doux: #3A1C1F; --orange: #E5A954; --orange-doux: #38291A;
  --mark: #5A4A14; --mark-ink: #FFEDB8; --shadow: 0 10px 24px -16px rgba(0,0,0,.7); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--f); overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.muet { color: var(--muted); }
.petit { font-size: 13px; }
.cache { display: none !important; }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.entete-haut { display: flex; align-items: center; gap: 12px; max-width: 1180px; margin: auto; padding: 10px 16px; }
.entete img { width: 32px; height: 32px; border-radius: 7px; background: #fff; }
.marque { font-weight: 600; white-space: nowrap; }
.entete .moi { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.onglets { display: flex; gap: 4px; max-width: 1180px; margin: auto; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglet { flex: none; border: 0; background: none; padding: 8px 12px; border-radius: 9px; cursor: pointer; color: var(--ink-soft); font-weight: 500; }
.onglet:hover { background: var(--surface2); }
.onglet.actif { background: var(--accent-doux); color: var(--accent); }
.compteur { display: inline-block; min-width: 19px; padding: 0 5px; margin-left: 5px; border-radius: 10px; background: var(--rouge); color: #fff; font-size: 12px; line-height: 19px; text-align: center; }

main { max-width: 1180px; margin: auto; padding: 18px 16px 60px; }
.titre-page { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.titre-page .droite { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

/* Surfaces */
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.bouton { border: 1px solid var(--line-2); background: var(--surface); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; min-height: 38px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; overflow-wrap: normal; flex: none; }
.bouton:hover { background: var(--surface2); }
.bouton.plein { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.bouton.plein:hover { filter: brightness(1.08); background: var(--accent); }
.bouton.danger { color: var(--rouge); border-color: var(--rouge); }
.bouton:disabled { opacity: .55; cursor: not-allowed; }
.lien { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
label.champ { display: block; margin-bottom: 12px; font-weight: 500; font-size: 14px; }
label.champ .aide { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; margin-top: 4px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); min-height: 40px;
}
textarea { min-height: 96px; resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ligne-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }

/* Guichet : types de demandes */
.types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

/* Saisie rapide */
.saisie { display: flex; gap: 8px; margin-bottom: 8px; }
.saisie input { margin: 0; }
.retour { padding: 10px 12px; border-radius: 9px; background: var(--vert-doux); margin-bottom: 14px; white-space: pre-line; }
.erreur { padding: 10px 12px; border-radius: 9px; background: var(--rouge-doux); color: var(--rouge); margin-bottom: 14px; }
.info { padding: 10px 12px; border-radius: 9px; background: var(--accent-doux); margin-bottom: 14px; }

/* Listes de demandes */
.section-titre { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 8px; font-weight: 600; }
.section-titre.alerte { color: var(--rouge); }
.demande { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; margin-bottom: 7px; cursor: pointer; box-shadow: var(--shadow); }
.demande:hover { border-color: var(--line-2); background: var(--surface2); }
.demande .haut { display: flex; align-items: baseline; gap: 8px; }
.demande .num { color: var(--muted); font-size: 13px; flex: none; }
.demande .titre { font-weight: 500; }
.demande.finie .titre { color: var(--muted); text-decoration: line-through; }
.demande .meta { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 5px; font-size: 13px; color: var(--ink-soft); align-items: center; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--surface2); color: var(--ink-soft); border: 1px solid var(--line); }
.tag.rouge { background: var(--rouge-doux); color: var(--rouge); border-color: transparent; }
.tag.orange { background: var(--orange-doux); color: var(--orange); border-color: transparent; }
.tag.vert { background: var(--vert-doux); color: var(--vert); border-color: transparent; }
.tag.bleu { background: var(--accent-doux); color: var(--accent); border-color: transparent; }
.vide { padding: 22px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); }
.filtres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filtre { border: 1px solid var(--line-2); background: var(--surface); padding: 5px 11px; border-radius: 20px; cursor: pointer; font-size: 13px; }
.filtre.actif { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }

/* Fiche */
.fiche { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.texte-libre { white-space: pre-wrap; }
.doc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.doc:first-of-type { border-top: 0; }
.doc .nom { font-weight: 500; flex: 1 1 200px; min-width: 0; }
.message { padding: 10px 12px; border-radius: 10px; background: var(--surface2); margin-bottom: 8px; }
.message.note { background: var(--orange-doux); }
.message .qui { font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.proposition { border: 1px solid var(--accent); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.proposition textarea { min-height: 240px; }
.zone-depot { display: block; border: 2px dashed var(--line-2); border-radius: var(--r); padding: 26px 16px; text-align: center; cursor: pointer; background: var(--surface2); margin-bottom: 8px; }
.zone-depot.survol { border-color: var(--accent); background: var(--accent-doux); }
.zone-depot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fichier-choisi { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 14px; }
.fichier-choisi .nom { flex: 1; min-width: 0; }
.case { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-bottom: 12px; }

/* Calendrier */
.grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.grille .jour-nom { background: var(--surface2); padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.case-jour { background: var(--surface); min-height: 104px; padding: 5px; min-width: 0; }
.case-jour.autre { background: var(--surface2); }
.case-jour.autre .num-jour { color: var(--muted); }
.case-jour.ajd .num-jour { background: var(--accent); color: var(--sur-accent); border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.num-jour { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.evt { display: block; width: 100%; text-align: left; border: 0; background: var(--accent-doux); color: var(--accent); border-radius: 5px; padding: 2px 5px; margin-top: 3px; font-size: 12px; line-height: 1.3; cursor: pointer; overflow: hidden; }
.evt.urgente { background: var(--rouge-doux); color: var(--rouge); }
.evt.haute { background: var(--orange-doux); color: var(--orange); }
.evt.finie { opacity: .55; text-decoration: line-through; }

.agenda-mois { display: none; margin-top: 14px; }
.agenda-jour { font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }

/* Recherche */
.resultat { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; }
.resultat .passage { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line-2); color: var(--ink-soft); }
mark { background: var(--mark); color: var(--mark-ink); border-radius: 3px; padding: 0 2px; }

/* Trace */
.table-trace { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-trace th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.table-trace td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.defile { overflow-x: auto; }

/* Compteur de dépense */
.jauge { height: 10px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--line); overflow: hidden; margin: 8px 0; }
.jauge div { height: 100%; background: var(--accent); }
.jauge div.plein { background: var(--rouge); }
.code-liaison { font-size: 22px; font-weight: 600; letter-spacing: .06em; padding: 10px 14px; background: var(--surface2); border-radius: 9px; display: inline-block; user-select: all; }

/* Connexion */
.connexion { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.connexion form { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.connexion img { width: 56px; height: 56px; border-radius: 12px; display: block; margin: 0 auto 12px; background: #fff; }
.connexion h1 { text-align: center; margin-bottom: 4px; }
.connexion p { text-align: center; color: var(--muted); margin: 0 0 20px; }

@media (max-width: 860px) { .fiche { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  body { font-size: 15px; }
  input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea { font-size: 16px; }
  .onglet { min-height: 44px; }
  .bouton { min-height: 44px; }
  .marque { display: none; }
  .saisie { flex-wrap: wrap; }
  .saisie .bouton { width: 100%; justify-content: center; }
  .case-jour { min-height: 62px; padding: 2px; }
  .evt { height: 6px; padding: 0; margin-top: 2px; font-size: 0; background: var(--accent); }
  .evt.urgente { background: var(--rouge); }
  .evt.haute { background: var(--orange); }
  .agenda-mois { display: block; }
  .grille .jour-nom { padding: 4px 1px; font-size: 11px; }
}
@media (prefers-reduced-motion: no-preference) { .onglet, .demande, .bouton { transition: background-color .12s; } }
