/* AADD - charte Vikings Suite (relevée sur vikings-suite.com le 30/11/2026). */
@font-face { font-family: "Sora"; src: url("/static/fonts/sora.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/static/fonts/manrope.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --ink: #1b2147;
  --muted: #5f6784;
  --line: #e6e9f5;
  --bg: #ffffff;
  --bg-soft: #f5f6fc;
  --blue: #4c6ef5;
  --blue-d: #3b5bdb;
  --violet: #7048e8;
  --violet-d: #5f3dc4;
  --soft-blue: #eef1fe;
  --soft-violet: #f1ecfe;
  --grad: linear-gradient(135deg, #3b5bdb, #7048e8);
  --shadow: 0 24px 60px -28px rgba(63, 55, 160, .45);
  --radius: 18px;
  --maxw: 1180px;
  --fd: "Sora", system-ui, sans-serif;
  --fb: "Manrope", system-ui, sans-serif;
  --alerte: #c92a2a;
  --alerte-soft: #fff1f1;
  --succes: #2b8a3e;
  --succes-soft: #ebfbee;
  --ambre: #b35c00;
  --ambre-soft: #fff4e6;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--fb); color: var(--ink); background: var(--bg-soft); font-size: 16px; line-height: 1.55; }
a { color: var(--blue-d); }
a:hover { color: var(--violet-d); }
h1, h2, h3, h4 { font-family: var(--fd); line-height: 1.25; margin: 0 0 .6em; color: var(--ink); }
h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--soft-blue); padding: .1em .35em; border-radius: 6px; }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.entete-interieur { max-width: var(--maxw); margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 28px; }
.marque { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.marque-logo { height: 52px; width: auto; display: block; }
.nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.nav a { font-family: var(--fd); font-weight: 700; font-size: .95rem; color: var(--ink); text-decoration: none; padding: 8px 14px; border-radius: 999px; }
.nav a:hover { background: var(--soft-blue); }
.nav a.actif { background: var(--soft-violet); color: var(--violet-d); }
.compte { position: relative; }
.compte summary { cursor: pointer; list-style: none; font-weight: 700; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.compte summary::-webkit-details-marker { display: none; }
.compte-menu { position: absolute; left: 0; bottom: calc(100% + 6px); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.compte-menu a, .compte-menu .btn-lien { display: block; padding: 8px 10px; border-radius: 8px; text-align: left; width: 100%; }
.compte-menu a:hover, .compte-menu .btn-lien:hover { background: var(--bg-soft); }

/* Page */
.page { max-width: 900px; margin: 0 auto; padding: 32px 24px 64px; }
.page-large { max-width: var(--maxw); }
.sous-titre { color: var(--muted); font-size: 1.05rem; margin-top: -.2em; }
.pied { max-width: var(--maxw); margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

/* Cartes et blocs */
.carte { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(27, 33, 71, .04); }
.carte-etroite { max-width: 520px; }
.carte-ancienne { background: var(--bg-soft); }
.carte-alerte, .carte-retard { border-color: #f3c4c4; background: var(--alerte-soft); }
.bloc { margin: 28px 0; }
.bloc > h2 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bloc-alerte > h2 { color: var(--alerte); }
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ajouts { align-items: start; }
.ajouts .carte { margin: 0; }

/* Lignes */
.lignes, .taches, .options, .codes, .commentaires { list-style: none; margin: 0; padding: 0; }
.ligne { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lignes > .ligne:last-child { border-bottom: 0; }
.bloc > .lignes { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px; }
.ligne-corps { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ligne-titre { font-weight: 700; }
.ligne-meta { color: var(--muted); font-size: .88rem; display: block; }
.ligne-fin { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.ligne-retard .ligne-titre { color: var(--alerte); }
.date { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.date-retard { color: var(--alerte); font-weight: 700; }
.citation { border-left: 3px solid var(--violet); padding: 4px 10px; background: var(--soft-violet); border-radius: 0 8px 8px 0; display: block; margin-top: 4px; }
.vide { color: var(--muted); font-style: italic; }
.texte { white-space: normal; }
.phrase { font-family: var(--fd); font-size: 1.15rem; font-weight: 600; }
.libelle { font-weight: 700; font-size: .9rem; color: var(--muted); margin-bottom: .3em; display: block; }

/* Pastilles */
.pastilles { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.statut, .prio { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.statut { background: var(--soft-blue); color: var(--blue-d); }
.statut-bloque { background: var(--alerte-soft); color: var(--alerte); }
.statut-soumise, .statut-fin_proposee { background: var(--ambre-soft); color: var(--ambre); }
.statut-en_cours { background: var(--succes-soft); color: var(--succes); }
.statut-termine, .statut-archive { background: #f1f3f5; color: #495057; }
.prio { background: var(--soft-violet); color: var(--violet-d); }
.prio-1 { background: var(--grad); color: #fff; }

/* Formulaires */
.champ { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.champ label, .champ .libelle { font-weight: 700; font-size: .9rem; }
.requis { font-weight: 400; color: var(--muted); font-size: .8rem; margin-left: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input:not([type]), select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid #d5daea; border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(76, 110, 245, .25); border-color: var(--blue); }
input[type=file] { font: inherit; }
.aide { color: var(--muted); font-size: .85rem; margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.actions-ligne { margin: 10px 0; }
form.en-ligne { display: inline; }
.actions-cellule { white-space: nowrap; }

/* Boutons */
.btn { font-family: var(--fb); font-weight: 600; font-size: .95rem; border: 0; cursor: pointer; padding: 10px 20px; border-radius: 999px; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn-principal { background: var(--grad); color: #fff; }
.btn-principal:hover { color: #fff; filter: brightness(1.06); }
.btn-secondaire { background: var(--bg); color: var(--blue-d); border: 1px solid #c9d1f5; }
.btn-secondaire:hover { background: var(--soft-blue); color: var(--blue-d); }
.btn-lien { background: none; color: var(--blue-d); padding: 4px 6px; text-decoration: underline; border-radius: 6px; }
.btn-petit { font-size: .85rem; padding: 6px 14px; }
.btn-lien.btn-petit { padding: 4px 6px; }
.btn-danger { color: var(--alerte); }

/* Replis */
.repli { margin-top: 10px; }
.repli > summary { cursor: pointer; color: var(--blue-d); font-weight: 600; font-size: .92rem; }
.repli[open] > summary { margin-bottom: 12px; }
details.carte > summary { font-family: var(--fd); font-weight: 700; color: var(--ink); font-size: 1rem; }
.suite > summary { cursor: pointer; color: var(--blue-d); font-weight: 600; padding: 12px 0; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; }
.flash-succes { background: var(--succes-soft); color: var(--succes); border: 1px solid #c3e6cb; }
.flash-erreur { background: var(--alerte-soft); color: var(--alerte); border: 1px solid #f3c4c4; }

/* Décisions */
.carte-decision h3, .carte-decision h4 { margin-top: 4px; }
.options { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.option { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.option em { font-style: normal; font-size: .78rem; font-weight: 700; color: var(--violet-d); background: var(--soft-violet); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.option-reco { border-color: #c5b6f7; background: #fbf9ff; }
.option-choisie { border-color: #b2dfbb; background: var(--succes-soft); }

/* Projet */
.entete-projet .infos { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; margin: 0 0 8px; }
.infos dt { font-size: .8rem; color: var(--muted); font-weight: 700; }
.infos dd { margin: 0; font-weight: 600; }
.fiche dt, .bilan dt { font-weight: 700; font-family: var(--fd); font-size: .95rem; margin-top: 14px; }
.fiche dd, .bilan dd { margin: 4px 0 0; }
.sous-objectif h3 { margin: 0; }
.so-atteint h3 { color: var(--succes); }
.taches { margin-top: 10px; border-top: 1px solid var(--line); }
.tache { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tache-faite .ligne-titre, .tache-annulee .ligne-titre { color: var(--muted); text-decoration: line-through; }
.taches .carte-decision { margin: 10px 0; }
.tache-actions { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.tache-actions > details { margin-top: 6px; }
.tache-actions > details[open] { flex-basis: 100%; background: var(--bg-soft); border-radius: 12px; padding: 12px 14px; }
.commentaires li { font-size: .9rem; padding: 6px 10px; background: var(--bg-soft); border-radius: 8px; margin-top: 6px; }
.etapes li { margin-bottom: 8px; }
.cle { font-size: 1.05rem; letter-spacing: .05em; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.codes code { font-size: 1.05rem; display: block; text-align: center; padding: 8px; }

/* Frise */
.frise { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.evenement { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0 14px; }
.evenement::before { content: ""; position: absolute; left: -25px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--blue); }
.evenement-decision::before { border-color: var(--violet); background: var(--violet); }
.evenement-depense::before { border-color: var(--ambre); }
.evenement-statut::before { border-color: var(--muted); }
.evenement-changement_date::before { border-color: var(--alerte); }
.evenement-resultat::before { border-color: var(--succes); background: var(--succes); }
.evenement-date { font-weight: 700; font-size: .9rem; color: var(--muted); padding-top: 2px; }
.evenement-type { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--violet-d); }
.piece { display: inline-block; margin-top: 4px; font-weight: 600; }

/* Tableaux */
.defilement { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tableau th, .tableau td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .93rem; }
.tableau th { background: var(--bg-soft); font-family: var(--fd); font-size: .82rem; color: var(--muted); }
.tableau .nombre { text-align: right; white-space: nowrap; }
.tableau .valeur { max-width: 280px; overflow-wrap: anywhere; }
.tableau-projets select { width: auto; padding: 4px 8px; }
.ordre { white-space: nowrap; }
.total { font-family: var(--fd); font-size: 1.6rem; font-weight: 700; }

/* Onglets et pagination */
.onglets { display: flex; gap: 6px; margin: 20px 0 16px; flex-wrap: wrap; }
.onglets a { padding: 8px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; color: var(--ink); border: 1px solid var(--line); background: var(--bg); }
.onglets a.actif { background: var(--soft-violet); color: var(--violet-d); border-color: #d9cff9; }
.pagination { display: flex; gap: 16px; margin-top: 12px; }

@media (max-width: 820px) {
  .entete-interieur { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .marque-logo { height: 38px; }
  .nav { order: 3; flex: 1 1 100%; justify-content: flex-start; }
  .compte { margin-left: auto; }
  .page { padding: 20px 16px 48px; }
  h1 { font-size: 1.5rem; }
  .grille-2, .grille-3 { grid-template-columns: 1fr; }
  .ligne { flex-direction: column; }
  .ligne-fin { justify-content: flex-start; }
  .evenement { grid-template-columns: 1fr; gap: 2px; }
  .pied { flex-direction: column; }
}

/* Devis signés (V1.1) */
.devis-alerte { background: var(--alerte-soft); color: var(--alerte); }
.devis-attente { background: var(--ambre-soft); color: var(--ambre); }
.devis-facture { background: var(--succes-soft); color: var(--succes); }
.devis-clos { background: #f1f3f5; color: #495057; }
.evenement-devis-alerte::before { border-color: var(--alerte); background: var(--alerte); }
.evenement-devis-facture::before { border-color: var(--succes); background: var(--succes); }
.evenement-devis-report::before { border-color: var(--ambre); }
.evenement-devis-signe::before { border-color: var(--violet); background: var(--violet); }

/* QR code d'enrôlement */
.qr { margin: 12px 0 6px; }
.qr svg { display: block; width: 220px; height: 220px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }

/* Mise en page à barre latérale (briques Vikings Suite) */
body.avec-barre { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.barre { position: sticky; top: 0; height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; gap: 22px; padding: 20px 16px; background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
.barre .marque { padding: 0 8px; }
.barre .nav { flex-direction: column; flex: 0 0 auto; gap: 4px; }
.barre .nav a { border-radius: 12px; padding: 10px 14px; line-height: 1.3; }
.barre-bas { margin-top: auto; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.barre .compte summary { display: block; border-radius: 12px; }
.contenu { min-width: 0; display: flex; flex-direction: column; }
.contenu .page { width: 100%; box-sizing: border-box; }
.contenu .pied { margin-top: auto; width: 100%; box-sizing: border-box; }
@media (max-width: 900px) {
  body.avec-barre { display: block; }
  .barre { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .barre .marque-logo { height: 38px; }
  .barre .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; order: 3; }
  .barre .nav a { padding: 6px 10px; font-size: .88rem; }
  .barre-bas { margin: 0 0 0 auto; flex-direction: row; align-items: center; border-top: 0; padding-top: 0; }
  .barre .nav-bas { flex: 0 0 auto; order: 0; }
  .compte-menu { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); }
}

/* Tableau de bord : impayés, lignes de vie, graphique */
.cartes-impayes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.carte-impaye { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.carte-impaye:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.carte-impaye .total { font-family: var(--fd); font-size: 1.6rem; font-weight: 800; }
.vies { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.vie h3 { margin: 4px 0 10px; font-size: 1.05rem; }
.vie h3 a { color: var(--ink); text-decoration: none; }
.frise-courte .evenement { grid-template-columns: 84px 1fr; padding: 6px 0 8px; }
.frise-courte .texte { font-size: .9rem; }
.graphique { margin: 0 0 12px; }
.graphique svg { width: 100%; height: auto; display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
tr.ligne-retard td:first-child { font-weight: 700; }
body.avec-barre { background: linear-gradient(to right, var(--bg) 280px, var(--bg-soft) 280px); }
@media (max-width: 900px) { body.avec-barre { background: var(--bg-soft); } }
