/*
 * Tuiles de fonctionnalités : tableau de bord, relances, fiche client,
 * catalogue. Aperçus d'après les écrans de l'app, animés lorsqu'ils sont à
 * l'écran (classes `in-view` et `seen` posées par site.js).
 */
/* Bento : [tableau de bord, large | relances] puis [fiche client | catalogue, large]. */
.ft-grid { display: grid; gap: 20px; }
@media (min-width: 760px) {
  .ft-grid { grid-template-columns: repeat(2, 1fr); }
  .ft--wide { grid-column: span 2; }
}
@media (min-width: 1000px) {
  .ft-grid { grid-template-columns: repeat(3, 1fr); }
  .ft--wide { grid-column: span 2; display: grid; grid-template-columns: 0.8fr 1.2fr; align-items: center; }
  .ft--wide .ft-text { order: -1; padding: 0 18px 0 22px; }
  .ft--wide .ft-text h3 { margin-top: 0; font-size: 1.45rem; }
}
.ft { background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 14px 14px 26px; }
.ft--wide { padding-bottom: 14px; }
.ft-text h3 { margin: 22px 12px 6px; font-size: 1.2rem; }
.ft-text p { margin: 0 12px; color: var(--text-2); font-size: 0.97rem; }
@media (max-width: 999px) { .ft--wide { padding-bottom: 26px; } }
.ft-visual {
  min-height: 290px; border-radius: 20px; overflow: hidden; position: relative;
  display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #ffe7d6 0%, #fff4ec 60%, #fffaf6 100%);
  color: var(--ink);
}
.ft-visual b { font-weight: 800; }

/* ─── Tableau de bord ─── */
.db { width: min(320px, 100%); display: grid; gap: 10px; }
.db-hero {
  background: var(--primary); color: #fff; border-radius: 20px; padding: 16px 18px;
  display: grid; gap: 4px; box-shadow: 0 16px 30px -18px rgba(207, 74, 8, .8);
}
.db-label { font-size: .78rem; font-weight: 700; color: rgba(255, 255, 255, .85); }
.db-value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.db-delta { justify-self: start; font-size: .72rem; font-weight: 800; background: rgba(255, 255, 255, .22); padding: 2px 8px; border-radius: 99px; }
.db-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .25); margin-top: 8px; overflow: hidden; }
.db-bar i { display: block; height: 100%; width: 72%; border-radius: 6px; background: #fff; }
.anim-ready .db-bar i { width: 0; transition: width 1.4s cubic-bezier(.2, .8, .2, 1) .2s; }
.anim-ready .seen .db-bar i { width: 72%; }
.db-split { display: flex; font-size: .72rem; font-weight: 600; color: rgba(255, 255, 255, .85); margin-top: 4px; }
.db-split > span { flex: 1; display: grid; }
.db-split b { color: #fff; font-size: .9rem; }
.db-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.db-tiles > span { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 10px 14px; display: grid; }
.db-tiles small { font-size: .72rem; font-weight: 600; color: var(--text-3); }
.db-tiles b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ─── Relances : la ligne glisse, « Relancer » est touché, la coche apparaît ─── */
.rl { width: min(330px, 100%); display: grid; gap: 10px; }
.rl-tag {
  justify-self: start; font-size: .75rem; font-weight: 800; color: var(--primary-hover);
  background: #fff; border: 1px solid var(--border); padding: 4px 12px; border-radius: 99px;
}
.rl-row { position: relative; border-radius: 18px; overflow: hidden; }
.rl-actions { position: absolute; inset: 0; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-right: 10px; }
.rl-actions span { height: 40px; padding: 0 14px; border-radius: 20px; display: grid; place-items: center; font-size: .78rem; font-weight: 800; color: #fff; }
.rl-send { background: var(--primary); }
.rl-call { background: var(--ink); }
.rl-line {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
}
.rl-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-hover); font-weight: 800; font-size: .8rem;
}
.rl-body { flex: 1; min-width: 0; display: grid; }
.rl-body b { font-size: .92rem; }
.rl-body span { display: flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--text-3); white-space: nowrap; }
.rl-pip { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.rl-pip:first-of-type { margin-left: 4px; }
.rl-pip.on { background: var(--accent); }
.rl-ok {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #0a7d57; color: #fff; font-size: .75rem; font-weight: 800;
}
.rl-row.ghost { opacity: .55; }
.anim-ready .rl-ok { opacity: 0; }
.rl-row:not(.ghost) .rl-line { animation: rl-swipe 6s cubic-bezier(.5, 0, .2, 1) infinite; }
.rl-send { animation: rl-tap 6s ease infinite; }
.anim-ready .rl-ok { animation: rl-ok 6s cubic-bezier(.2, 1.4, .4, 1) infinite; }
.anim-ready .rl-pip.p2 { animation: rl-pip 6s ease infinite; }
@keyframes rl-swipe { 0%, 14% { transform: none; } 28%, 52% { transform: translateX(-176px); } 64%, 100% { transform: none; } }
@keyframes rl-tap { 0%, 40% { transform: scale(1); } 44% { transform: scale(.88); } 50%, 100% { transform: scale(1); } }
@keyframes rl-ok { 0%, 62% { opacity: 0; transform: scale(.5); } 68%, 92% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.5); } }
@keyframes rl-pip { 0%, 62% { background: var(--border-strong); } 66%, 94% { background: var(--accent); } 100% { background: var(--border-strong); } }

