/* Tableau de bord */

/* Couleurs des états, les mêmes que les étiquettes de la liste */
.s-verifier { background: var(--warning-500); }
.s-valider { background: var(--gray-600); }
.s-payer { background: var(--blue-500); }
.s-late { background: var(--danger-500); }

/* Chiffres clés */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px; border-radius: 16px; background: #fff; border: 1px solid var(--gray-100);
}
.stat-label { font-size: 13px; font-weight: 500; color: var(--gray-600); }
.stat-value { font: 600 26px/1.2 var(--font-num); color: var(--gray-900); letter-spacing: -0.01em; white-space: nowrap; }
.stat-sub { font-size: 12px; color: var(--gray-600); font-weight: 500; }
.stat-trend { display: flex; align-items: center; gap: 8px; }
.trend { font: 600 12px/1 var(--font-num); padding: 4px 7px; border-radius: 6px; }
.trend.up-good { background: var(--success-50); color: var(--success-600); }
.vs { font-size: 12px; color: var(--gray-600); }

/* Petit visuel en bas de chaque chiffre */
.stat-viz { margin-top: auto; padding-top: 12px; }
.stat-bar { display: flex; gap: 3px; height: 8px; }
.stat-bar i { display: block; height: 100%; border-radius: 99px; outline: none; }
.stat-bar i:hover, .stat-bar i:focus-visible { filter: brightness(1.1); }
.spark { display: block; width: 100%; height: 36px; overflow: visible; }
.stat-cols { display: flex; align-items: flex-end; gap: 5px; height: 36px; }
.stat-cols i { flex: 1; border-radius: 4px; background: var(--gray-100); outline: none; }
.stat-cols i.now { background: linear-gradient(180deg, #4b5258, #2c2c30); }
.stat-cols i:hover, .stat-cols i:focus-visible { filter: brightness(0.92); }
.gauge { position: relative; height: 8px; border-radius: 99px; background: var(--gray-50); }
.gauge i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, #5dd26e, #36a747); }
.gauge b { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--gray-900); }
.gauge-lbl { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--gray-600); }

