/* Skuro — interface sombre. Les couleurs vivent ici, dans des variables : une seule palette pour tous les clients. */
:root {
  --fond: #0e1116; --fond-2: #151a21; --carte: #181e27; --carte-2: #1f2631; --bord: #273040;
  --texte: #e8ebf1; --discret: #8d97a8; --accent: #5b8cff; --accent-fond: #1b2a4d;
  --ok: #34d399; --ok-fond: #113327; --erreur: #ff6b6b; --erreur-fond: #3a1a1f;
  --alerte: #fbbf24; --alerte-fond: #3a2d0f; --ia: #c084fc; --ia-fond: #2a1a3d;
  --rayon: 12px; --ombre: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--fond); }
body { margin: 0; font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texte); background: var(--fond); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; color: var(--texte); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.discret { color: var(--discret); font-size: .9rem; }
.texte-erreur { color: var(--erreur); }
.texte-alerte { color: var(--alerte); }
.droite { text-align: right; }

/* En-tete */
.entete { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
  padding: .7rem max(1rem, calc((100% - 72rem) / 2)); background: var(--fond-2); border-bottom: 1px solid var(--bord);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.marque { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--texte); }
.marque img { height: 36px; max-width: 160px; object-fit: contain; }
.marque span { display: flex; flex-direction: column; line-height: 1.15; }
.marque small { color: var(--discret); font-size: .78rem; }
nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; align-items: center; }
nav a { color: var(--discret); text-decoration: none; padding: .35rem .5rem; border-radius: 6px; }
nav a:hover { color: var(--texte); background: var(--carte); }
nav form { margin: 0; }
main { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* Cartes et tuiles */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; box-shadow: var(--ombre); overflow-x: auto; }
.etroite { max-width: 30rem; margin: 2rem auto; }
.etroite.large { max-width: 44rem; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.tuiles.compactes { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); margin: .5rem 0 0; }
.tuile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.2rem; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); text-decoration: none; color: var(--texte); box-shadow: var(--ombre); }
a.tuile:hover { border-color: var(--accent); }
.tuile .libelle { color: var(--discret); font-size: .85rem; }
.tuile .valeur { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.tuile.alerte .valeur { color: var(--erreur); }
.tuile .pastille { align-self: flex-start; margin-top: .3rem; }
.repli summary { cursor: pointer; color: var(--discret); font-weight: 600; }
.repli { padding: .9rem 1.3rem; }

/* Pastilles, etats, points */
.pastille { background: var(--carte-2); color: var(--discret); border-radius: 99px; padding: .1rem .55rem; font-size: .78rem; font-weight: 600; }
.pastille.rouge { background: var(--erreur-fond); color: var(--erreur); }
.pastille.verte { background: var(--ok-fond); color: var(--ok); }
.etat { padding: .2rem .7rem; border-radius: 99px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.etat.ok { background: var(--ok-fond); color: var(--ok); }
.etat.erreur { background: var(--erreur-fond); color: var(--erreur); }
.etat.attente { background: var(--alerte-fond); color: var(--alerte); }
.point { display: inline-block; width: .6rem; height: .6rem; border-radius: 99px; margin-right: .5rem; vertical-align: middle; }
.point.rouge { background: var(--erreur); box-shadow: 0 0 6px var(--erreur); }
.point.vert { background: var(--ok); }
.message { padding: .7rem 1rem; border-radius: 8px; background: var(--ok-fond); color: var(--ok); border: 1px solid transparent; }
.message.error { background: var(--erreur-fond); color: var(--erreur); }
.message.warning { background: var(--alerte-fond); color: var(--alerte); }
.message.info { background: var(--accent-fond); color: #b7c9ff; }

/* Formulaires */
form > div, form > p { margin-bottom: .9rem; }
label, .libelle { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
label.case { display: flex; gap: .5rem; align-items: flex-start; font-weight: normal; margin: .6rem 0; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--bord); border-radius: 8px; font: inherit; color: var(--texte); background: var(--fond-2); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=file] { color: var(--discret); }
textarea { resize: vertical; }
.helptext { display: block; color: var(--discret); font-size: .85rem; margin-top: .3rem; }
.errorlist { color: var(--erreur); margin: .3rem 0; padding-left: 1.1rem; font-size: .9rem; }
button, .bouton { display: inline-block; padding: .55rem 1rem; border: 1px solid transparent; border-radius: 8px; background: var(--accent);
  color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3; }
button:hover, .bouton:hover { filter: brightness(1.1); }
.secondaire { background: var(--carte-2); color: var(--texte); border-color: var(--bord); }
.secondaire:hover { border-color: var(--accent); }
.petit { padding: .3rem .7rem; font-size: .85rem; }
.danger { color: var(--erreur); border-color: var(--erreur-fond); }
button.danger:not(.secondaire) { background: var(--erreur); color: #fff; }
button.lien { background: none; color: var(--discret); padding: .35rem .5rem; font-weight: normal; }
button.lien:hover { color: var(--texte); }
button.ia { background: var(--ia); color: #1a0b2e; }
.apercu-logo { max-height: 80px; max-width: 100%; background: var(--fond-2); padding: .5rem; border-radius: 8px; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
thead th { color: var(--discret); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--carte-2); }
td.actions, .actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
td.actions form, .actions form { margin: 0; }
.ajouts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }

/* Boite SAV */
.titre-ligne { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.titre-ligne form { margin: 0; }
.synchro { margin: 0 0 1.2rem; }
.onglets { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1.2rem 0 .8rem; border-bottom: 1px solid var(--bord); }
.onglets a { padding: .5rem .9rem; text-decoration: none; color: var(--discret); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.onglets a.actif { color: var(--texte); border-color: var(--accent); font-weight: 600; }
.filtres { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filtres input[type=search] { flex: 1; min-width: 14rem; width: auto; }
.filtres select { width: auto; }
table.demandes td a { color: var(--texte); font-weight: 600; text-decoration: none; }
table.demandes td.actions { display: table-cell; white-space: nowrap; text-align: right; }
table.demandes td.actions form, table.demandes td.actions .bouton { display: inline-block; vertical-align: middle; margin-left: .4rem; }
table.demandes td a:hover { color: var(--accent); }

/* Fiche d'une demande */
.deux-colonnes { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.2rem; align-items: start; }
@media (max-width: 60rem) { .deux-colonnes { grid-template-columns: 1fr; } }
.ia { border-color: #3b2a55; background: linear-gradient(180deg, var(--ia-fond), var(--carte)); }
.ia h2::before { content: "✦ "; color: var(--ia); }
.fil { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 1.2rem; }
.bulle { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: .9rem 1.1rem; max-width: 92%; box-shadow: var(--ombre); }
.bulle header { margin-bottom: .4rem; font-size: .88rem; }
.bulle .corps { white-space: pre-wrap; overflow-wrap: anywhere; }
.bulle.boutique { align-self: flex-end; background: var(--accent-fond); border-color: #2d4a8a; }
.bulle.operateur { background: var(--alerte-fond); border-color: #5a4612; }
.pieces { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.pieces a { text-decoration: none; background: var(--fond-2); padding: .25rem .6rem; border-radius: 6px; }
.fiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem 1rem; margin-bottom: .8rem; }
.fiche .libelle { color: var(--discret); font-weight: normal; font-size: .8rem; margin-bottom: .1rem; }
table.lignes td { padding: .5rem .4rem; }
.reponse textarea { min-height: 14rem; }
.proposition { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.proposition input { flex: 1; min-width: 12rem; width: auto; }
ul#id_destinataires { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.2rem; flex-wrap: wrap; }
ul#id_destinataires label { font-weight: normal; display: flex; gap: .4rem; margin: 0; }
.texte-contrat { max-height: 18rem; overflow-y: auto; padding: .8rem 1rem; background: var(--fond-2); border-radius: 8px; font-size: .92rem; }
.cout { font-weight: normal; opacity: .8; font-size: .85em; margin-left: .3rem; }
table.tarifs tr.actif td { color: var(--ia); font-weight: 600; }
table.journal tr.erreur td { color: var(--erreur); }
table.journal tr.ok td { color: var(--ok); }
.filtres label { display: flex; align-items: center; gap: .4rem; font-weight: normal; margin: 0; }
.filtres input[type=date], .filtres input[type=text], .filtres input[type=password] { width: auto; }
