/* ============================================================
   ACCUEIL : à traiter, dernières conversations, résultats de la période.
   (La ligne de conversation est partagée avec la page « Conversations ».)
============================================================ */

.section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.section-header > div:first-child { min-width: 0; flex: 1 1 260px; }
.section-header .muted { margin-top: 2px; }

.status-banner { align-items: center; }
.status-banner .status-text p:not(.alert-title) { color: var(--text-2); }

/* ---------- Maintenant ---------- */
.overview-now { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
.todo-card, .recent-card { display: flex; flex-direction: column; }
.todo-list, .conversation-list { flex: 1 1 auto; }
.todo-item { align-items: flex-start; padding-block: 14px; }
.todo-item .list-title { line-height: 1.35; }
.todo-item .list-sub { line-height: 1.45; }
.todo-item .icon-tile { margin-top: 1px; }
.todo-action { display: inline-flex; align-items: center; gap: 2px; flex: none; align-self: center; color: var(--primary-text); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.todo-action .icon { transition: transform var(--fast) var(--ease); }
.todo-item:hover .todo-action .icon { transform: translateX(2px); }
.empty .empty-icon.success-icon { background: var(--success-soft); color: var(--success); }

/* ---------- Ligne de conversation (accueil et boîte de réception) ---------- */
.conversation-row { position: relative; display: flex; align-items: flex-start; gap: var(--space-3); padding: 12px var(--space-5); border-top: 1px solid var(--border-soft); cursor: pointer; transition: background var(--fast) var(--ease); min-width: 0; }
.conversation-row:first-child { border-top: 0; }
.conversation-row:hover { background: var(--surface-hover); }
.conversation-row:focus-visible { outline-offset: -2px; }
.conversation-row.active { background: var(--primary-soft); }
.conversation-row.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.conversation-row .avatar { width: 40px; height: 40px; font-size: var(--text-sm); margin-top: 1px; }
.conversation-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.conversation-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.conversation-top strong { font-size: var(--text-base); font-weight: 500; color: var(--text); }
.conversation-top time { flex: none; font-size: var(--text-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.conversation-preview { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.conversation-preview p { flex: 1 1 auto; color: var(--text-3); font-size: var(--text-sm); line-height: 1.45; }
.conversation-preview p .icon { margin-right: 5px; margin-top: -2px; color: var(--text-4); }
.conversation-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.conversation-tags .badge { height: 20px; padding: 0 7px; font-size: var(--text-2xs); }
.unread-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.conversation-row.unread .conversation-top strong { font-weight: 700; }
.conversation-row.unread .conversation-preview p { color: var(--text); font-weight: 500; }
.conversation-row.unread .conversation-top time { color: var(--primary-text); font-weight: 600; }

/* ---------- Chiffres clés ---------- */
.stats-body { display: grid; gap: var(--space-5); transition: opacity var(--normal) var(--ease); }
.stats-body.is-refreshing { opacity: 0.55; pointer-events: none; }
.kpi-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-card { padding: var(--space-4) var(--space-5); display: grid; gap: 8px; align-content: start; }
.kpi-label { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: var(--text-sm); font-weight: 500; min-width: 0; }
.kpi-label .icon { color: var(--text-4); }
.kpi-figure { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.kpi-value { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; color: var(--text); white-space: nowrap; }
.kpi-unit { margin-left: 5px; font-size: var(--text-sm); font-weight: 600; letter-spacing: 0; color: var(--text-3); }
.kpi-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); min-height: 34px; }
.kpi-hint { color: var(--text-3); font-size: var(--text-xs); line-height: 1.4; }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; flex: none; height: 22px; padding: 0 7px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.kpi-delta.up { background: var(--success-soft); color: var(--success); }
.kpi-delta.down { background: var(--danger-soft); color: var(--danger); }
.sparkline { flex: none; overflow: visible; }
.sparkline-line { fill: none; stroke: var(--chart-1); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sparkline-area { fill: var(--chart-1-soft); stroke: none; }
.sparkline-dot { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }

/* ---------- Graphique et synthèse de l'agent ---------- */
.results-grid { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: stretch; }
.results-grid.no-chart { grid-template-columns: minmax(0, 1fr); }
.chart-card .card-header { border-bottom: 0; padding-bottom: 0; }
.chart-card .card-body { padding-top: var(--space-4); }
.chart-metric { overflow-x: auto; scrollbar-width: none; }
.chart-metric::-webkit-scrollbar { display: none; }
.chart { position: relative; outline: none; border-radius: var(--radius-md); }
.chart:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 4px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-tick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-column { fill: var(--chart-1); transition: opacity var(--fast) var(--ease); }
.chart-svg.has-active .chart-column { opacity: 0.38; }
.chart-svg.has-active .chart-column.is-active { opacity: 1; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-tooltip { position: absolute; z-index: 2; transform: translateX(-50%); display: grid; gap: 1px; padding: 7px 10px; border-radius: var(--radius-md); background: var(--text); color: var(--surface); box-shadow: var(--shadow-md); pointer-events: none; white-space: nowrap; text-align: center; }
.chart-tooltip strong { font-size: var(--text-sm); font-weight: 600; }
.chart-tooltip span { font-size: var(--text-2xs); opacity: 0.72; }

.share-figure { display: grid; gap: 6px; padding-bottom: var(--space-4); margin-bottom: var(--space-2); border-bottom: 1px solid var(--border-soft); }
.share-value { font-size: 2.25rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; color: var(--text); }
.share-label { color: var(--text-3); font-size: var(--text-sm); line-height: 1.45; margin-bottom: 4px; }
.fact-list { display: grid; }
.fact-row { display: flex; align-items: center; gap: var(--space-3); padding: 10px 0; border-top: 1px solid var(--border-soft); font-size: var(--text-sm); }
.fact-row:first-child { border-top: 0; }
.fact-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--text-3); }
.fact-label { flex: 1 1 auto; min-width: 0; display: grid; color: var(--text); font-weight: 500; }
.fact-label small { color: var(--text-3); font-size: var(--text-xs); font-weight: 400; }
.fact-row strong { flex: none; font-size: var(--text-base); font-weight: 600; white-space: nowrap; }

/* ---------- Ce que l'agent rapporte ---------- */
.stats-insights { display: grid; gap: var(--space-5); grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.insight-card { padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; }
.insight-card .card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.insight-figure strong { font-size: 2rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; }
.insight-note { color: var(--text-3); font-size: var(--text-sm); line-height: 1.5; }
.insight-sub { font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.stage-lines { display: grid; gap: 10px; padding-top: var(--space-3); margin-top: 2px; border-top: 1px solid var(--border-soft); }
.stage-line { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.stage-line .badge { justify-self: start; }
.stage-line b { font-weight: 600; min-width: 2ch; text-align: right; }
.insight-list { display: grid; gap: var(--space-3); }
.insight-list > li { display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; }
.insight-rank { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: var(--text-2xs); font-weight: 700; margin-top: 1px; }
.insight-product { flex: 1 1 auto; min-width: 0; display: grid; gap: 5px; }
.insight-product b { font-weight: 600; font-size: var(--text-sm); }
.insight-product small { color: var(--text-3); font-size: var(--text-xs); }
.insight-product .progress { height: 4px; }
.insight-questions { gap: var(--space-2); }
.insight-question { display: grid; gap: 3px; width: 100%; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--border-soft); background: var(--surface-2); text-align: left; transition: var(--transition); }
.insight-question:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.insight-question b { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.insight-question q { color: var(--text-2); font-size: var(--text-sm); font-style: italic; quotes: "« " " »"; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.insight-question small { color: var(--text-3); font-size: var(--text-xs); }
.insight-cta { justify-self: start; margin-top: 2px; }

/* ---------- Commerciaux ---------- */
.inline-select select { min-height: var(--control-sm); padding-block: 4px; font-size: var(--text-sm); width: auto; }
.commercial-bar { flex: 0 1 220px; min-width: 60px; }
.commercial-count { flex: none; display: grid; justify-items: end; min-width: 76px; line-height: 1.2; }
.commercial-count strong { font-size: var(--text-lg); font-weight: 650; }
.commercial-count small { color: var(--text-3); font-size: var(--text-xs); }

/* ---------- Raccourcis ---------- */
.quick-panel { display: grid; gap: var(--space-4); }
.quick-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quick-action { display: flex; align-items: center; gap: var(--space-3); padding: 14px; text-align: left; transition: var(--transition); }
.quick-action:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
/* L'export : dans l'en-tête sur ordinateur, ici sur téléphone (voir .only-desktop sur le bouton de l'en-tête). */
.quick-action.quick-export { display: none; }
@media (max-width: 767px) { .quick-action.quick-export { display: flex; } }
.quick-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.quick-text strong { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.quick-text small { color: var(--text-3); font-size: var(--text-xs); line-height: 1.4; }
.quick-chevron { color: var(--text-4); flex: none; transition: transform var(--fast) var(--ease); }
.quick-action:hover .quick-chevron { transform: translateX(2px); color: var(--text-2); }

@media (max-width: 1279px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-grid { grid-template-columns: minmax(0, 1fr); }
  .stats-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-insights > :last-child { grid-column: 1 / -1; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .overview-now { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
}
@media (max-width: 767px) {
  .stats-body { gap: var(--space-4); }
  .kpi-grid { gap: var(--space-3); }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 1.4375rem; }
  .kpi-label { font-size: var(--text-xs); }
  .kpi-label .icon { display: none; }
  .sparkline { display: none; }
  .kpi-bottom { min-height: 0; }
  .stats-insights { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .insight-card { padding: var(--space-4); }
  .conversation-row { padding: 12px var(--space-4); }
  .conversation-top strong { font-size: var(--text-md); }
  .section-header .segmented { width: 100%; }
  .section-header .segmented > button { flex: 1 1 0; }
  .chart-card .segmented { width: 100%; }
  .chart-card .segmented > button { flex: 1 1 auto; padding: 0 6px; font-size: var(--text-xs); }
  .commercial-bar { display: none; }
  .todo-action { font-size: 0; gap: 0; }
  .todo-action .icon { width: 18px; height: 18px; color: var(--text-4); }
}
@media (max-width: 599px) {
  .quick-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
}

/* ---------- Synthèse de l'agent : petits chiffres en grille ---------- */
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-3); padding-top: var(--space-2); }
.fact { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fact-text { display: grid; min-width: 0; line-height: 1.3; }
.fact-text strong { font-size: var(--text-md); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact-text small { color: var(--text-3); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-more { justify-content: center; gap: 6px; color: var(--primary-text); font-size: var(--text-sm); font-weight: 600; min-height: 44px; }
