/* ==========================================================================
   Mosolo Cash — compléments du design system Mosolo Coop (crm/ui.css)
   ========================================================================== */

/* Montants : chiffres tabulaires, jamais ambigus */
.mc-amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; color: var(--text-main); }
.mc-amount.pos { color: #16a34a; }
.mc-amount.neg { color: #dc2626; }
.mc-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.mc-num { text-align: right; }
.kpi-card .kpi-value.fs-small { font-size: 1.15rem !important; line-height: 1.35; }

/* Contact rapide : appeler / WhatsApp / SMS */
.btn-whatsapp { background: #25d366; border-color: #25d366; color: #fff !important; }
.btn-whatsapp:hover, .btn-whatsapp:focus { background: #1ebe5a; border-color: #1ebe5a; color: #fff; box-shadow: 0 10px 24px -6px rgba(37, 211, 102, .45); }
.btn-outline-whatsapp { border: 1px solid #25d366; color: #16a34a; background: #fff; }
.btn-outline-whatsapp:hover { background: #dcfce7; color: #15803d; }
.contact-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-muted); }
.contact-chip .fa-whatsapp { color: #25d366; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }

/* Avatar & identité */
.mc-avatar { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, var(--primary), #ffb14d); color: #fff; font-weight: 800; font-size: 1.5rem;
  box-shadow: var(--shadow-primary); }
.mc-avatar.sm { width: 38px; height: 38px; border-radius: 12px; font-size: .95rem; box-shadow: none; }
.mc-identity { display: flex; align-items: center; gap: 16px; }

/* Grille clé / valeur (style fiche MosoloForm) */
.mc-dl dt { font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.mc-dl dd { font-weight: 600; color: var(--text-main); margin-bottom: 0; font-variant-numeric: tabular-nums; }
.mc-tile { padding: 14px 16px; background: var(--surface-alt); border: 1px solid var(--border-color); border-radius: var(--radius-md); height: 100%; }
.mc-tile .label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.mc-tile .value { font-weight: 700; font-size: 1.05rem; color: var(--text-main); font-variant-numeric: tabular-nums; margin-top: 2px; }

/* Progression : attendu vs encaissé */
.mc-progress { height: 12px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.mc-progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #ffb14d); transition: width .8s ease; }
.mc-progress.ok > span { background: linear-gradient(90deg, #16a34a, #4ade80); }
.mc-progress.sm { height: 6px; }
.mc-legend { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--text-muted); margin-top: 6px; }

/* Étapes d'un circuit d'approbation */
.mc-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mc-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #f1f5f9; font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.mc-steps li.done { background: #dcfce7; color: #15803d; }
.mc-steps li.current { background: rgba(var(--primary-rgb), .14); color: var(--primary); }

/* Frise chronologique (notifications, journal) */
.mc-timeline { list-style: none; margin: 0; padding: 0; }
.mc-timeline li { position: relative; padding: 0 0 18px 28px; border-left: 2px solid var(--border-color); margin-left: 8px; }
.mc-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.mc-timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.mc-timeline li.is-unread::before { background: var(--primary); }
.mc-timeline .tl-title { font-weight: 700; color: var(--text-main); }
.mc-timeline .tl-meta { font-size: .78rem; color: var(--text-muted); }

/* Ligne cliquable */
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover td { background: rgba(var(--primary-rgb), .04); }

/* Champs : cases à cocher multiples (jours de paiement) */
.mc-checks > div { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-checks label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border-color); border-radius: 999px; cursor: pointer; font-weight: 500; font-size: .85rem; margin: 0; }
.mc-checks label:has(input:checked) { border-color: var(--primary); background: rgba(var(--primary-rgb), .08); color: var(--primary); }
.mc-checks input { accent-color: var(--primary); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.invalid-feedback.d-block { font-size: .8rem; }
.input-icon-wrap textarea.form-control { padding-top: 12px; }
.custom-select-wrap.is-disabled { opacity: .6; pointer-events: none; }

/* Matrice des rôles */
.mc-matrix td, .mc-matrix th { text-align: center; }
.mc-matrix td:nth-child(-n+2), .mc-matrix th:nth-child(-n+2) { text-align: left; }
.mc-yes { color: #16a34a; }
.mc-no { color: #cbd5e1; }

/* Carte des collectes */
#mcCarte { height: 560px; border-radius: var(--radius-md); }

/* Encadré d'information */
.mc-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: var(--radius-md); padding: 12px 16px; font-size: .86rem; }
.mc-note i { color: var(--primary); }

/* Actions en ligne (motif + bouton) */
.mc-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mc-inline > .form-control, .mc-inline > .input-icon-wrap, .mc-inline > .custom-select-wrap { flex: 1 1 160px; width: auto; }
.mc-inline > .btn { flex: 0 0 auto; }

.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Connexion : liste de rôles */
.auth-roles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.auth-roles span { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .85); font-size: .78rem; border: 1px solid rgba(255, 255, 255, .12); }

@media (max-width: 767px) {
  .mc-identity { align-items: flex-start; }
  .page-heading .btn { flex: 1 1 auto; }
}
@media print {
  .dlabnav, .header, .nav-header, .page-titles, .no-print { display: none !important; }
  .content-body { margin-left: 0 !important; padding-top: 0 !important; }
}

/* Graphiques : jamais plus larges que leur carte */
.crm-chart { width: 100%; overflow: hidden; }
.crm-chart canvas { max-width: 100% !important; }

/* Échéancier complet (staff) */
.mc-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.mc-cal-day { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); background: #fff; }
.mc-cal-day b { font-size: 1rem; color: var(--text-main); }
.mc-cal-day.st-payee { background: #16a34a; border-color: #16a34a; color: #dcfce7; }
.mc-cal-day.st-payee b { color: #fff; }
.mc-cal-day.st-partielle { background: linear-gradient(135deg, #bbf7d0 50%, #fef3c7 50%); }
.mc-cal-day.st-en_retard { background: #fee2e2; border-color: #fecaca; color: #dc2626; }
.mc-cal-day.st-en_retard b { color: #dc2626; }
.mc-cal-day.st-reportee { background: #dbeafe; border-color: #bfdbfe; }
.mc-cal-day.st-annulee { background: #f1f5f9; text-decoration: line-through; opacity: .6; }
.mc-cal-day.today { box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .45); }
.mc-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--border-color); }
.mc-dot.st-payee { background: #16a34a; } .mc-dot.st-partielle { background: #fef3c7; } .mc-dot.st-en_retard { background: #fee2e2; }
.mc-dot.st-reportee { background: #dbeafe; } .mc-dot.st-annulee { background: #f1f5f9; }

/* --- Finitions du portail staff ------------------------------------------------------ */
/* Titres en casse de phrase (le thème mettait une majuscule à chaque mot). */
.card-title, .card-header h2, .card-header .card-title, .page-heading h1, .page-heading h2 { text-transform: none !important; }
.card-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; }

/* Avatar rond, plus sobre */
.mc-avatar { border-radius: 50%; box-shadow: 0 0 0 4px #fff, 0 8px 20px -8px rgba(var(--primary-rgb), .55); font-size: 1.35rem; }
.mc-avatar.sm { box-shadow: none; }

/* Carte de profil (Mon compte) */
.mc-profile { position: relative; overflow: hidden; border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); margin-bottom: 1.5rem; }
.mc-profile-banner { height: 92px; background: linear-gradient(120deg, #1d1d20 0%, #2b2b30 55%, var(--primary) 140%); position: relative; }
.mc-profile-banner::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--primary-rgb), .55), transparent 70%); }
.mc-profile-body { display: flex; align-items: flex-end; gap: 20px; padding: 0 28px 24px; margin-top: -40px; position: relative; flex-wrap: wrap; }
.mc-profile-body .mc-avatar { width: 88px; height: 88px; font-size: 2rem; box-shadow: 0 0 0 6px #fff, 0 12px 24px -10px rgba(0, 0, 0, .35); }
.mc-profile-info { flex: 1; min-width: 220px; padding-bottom: 4px; }
.mc-profile-info h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 8px; }
.mc-profile-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-profile-meta span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border-color); font-size: .8rem; font-weight: 600; color: var(--text-main); }
.mc-profile-meta span.role { background: rgba(var(--primary-rgb), .12); border-color: rgba(var(--primary-rgb), .25); color: var(--primary-active); }
.mc-profile-meta i { color: var(--primary); font-size: .8rem; }
@media (max-width: 767px) {
  .mc-profile-body { padding: 0 18px 18px; }
  .mc-profile-info h1 { font-size: 1.25rem; }
}

/* Seul l avatar chevauche le bandeau ; nom et badges restent sur fond blanc. */
.mc-profile-body { margin-top: 0; align-items: flex-start; padding-top: 16px; }
.mc-profile-body .mc-avatar { margin-top: -60px; }
.mc-profile-body > .btn { align-self: center; }
.mc-profile-banner { overflow: hidden; }

/* Icone « frais » (main + piece) a la place du billet Font Awesome, partout. */
.fa-money-bill-wave { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; background-color: currentColor; -webkit-mask: url("icones/frais.svg") center / contain no-repeat; mask: url("icones/frais.svg") center / contain no-repeat; }
.fa-money-bill-wave::before { content: none !important; }

/* Avatars sobres : rond, teinte sourde propre à chaque personne, sans dégradé ni ombre. */
.mc-avatar { background: var(--av-bg, #e7e4de) !important; color: var(--av-fg, #3f3a33) !important; border-radius: 50% !important; box-shadow: none !important; font-weight: 600; letter-spacing: .03em; font-size: 1.15rem; }
.mc-avatar.sm { width: 36px; height: 36px; font-size: .78rem; }
.mc-profile-body .mc-avatar { font-size: 1.7rem; box-shadow: 0 0 0 5px #fff !important; }


/* ===== Finitions : icônes Flaticon, encadrés, boutons ===== */
i.fi { display: inline-flex; align-items: center; justify-content: center; line-height: 1; vertical-align: -0.125em; }
.card .card-header .card-title, h2.card-title, .card-title { text-transform: none !important; }
.bg-light { background-color: #f8fafc !important; color: var(--text-main); }
.mc-rule { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px;
  background: #fafafa; border: 1px solid var(--border-color); font-size: .82rem; color: var(--text-main); line-height: 1.5; }
.mc-rule strong { color: var(--text-main); }
.mc-rule i { color: var(--primary); margin-top: 3px; }
.btn { border-radius: 12px; font-weight: 600; letter-spacing: .005em; padding: .62rem 1.1rem; transition: background .15s, border-color .15s, box-shadow .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); box-shadow: 0 6px 14px -8px rgba(var(--primary-rgb), .9); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-primary { background: #fff; border-color: var(--border-color); color: var(--text-main); }
.btn-outline-primary:hover, .btn-outline-primary:focus { background: #fff; border-color: var(--primary); color: var(--primary-active); }
.btn-outline-primary i, .btn-light i { color: var(--primary); }
.btn-sm { padding: .4rem .8rem; border-radius: 10px; }