/* Grille des cartes */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
/* Le graphique prend toute la hauteur de sa carte, alignée sur « À faire » */
.d-due { display: flex; flex-direction: column; }
.d-due .chart { flex: 1; min-height: 250px; }
.dash-grid .card { background: #fff; border: 1px solid var(--gray-100); border-radius: 16px; padding: 20px; min-width: 0; }

/* Chiffres et colonnes cliquables : ils ouvrent la liste filtrée */
a.stat { color: inherit; text-decoration: none; transition: transform 0.15s, box-shadow 0.15s; }
a.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, 0.06); }
a.col { text-decoration: none; }
a.col:hover .col-track { box-shadow: inset 0 0 0 1.5px var(--danger-500); }
.sup-list a { color: inherit; text-decoration: none; }
.sup-list li:has(a:hover) .sup-name strong { text-decoration: underline; }
.d-todo { grid-column: span 5; }
.d-due { grid-column: span 7; }
.d-cat, .d-sup, .d-ai { grid-column: span 4; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head .card-title { margin: 0; }
.card-title { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 16px; }
.card-note { font-size: 12px; font-weight: 500; color: var(--gray-600); }

/* À faire aujourd'hui */
.todo { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.todo-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; background: var(--tone-bg);
}
.todo-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: #fff; color: var(--tone);
}
.todo-icon svg.i { width: 18px; height: 18px; }
.todo-avatar { width: 34px; height: 34px; font-size: 11px; border-width: 0; box-shadow: none; }
.todo-text { display: flex; flex-direction: column; min-width: 0; }
.todo-text strong { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.todo-text span { font-size: 12px; color: var(--gray-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item .btn { background: #fff; text-decoration: none; }
.tone-red { --tone: var(--danger-500); --tone-bg: var(--danger-50); }
.tone-orange { --tone: var(--warning-600); --tone-bg: var(--warning-50); }
.tone-blue { --tone: var(--blue-600); --tone-bg: var(--blue-50); }
.tone-gray { --tone: var(--gray-700); --tone-bg: #f3f5f7; }
.todo-empty { display: flex; align-items: center; gap: 8px; color: var(--success-600); font-weight: 600; }
.todo-empty svg.i { width: 18px; height: 18px; }

/* Graphique des échéances : colonnes arrondies dans un rail clair, sans axe,
   chaque montant écrit au-dessus de sa colonne */
.chart { display: flex; gap: 12px; height: 260px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.col-total { font: 600 14px/1 var(--font-num); color: var(--gray-900); white-space: nowrap; }
.col.is-late .col-total { color: var(--danger-600); }
.col.is-empty .col-total { color: var(--gray-600); }
.col-track {
  flex: 1; width: min(64px, 100%); position: relative;
  border-radius: 14px; background: var(--gray-50);
}
.col.is-late .col-track { background: #fff5f5; }
.col-stack {
  position: absolute; left: 4px; right: 4px; bottom: 4px; max-height: calc(100% - 8px);
  display: flex; flex-direction: column-reverse; gap: 3px;
  animation: grow 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  transform-origin: bottom;
}
.seg { display: block; min-height: 8px; border-radius: 10px; cursor: default; outline: none; transition: filter 0.15s; }
/* Dégradé du clair (haut) vers la couleur de l'état (bas), avec un léger reflet,
   dans l'esprit des pastilles d'icônes */
.chart .seg { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.chart .seg.s-verifier { background: linear-gradient(180deg, #ffcf70 0%, #eca222 100%); }
.chart .seg.s-valider { background: linear-gradient(180deg, #9aa3a9 0%, #5b6368 100%); }
.chart .seg.s-payer { background: linear-gradient(180deg, #7fb0ff 0%, #2f6ae0 100%); }
.chart .seg.s-late { background: linear-gradient(180deg, #ff8f8f 0%, #dc3a3a 100%); }
.seg:hover, .seg:focus-visible { filter: brightness(1.1); }
.col-label { font-size: 12px; font-weight: 600; color: var(--gray-700); text-align: center; white-space: nowrap; }
.col.is-late .col-label { color: var(--danger-600); }
.col-count { margin-top: -6px; font-size: 11px; color: var(--gray-600); white-space: nowrap; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .col-stack { animation: none; } }

.legend-row { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 18px; font-size: 12px; font-weight: 500; color: var(--gray-600); }
.legend-row li, .tip span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* Où part l'argent : barres horizontales, une seule couleur */
.hbars { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.hbars li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px;
  padding: 6px 8px; margin: 0 -8px; border-radius: 8px; font-size: 13px; outline: none;
}
.hb-track { grid-column: 1 / -1; grid-row: 2; }
.hbars li:hover, .hbars li:focus-visible { background: var(--gray-50); }
.hb-name { color: var(--gray-700); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 8px; border-radius: 4px; background: var(--gray-50); overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 4px; background: var(--gray-700); }
.hb-value { font: 600 13px/1 var(--font-num); color: var(--gray-800); text-align: right; min-width: 64px; }

/* Fournisseurs principaux */
.sup-list { list-style: none; display: flex; flex-direction: column; }
.sup-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 0; }
.sup-list li + li { border-top: 1px solid var(--gray-100); }
.tile--neutral { background: var(--gray-50); color: var(--gray-700); border-color: #fff; box-shadow: inset 0 0 0 1px var(--gray-100); width: 34px; height: 34px; }
.sup-name { display: flex; flex-direction: column; min-width: 0; }
.sup-name strong { font-size: 14px; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-name span { font-size: 12px; color: var(--gray-600); }
.sup-total { font: 600 14px/1 var(--font-num); color: var(--gray-800); }

/* L'IA ce mois-ci */
.ai-hero { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 12px; background: var(--gray-50); margin-bottom: 12px; }
.ai-hero b { font: 600 30px/1.1 var(--font-num); color: var(--gray-900); }
.ai-hero span { font-size: 13px; color: var(--gray-600); }
.ai-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.ai-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--gray-700); }
.ai-list svg.i { width: 18px; height: 18px; color: var(--gray-600); flex: none; }
.ai-list li.is-warn svg.i { color: var(--warning-600); }

/* Infobulle */
.tip {
  position: fixed; z-index: 50; pointer-events: none;
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--gray-900); color: #fff; font-size: 12px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.18);
}
.tip[hidden] { display: none; }
.tip b { font-weight: 700; }
.tip span { color: rgba(255, 255, 255, 0.8); }

@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-todo, .d-due { grid-column: span 12; }
  .d-cat, .d-sup { grid-column: span 6; }
  .d-ai { grid-column: span 12; }
}
@media (max-width: 640px) {
  .stat-row { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 18px; }
  .dash-grid { gap: 12px; }
  .dash-grid .card { padding: 16px; }
  .d-cat, .d-sup { grid-column: span 12; }
  .chart { gap: 6px; height: 240px; }
  .col-total { font-size: 11px; }
  .col-track { border-radius: 10px; }
  .seg { border-radius: 7px; }
  .col-label { font-size: 11px; white-space: normal; line-height: 1.2; }
  .col-count { display: none; }
  .todo-item { grid-template-columns: auto minmax(0, 1fr); }
  .todo-item .btn { grid-column: 2; justify-self: start; }
  .todo-text span { white-space: normal; }
}
