/* Charte DimVal, déclinée sur fond sombre : Poppins, violet #5B2D8E, noir #1A1A1A,
   violet clair et lavande pour le texte et les accents. */
@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(fonts/poppins-400.woff) format('woff'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(fonts/poppins-500.woff) format('woff'); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url(fonts/poppins-700.woff) format('woff'); }
:root {
  color-scheme: dark;
  --dv-violet: #5B2D8E;
  --dv-violet-fonce: #47216F;
  --dv-violet-clair: #AB87C8;
  --dv-lavande: #F2EBF8;
  --fond: #1A1A1A;
  --carte: #221E27;
  --trait: #352E3F;
  --texte: #F2EBF8;
  --doux: #A99FB5;
  --accent: #C3A2E0;
  --accent-clair: #2C2436;
  --barre: #141216;
  --vert: #7FD3A4; --vert-f: #17301F;
  --bleu: #DCC6F3; --bleu-f: #47216F;
  --orange: #F0B56A; --orange-f: #3A2A12;
  --rouge: #F49088; --rouge-f: #3D1D1B;
  --gris: #B5ACBF; --gris-f: #2E2836;
  --violet: #C3A2E0; --violet-f: transparent;
  --ombre: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 12px/1.5 Poppins, "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.4px; }
h2 { font-size: 13px; margin: 0; font-weight: 500; }

.barre { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px; background: var(--barre); border-bottom: 1px solid var(--trait); color: #fff; }
.marque { display: flex; align-items: baseline; gap: 10px; color: #fff; }
.marque:hover { text-decoration: none; }
.marque .logo { font-weight: 700; font-size: 18px; letter-spacing: -1px; }
.marque .logo i { font-style: normal; color: var(--dv-violet-clair); }
.marque .produit { font-size: 11px; font-weight: 500; color: var(--doux); }
#commande { width: 200px; font-size: 11px; padding: 5px 10px; background: var(--carte); }
#suggestions { position: fixed; z-index: 20; margin: 0; padding: 4px; list-style: none; min-width: 290px; background: var(--carte); border: 1px solid var(--trait); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .55); }
#suggestions[hidden] { display: none; }
#suggestions li { display: flex; gap: 12px; align-items: baseline; padding: 6px 10px; border-radius: 5px; cursor: pointer; color: var(--texte); }
#suggestions li b { min-width: 40px; color: var(--accent); font-weight: 500; }
#suggestions li small { margin-left: auto; color: var(--doux); font-size: 11px; }
#suggestions li.choisi, #suggestions li:hover { background: var(--dv-violet); }
#suggestions li.choisi b, #suggestions li:hover b, #suggestions li.choisi small, #suggestions li:hover small { color: #fff; }
.tuile .titre { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tuile .code { font-size: 11px; font-weight: 400; letter-spacing: .5px; color: var(--doux); }
.barre nav { display: flex; gap: 4px; flex: 1; }
.barre nav a { color: var(--doux); padding: 6px 12px; border-radius: 6px; font-weight: 500; }
.barre nav a:hover { color: #fff; text-decoration: none; }
.barre nav a.actif { color: #fff; background: var(--dv-violet); text-decoration: none; }
.mode { font-size: 11px; padding: 3px 10px; border-radius: 10px; background: #F0B56A; color: #2b1c00; font-weight: 500; white-space: nowrap; }
.mode.notion { background: var(--vert-f); color: var(--vert); }
.rafraichir { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rafraichir .bouton { padding: 2px 12px; line-height: 1.4; }
.lu { font-size: 10px; line-height: 1.2; color: var(--doux); white-space: nowrap; }
.lu.alerte { color: var(--orange); }

main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.attente { color: var(--doux); }
.alerte { background: var(--rouge-f); color: var(--rouge); border-radius: 8px; padding: 14px 16px; }

.entete { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.fil { font-size: 11px; color: var(--doux); margin-bottom: 4px; }
.fil a { color: var(--doux); }
.sous { color: var(--doux); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.bouton { font: inherit; font-weight: 500; border: 1px solid var(--dv-violet); background: var(--dv-violet); color: #fff; padding: 6px 16px; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: background-color .15s ease, border-color .15s ease; }
.bouton:hover { background: #6D3AA6; border-color: #6D3AA6; text-decoration: none; }
.bouton.second { background: transparent; border-color: var(--dv-violet-clair); color: var(--accent); }
.bouton.second:hover { background: var(--accent-clair); border-color: var(--accent); }
.bouton.discret { background: transparent; border-color: var(--trait); color: var(--texte); padding: 4px 12px; }
.bouton.discret:hover { background: var(--accent-clair); border-color: var(--dv-violet-clair); }
.bouton:disabled { opacity: .6; cursor: default; }

/* Launchpad */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.tuile { display: flex; flex-direction: column; justify-content: space-between; min-height: 132px; padding: 14px 16px; background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; box-shadow: var(--ombre); color: var(--texte); cursor: pointer; text-align: left; font: inherit; }
.tuile { border-top: 3px solid var(--dv-violet); transition: border-color .15s ease, background-color .15s ease; }
.tuile:hover { border-color: var(--dv-violet-clair); background: var(--accent-clair); text-decoration: none; }
.tuile .titre { font-weight: 500; }
.tuile .chiffre { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -1.5px; color: var(--dv-lavande); }
.tuile .detail { font-size: 11px; color: var(--doux); }
.tuile.action .chiffre { font-size: 26px; }
.colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(560px, 1fr)); gap: 16px; }

/* Accueil : situations, indicateurs, graphiques, pages */
h2.etage { margin: 22px 0 10px; font-size: 13px; font-weight: 700; }
h2.etage .compte { color: var(--doux); font-weight: 400; margin-left: 4px; }
.situations { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.situation { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; min-height: 104px; background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; color: var(--texte); transition: border-color .15s ease, background-color .15s ease; }
.situation:hover { border-color: var(--dv-violet-clair); background: var(--accent-clair); text-decoration: none; }
.situation .s-titre { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; line-height: 1.35; }
.situation .s-picto { flex: none; width: 16px; height: 16px; border-radius: 50%; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; background: var(--gris-f); color: var(--gris); }
.situation.alerte .s-picto { background: var(--orange); color: #2B1C00; }
.situation .s-texte { color: var(--texte); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.situation .s-detail { color: var(--doux); font-size: 11px; margin-top: auto; }
.situation.toutes { justify-content: center; align-items: center; text-align: center; border-style: dashed; color: var(--accent); }

.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.insight { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; color: var(--texte); transition: border-color .15s ease, background-color .15s ease; }
.insight:hover { border-color: var(--dv-violet-clair); background: var(--accent-clair); text-decoration: none; }
.insight .i-lib { font-weight: 500; line-height: 1.3; min-height: 2.6em; }
.insight .i-val { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; color: var(--dv-lavande); }
.insight .i-val small { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--doux); }
.insight.alerte .i-val { color: var(--rouge); }
.insight .i-det { font-size: 11px; color: var(--doux); }

.cartes-g { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.carte-g { margin: 0; }
.carte-g.large { grid-column: 1 / -1; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 16px 0; color: var(--doux); font-size: 11px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 2px; }
.rangs { padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.rang { display: grid; grid-template-columns: minmax(90px, 190px) 1fr 44px; align-items: center; gap: 12px; }
.rang-nom { color: var(--texte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.rang-nom:hover { color: var(--accent); }
.rang-val { text-align: right; color: var(--texte); font-variant-numeric: tabular-nums; }
.entete-rang { margin-bottom: -4px; }
.entete-rang .rang-val { color: var(--doux); font-size: 11px; }
.piste { min-width: 0; }
.pile { display: flex; gap: 2px; height: 12px; }
.pile i { min-width: 3px; border-radius: 2px; }
.pile i:first-child { border-radius: 4px 2px 2px 4px; }
.pile i:last-child { border-radius: 2px 4px 4px 2px; }
.pile i:only-child { border-radius: 4px; }
.pile i { transition: filter .12s ease; }
.pile i:hover { filter: brightness(1.35); box-shadow: 0 0 0 2px rgba(242, 235, 248, .55); }
.graphe { display: block; width: 100%; height: auto; padding: 6px 10px 10px; }
.graphe .grille { stroke: var(--trait); stroke-width: 1; }
.graphe .axe { fill: var(--doux); font-size: 10px; font-family: inherit; }
.graphe .cible { fill: transparent; }
.graphe .cible:hover { fill: rgba(242, 235, 248, .06); }
#bulle { position: fixed; z-index: 30; pointer-events: none; background: #0F0D12; color: var(--texte); border: 1px solid var(--trait); border-radius: 6px; padding: 5px 9px; font-size: 11px; max-width: 320px; }
#bulle[hidden] { display: none; }

.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.page { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; color: #fff; background: var(--dv-violet); transition: filter .15s ease, transform .1s ease-out; }
.page:nth-child(2) { background: var(--dv-violet-fonce); }
.page:nth-child(3) { background: #6D3AA6; }
.page:nth-child(4) { background: #3A1B5C; }
.page:nth-child(5) { background: #8451A6; }
.page:nth-child(6) { background: #5B2D8E; }
.page:nth-child(7) { background: #2E2836; box-shadow: inset 0 0 0 1px var(--dv-violet-clair); }
.page:hover { filter: brightness(1.15); text-decoration: none; }
.page:active { transform: scale(.98); }
.page svg { width: 22px; height: 22px; }
.page span { font-weight: 500; }
.page small { font-size: 11px; opacity: .75; letter-spacing: .5px; }
@media (max-width: 760px) { .cartes-g { grid-template-columns: 1fr; } .rang { grid-template-columns: minmax(80px, 120px) 1fr 36px; } }

/* Blocs et tableaux */
.bloc { background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; box-shadow: var(--ombre); margin-bottom: 16px; overflow: hidden; }
.bloc > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--trait); }
.bloc > header .compte { color: var(--doux); font-weight: 400; margin-left: 6px; }
.vide { padding: 16px; color: var(--doux); margin: 0; }
.defile { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 500; color: var(--doux); padding: 8px 16px; border-bottom: 1px solid var(--trait); white-space: nowrap; }
td { padding: 9px 16px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--accent-clair); }
td.num, td.date { color: var(--doux); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.retard { color: var(--rouge); font-weight: 500; }
td .sousligne { font-size: 11px; color: var(--doux); }

.outils { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
input, select, textarea { font: inherit; color: var(--texte); background: var(--carte); border: 1px solid var(--trait); border-radius: 6px; padding: 6px 9px; }
input:focus, select:focus, .bouton:focus-visible, .tuile:focus-visible, a:focus-visible { outline: 2px solid #8451A6; outline-offset: 2px; }
.outils input[type=search] { min-width: 260px; flex: 1; max-width: 380px; }
.outils label { color: var(--doux); display: flex; gap: 6px; align-items: center; }

.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 10px; border-radius: 10px; white-space: nowrap; background: var(--gris-f); color: var(--gris); }
.b-violet { box-shadow: inset 0 0 0 1px var(--dv-violet-clair); }
.b-vert { background: var(--vert-f); color: var(--vert); }
.b-bleu { background: var(--bleu-f); color: var(--bleu); }
.b-orange { background: var(--orange-f); color: var(--orange); }
.b-rouge { background: var(--rouge-f); color: var(--rouge); }
.b-violet { background: var(--violet-f); color: var(--violet); }
select.etat { font-size: 11px; font-weight: 500; padding: 3px 6px; border-radius: 10px; border-color: transparent; cursor: pointer; }

.jauge { display: flex; align-items: center; gap: 8px; min-width: 130px; white-space: nowrap; color: var(--doux); font-size: 11px; }
.jauge i { flex: 1; height: 6px; min-width: 60px; background: var(--gris-f); border-radius: 3px; overflow: hidden; }
.jauge b { display: block; height: 100%; background: var(--dv-violet-clair); border-radius: 3px; }

.attributs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; padding: 14px 16px; margin: 0; }
.attributs dt { font-size: 11px; color: var(--doux); }
.attributs dd { margin: 2px 0 0; overflow-wrap: anywhere; }

/* Sélection de tâches et barre d'action groupée */
th.coche, td.coche { width: 34px; padding-right: 0; }
td.coche input, th.coche input { width: 15px; height: 15px; margin: 0; vertical-align: middle; accent-color: var(--dv-violet-clair); cursor: pointer; }
tr:has(td.coche input:checked) { background: var(--accent-clair); }
#lot { position: fixed; z-index: 15; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; padding: 10px 16px; max-width: calc(100vw - 24px); background: #0F0D12; border: 1px solid var(--dv-violet-clair); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .6); }
#lot[hidden] { display: none; }
#lot label { display: flex; align-items: center; gap: 8px; color: var(--doux); }
body.avec-lot main { padding-bottom: 120px; }
body.avec-lot #toast { bottom: 96px; }

/* Dialogue de transaction */
dialog { border: 1px solid var(--trait); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--carte); color: var(--texte); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(10, 16, 26, .5); }
dialog form { display: flex; flex-direction: column; }
dialog h2 { padding: 16px 20px; border-bottom: 1px solid var(--trait); font-size: 14px; }
dialog .champs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 16px 20px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--doux); }
dialog label.large { grid-column: 1 / -1; }
dialog label input, dialog label select { color: var(--texte); font-size: 12px; }
dialog .fixe { font-size: 12px; color: var(--texte); padding: 6px 0; }
dialog .message { margin: 0 20px 12px; color: var(--rouge); min-height: 1em; }
dialog .pied { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--trait); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--dv-violet); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); }
#toast.visible { opacity: 1; }
#toast.erreur { background: var(--rouge); color: #2B0F0D; }

@media (max-width: 820px) {
  .barre { gap: 10px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .barre nav a { padding: 6px 8px; }
  .marque .produit { display: none; }
}
@media (max-width: 640px) {
  main { padding: 16px 16px 48px; }
  dialog .champs { grid-template-columns: 1fr; }
  .colonnes { grid-template-columns: 1fr; }
}