/* ─── Fiche client : l'historique arrive ligne à ligne ─── */
.cl {
  width: min(320px, 100%); background: #fff; border: 1px solid var(--border); border-radius: 20px;
  padding: 16px; display: grid; gap: 14px; box-shadow: 0 16px 30px -22px rgba(120, 50, 10, .5);
}
.cl-head { display: flex; align-items: center; gap: 12px; }
.cl-head > span:last-child { display: grid; }
.cl-head b { font-size: 1rem; }
.cl-head small { font-size: .75rem; color: var(--text-3); }
.cl-avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 800; }
.cl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cl-list li {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 12px;
  border-radius: 12px; background: var(--surface-muted); font-size: .85rem; font-weight: 600;
}
.cl-list em { font-style: normal; font-size: .7rem; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.s-progress { background: var(--primary); color: #fff; }
.s-picked { background: #fff; color: var(--text-3); border: 1px solid var(--border); }
.anim-ready .cl-list li { opacity: 0; transform: translateX(-14px); }
.anim-ready .seen .cl-list li { animation: cl-in .6s cubic-bezier(.2, .8, .2, 1) forwards; }
.anim-ready .seen .cl-list li:nth-child(2) { animation-delay: .15s; }
.anim-ready .seen .cl-list li:nth-child(3) { animation-delay: .3s; }
@keyframes cl-in { to { opacity: 1; transform: none; } }

/* ─── Catalogue : les tuiles apparaissent, puis l'une est « choisie » en boucle ─── */
.ct { width: min(320px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ct-tile { background: #fff; border: 1.5px solid var(--border); border-radius: 18px; padding: 12px 14px; display: grid; gap: 1px; }
.ct-tile b { font-size: 1.25rem; }
.ct-tile span { font-size: .82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-tile small {
  justify-self: start; margin-top: 4px; font-size: .68rem; font-weight: 700; color: var(--text-2);
  background: var(--surface-muted); padding: 2px 8px; border-radius: 99px;
}
.anim-ready .ct-tile { opacity: 0; transform: scale(.9); }
.anim-ready .seen .ct-tile { animation: ct-in .5s cubic-bezier(.2, 1.3, .4, 1) forwards; }
.anim-ready .seen .ct-tile:nth-child(2) { animation-delay: .1s; }
.anim-ready .seen .ct-tile:nth-child(3) { animation-delay: .2s; }
.anim-ready .seen .ct-tile:nth-child(4) { animation-delay: .3s; }
.anim-ready .seen .ct-tile:first-child { animation: ct-in .5s cubic-bezier(.2, 1.3, .4, 1) forwards, ct-pick 4s ease 1.2s infinite; }
@keyframes ct-in { to { opacity: 1; transform: none; } }
@keyframes ct-pick {
  0%, 60%, 100% { border-color: var(--border); box-shadow: none; }
  70%, 85% { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(207, 74, 8, .15); }
}

/* ─── Chiffres en rouleau (site.js découpe chaque chiffre en colonne 0-9) ─── */
.roll-digit { display: inline-block; height: 1.15em; line-height: 1.15em; overflow: hidden; vertical-align: bottom; font-variant-numeric: tabular-nums; }
.roll-strip { display: flex; flex-direction: column; transform: translateY(0); }
.roll-strip > span { height: 1.15em; }
.rolled .roll-strip { transform: translateY(calc(var(--to) * -1.15em)); transition: transform 1.8s cubic-bezier(.16, .84, .24, 1) var(--d, 0ms); }
@media (min-width: 1000px) {
  /* Catalogue : aperçu à gauche, texte à droite, en miroir du tableau de bord. */
  .ft-grid > .ft--wide:last-child { grid-template-columns: 1.2fr 0.8fr; }
  .ft-grid > .ft--wide:last-child .ft-text { order: 1; padding: 0 22px 0 18px; }
}
/* Symboles (€, %, virgule, espace) alignés sur la même boîte que les chiffres. */
.roll-char { display: inline-block; height: 1.15em; line-height: 1.15em; vertical-align: bottom; }
/* Tuiles larges : l'aperçu occupe toute la hauteur de la tuile. */
@media (min-width: 1000px) {
  .ft--wide { align-items: stretch; }
  .ft--wide .ft-text { align-self: center; }
  .ft--wide .ft-visual { height: auto; min-height: 290px; }
}
/* Relances : détection automatique, envoi manuel. */
.rl-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-mode {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  background: #fff; border: 1px solid var(--border); font-size: .72rem; font-weight: 800; color: var(--text-2);
}
.rl-mode i { width: 7px; height: 7px; border-radius: 50%; }
.rl-mode i.auto { background: #0a7d57; box-shadow: 0 0 0 3px rgba(10, 125, 87, .15); }
.rl-mode i.manual { background: var(--primary); box-shadow: 0 0 0 3px rgba(207, 74, 8, .15); }
/* Tableau de bord : export CSV, qui « se télécharge » en boucle. */
.db-export {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 99px; background: var(--ink); color: #fff; font-size: .8rem; font-weight: 800;
}
.db-export small {
  font-size: .7rem; font-weight: 700; color: rgba(255, 255, 255, .7);
  max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0;
}
.anim-ready .db-export { animation: db-press 5s ease 1.6s infinite; }
.anim-ready .db-export small { animation: db-file 5s ease 1.6s infinite; }
.anim-ready .db-export svg { animation: db-arrow 5s ease 1.6s infinite; }
@keyframes db-press { 0%, 30%, 40%, 100% { transform: scale(1); } 34% { transform: scale(.94); } }
@keyframes db-file {
  0%, 36% { max-width: 0; opacity: 0; }
  46%, 86% { max-width: 160px; opacity: 1; }
  96%, 100% { max-width: 0; opacity: 0; }
}
@keyframes db-arrow { 0%, 36%, 60%, 100% { transform: none; } 44% { transform: translateY(3px); } 52% { transform: translateY(-1px); } }
/* Tuile étroite : les noms de prestation passent à la ligne au lieu d'être coupés. */
.ct-tile span { white-space: normal; line-height: 1.25; }
