/* ═══════════════════════════════════════════════════════════════════════════════════════════
   Tableau de bord d'accueil configurable (views/home.html, TableauBordController).
   Grille de 12 colonnes : largeur des widgets 1/3 (4), 1/2 (6), 2/3 (8) ou pleine (12).
   ═══════════════════════════════════════════════════════════════════════════════════════════ */

/* Pleine largeur (grille de cartes, pas de texte long) ; plafond pour les très grands écrans. */
.tdb-page { height: 100%; overflow-y: auto; background: #eef1f5; padding: 20px 24px 32px; margin: 0; border-radius: 0; }
.tdb-root { max-width: 1920px; margin: 0 auto; }

/* ── En-tête ── */
/* En-tête fixe : reste visible au défilement (la page .tdb-page est le conteneur qui défile ;
   top négatif = son padding, pour coller au bord haut). */
.tdb-tete { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    position: sticky; top: -20px; z-index: 6; margin: -20px -24px 18px; padding: 14px 24px 12px;
    background: rgba(238, 241, 245, .94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    box-shadow: 0 1px 0 #dde2e9; }
.tdb-titre { display: flex; align-items: center; gap: 12px; }
.tdb-titre-icone { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px;
    background: var(--ax-primary-50, #e8eaf6); color: var(--ax-primary, #3f51b5); font-size: 20px; }
.tdb-titre h2 { margin: 0; padding: 0; font-size: 22px; font-weight: 700; color: var(--ax-text-bold, #111827); line-height: 1.2; }
.tdb-source { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; color: #64748b; }
.tdb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tdb-actions .ax-btn, .tdb-barre-boutons .ax-btn { min-height: 36px; }
.tdb-verrou { opacity: .65; }
.tdb-verrou:hover { opacity: .9; }

/* ── Barre de personnalisation ── */
.tdb-barre-edition { position: sticky; top: 58px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px; border-radius: var(--ax-radius, 12px);
    background: #fff; border: 1px solid var(--ax-primary-light, #c5cae9); box-shadow: var(--ax-shadow-md); }
.tdb-barre-texte { display: flex; flex-direction: column; gap: 2px; min-width: 240px; max-width: 70ch; }
.tdb-barre-texte b { color: var(--ax-primary, #3f51b5); font-size: 14.5px; }
.tdb-barre-texte small { color: #64748b; font-size: 12.5px; }
.tdb-barre-boutons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Catalogue ── */
.tdb-catalogue { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tdb-catalogue-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; cursor: pointer;
    background: #fff; border: 1px dashed var(--ax-border-strong, #d5d8e0); border-radius: var(--ax-radius-sm, 8px);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.tdb-catalogue-item:hover { border-color: var(--ax-primary, #3f51b5); box-shadow: var(--ax-shadow-sm); transform: translateY(-1px); }
.tdb-catalogue-icone { flex: 0 0 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
    background: var(--ax-primary-50, #e8eaf6); color: var(--ax-primary, #3f51b5); font-size: 16px; }
.tdb-catalogue-texte { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tdb-catalogue-texte b { font-size: 13.5px; color: var(--ax-text-bold, #111827); }
.tdb-catalogue-texte small { font-size: 12px; color: #64748b; line-height: 1.35; }
.tdb-catalogue-plus { color: var(--ax-primary, #3f51b5); font-size: 18px; }

/* ── Grille ── */
.tdb-grille { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: start; }
.tdb-l4 { grid-column: span 4; }
.tdb-l6 { grid-column: span 6; }
.tdb-l8 { grid-column: span 8; }
.tdb-l12 { grid-column: span 12; }
@media (max-width: 1279px) { .tdb-l4 { grid-column: span 6; } .tdb-l8 { grid-column: span 12; } }
@media (max-width: 991px) { .tdb-l4, .tdb-l6, .tdb-l8 { grid-column: span 12; } .tdb-page { padding: 16px; }
    .tdb-tete { top: -16px; margin: -16px -16px 16px; padding: 12px 16px 10px; } .tdb-barre-edition { position: static; } }

/* ── Widget : carte blanche nettement détachée du fond (bordure + ombre douce), en-tête séparé ──
   Chaque widget a sa couleur d'accent (--tdb-accent / --tdb-accent-fond) : pastille d'icône et liseré. */
.tdb-widget { --tdb-accent: #3f51b5; --tdb-accent-fond: #eef0fb;
    background: #fff; border: 1px solid #dbe0e7; border-radius: 14px; min-width: 0; overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
    transition: box-shadow .2s ease, border-color .2s ease; }
.tdb-widget:hover { border-color: #c9d0da; box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .08); }
.tdb-w-DOCUMENTS_ENVOYES { --tdb-accent: #0e7490; --tdb-accent-fond: #e0f2f6; }
.tdb-w-RESULTAT { --tdb-accent: #2563eb; --tdb-accent-fond: #e5edff; }
.tdb-w-LETTRAGE { --tdb-accent: #7c3aed; --tdb-accent-fond: #efe9fe; }
.tdb-w-MES_TACHES { --tdb-accent: #c2410c; --tdb-accent-fond: #fdeee4; }
.tdb-w-ASTUCE_DU_JOUR { --tdb-accent: #be185d; --tdb-accent-fond: #fce7f1; }
.tdb-widget-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px;
    border-bottom: 1px solid #edf0f4; background: linear-gradient(#fff, #fcfcfd); }
.tdb-widget-tete h4 { margin: 0; font-size: 14.5px; font-weight: 600; color: #101828; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.tdb-widget-icone { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--tdb-accent-fond); color: var(--tdb-accent); font-size: 14px; }
.tdb-widget-corps { min-width: 0; padding: 16px 18px 18px; }

/* ── Mode édition : aperçus déplaçables ── */
.tdb-grille-edition .tdb-apercu { cursor: grab; padding: 14px 16px; border-style: dashed; border-color: #b9c1d9;
    transition: box-shadow .15s ease, border-color .15s ease; }
.tdb-grille-edition .tdb-apercu:hover { border-color: var(--ax-primary, #3f51b5); box-shadow: var(--ax-shadow-sm); }
.tdb-grille-edition .dndDraggingSource { display: none; }
.tdb-grille-edition .dndDragging { opacity: .7; }
.tdb-placeholder { grid-column: span 12; min-height: 72px; border-radius: var(--ax-radius, 12px);
    border: 2px dashed var(--ax-primary, #3f51b5); background: rgba(var(--ax-primary-rgb, 63, 81, 181), .06); }
.tdb-apercu-outils { display: flex; align-items: center; gap: 6px; }
.tdb-poignee { color: #94a3b8; padding: 0 4px; }
.tdb-apercu-nom { font-weight: 600; font-size: 14px; color: var(--ax-text-bold, #111827); display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tdb-apercu-nom .tdb-widget-icone { width: 26px; height: 26px; flex-basis: 26px; font-size: 12.5px; }
.tdb-page p.tdb-apercu-desc { margin: 8px 0 12px; font-size: 12.5px; font-weight: 400; color: #64748b; line-height: 1.4; }
.tdb-espace { flex: 1; }
.tdb-icone-btn { width: 32px; height: 32px; border: 1px solid var(--ax-border, #e5e7eb); border-radius: 8px; background: #fff;
    color: #475569; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tdb-icone-btn:hover:not([disabled]) { color: var(--ax-primary, #3f51b5); border-color: var(--ax-primary-light, #c5cae9); }
.tdb-icone-btn[disabled] { opacity: .35; cursor: default; }
.tdb-retirer:hover:not([disabled]) { color: var(--ax-danger, #f52738) !important; border-color: var(--ax-danger-light, #fecaca) !important; }
.tdb-tailles { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: #eef1f6; border-radius: 8px; flex-wrap: wrap; }
.tdb-tailles span { font-size: 12px; color: #64748b; padding: 0 8px 0 6px; }
.tdb-tailles button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: #475569; cursor: pointer; }
.tdb-tailles button.tdb-taille-active { background: #fff; color: var(--ax-primary, #3f51b5); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }

/* ── Contenus communs ── */
.tdb-vide, .tdb-chargement { padding: 18px 8px; text-align: center; color: #64748b; font-size: 13px; }
.tdb-vide i, .tdb-chargement i { margin-right: 6px; }
.tdb-succes { padding: 14px; border-radius: 10px; background: var(--ax-success-light, #e8f5e9); color: var(--ax-success-text, #388e3c);
    font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.tdb-page p.tdb-note { margin: 8px 0 0; font-size: 12px; font-weight: 400; color: #94a3b8; }
.tdb-lien { margin-top: 12px; width: 100%; justify-content: center; }
.tdb-attenue { color: #94a3b8; }

/* KPI */
.tdb-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tdb-kpi { padding: 12px 14px; border-radius: 10px; background: #f7f9fc; border: 1px solid #e6eaf0; min-width: 0; }
.tdb-kpi-libelle { display: block; font-size: 12px; color: #64748b; margin-bottom: 4px; }
.tdb-kpi-valeur { display: block; font-size: 18px; font-weight: 700; color: var(--ax-text-bold, #111827); font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdb-kpi-positif .tdb-kpi-valeur { color: #15803d; }
.tdb-kpi-negatif .tdb-kpi-valeur { color: #b91c1c; }
.tdb-kpi-valeur i { font-size: 13px; }
.tdb-graphique { position: relative; height: 220px; }
@media (max-width: 600px) { .tdb-kpis { grid-template-columns: 1fr; } }

/* Listes (lettrage, tâches) */
.tdb-liste { list-style: none; margin: 0; padding: 0; }
.tdb-liste li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #eef1f5; }
.tdb-liste li:last-child { border-bottom: 0; }
.tdb-liste-icone { flex: 0 0 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px;
    background: var(--tdb-accent-fond); color: var(--tdb-accent); }
.tdb-liste-texte { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tdb-liste-texte b { font-size: 13.5px; color: var(--ax-text-bold, #111827); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdb-liste-texte small { font-size: 12px; color: #64748b; }
.tdb-liste-montant { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Tâches */
.tdb-pastilles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tdb-pastille { padding: 4px 10px; border-radius: 999px; background: var(--ax-info-light, #eff6ff); color: var(--ax-info-text, #1e40af); font-size: 12.5px; }
.tdb-pastille-alerte { background: #fee2e2; color: #991b1b; }
.tdb-pastille-neutre { background: #f1f5f9; color: #334155; }
.tdb-etat { flex: 0 0 10px; height: 10px; border-radius: 50%; }
.tdb-echeance { font-size: 12px; font-weight: 600; color: #475569; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; white-space: nowrap; }
.tdb-echeance.tdb-retard { background: #fee2e2; color: #991b1b; }
.tdb-echeance.tdb-jour { background: #fef3c7; color: #92400e; }

/* Vidéo */
.tdb-video { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 10px; background: #0f172a; }
.tdb-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Bouton « Visite guidée » : pastille tant que la visite n'a pas été vue */
.tdb-badge-nouveau { margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--ax-accent, #ec781d); color: #fff;
    font-size: 10.5px; font-weight: 700; line-height: 16px; }

/* Accessibilité : focus visible, animations réduites */
.tdb-root button:focus-visible { outline: 2px solid var(--ax-border-focus, #2563eb); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    .tdb-catalogue-item, .tdb-apercu, .tdb-icone-btn { transition: none; }
    .tdb-catalogue-item:hover { transform: none; }
}
.tdb-fleches { display: inline-flex; gap: 6px; }

/* ── Documents envoyés : nombre cliquable et fenêtre de détail par type ── */
.tdb-badge-cliquable { border: 0; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 4px;
    transition: transform .15s ease, box-shadow .15s ease; }
.tdb-badge-cliquable:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(16, 24, 40, .12); }
.tdb-badge-cliquable:focus-visible { outline: 2px solid var(--ax-border-focus, #2563eb); outline-offset: 2px; }
md-dialog.tdb-detail { width: 460px; max-width: 94vw; border-radius: 14px; overflow: hidden; }
.tdb-detail-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px;
    border-bottom: 1px solid #edf0f4; }
.tdb-detail-titre { font-size: 15px; font-weight: 600; color: #101828; display: flex; align-items: center; gap: 8px; }
.tdb-detail-titre i { color: #0e7490; }
.tdb-detail-sous { font-size: 12.5px; color: #64748b; margin-top: 2px; }
.tdb-detail-corps { padding: 8px 18px 12px; max-height: 60vh; overflow: auto; }
.tdb-detail-liste { list-style: none; margin: 0; padding: 0; }
.tdb-detail-liste li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; gap: 12px;
    padding: 9px 0; border-bottom: 1px solid #eef1f5; }
.tdb-detail-liste li:last-child { border-bottom: 0; }
.tdb-detail-type { font-size: 13.5px; color: #1e293b; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdb-detail-barre { height: 8px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.tdb-detail-barre span { display: block; height: 100%; border-radius: 999px; background: #0e7490; }
.tdb-detail-nombre { font-weight: 700; font-variant-numeric: tabular-nums; color: #101828; min-width: 32px; text-align: right; }
.tdb-detail-pied { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: #f7f9fc;
    border-top: 1px solid #edf0f4; font-size: 13px; color: #475569; }

/* ═══ Refonte : indicateurs clés, tuiles, liens discrets, documents compacts ═══ */

/* Indicateurs clés : le widget n'a pas de carte ni d'en-tête, chaque indicateur est sa propre carte. */
/* (en affichage seulement : en personnalisation, son aperçu reste une carte comme les autres) */
.tdb-grille:not(.tdb-grille-edition) > .tdb-widget.tdb-w-SYNTHESE { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.tdb-grille:not(.tdb-grille-edition) > .tdb-widget.tdb-w-SYNTHESE:hover { box-shadow: none; }
.tdb-grille:not(.tdb-grille-edition) > .tdb-w-SYNTHESE > .tdb-widget-tete { display: none; }
.tdb-grille:not(.tdb-grille-edition) > .tdb-w-SYNTHESE > .tdb-widget-corps { padding: 0; }
.tdb-w-SYNTHESE { --tdb-accent: #334155; --tdb-accent-fond: #eef1f5; }
.tdb-synthese { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 991px) { .tdb-synthese { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .tdb-synthese { grid-template-columns: 1fr; } }
.tdb-ind { --tdb-accent: #3f51b5; --tdb-accent-fond: #eef0fb;
    display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-align: left; width: 100%; font: inherit;
    background: #fff; border: 1px solid #dbe0e7; border-radius: 14px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06); }
button.tdb-ind { cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
button.tdb-ind:hover:not([disabled]) { border-color: var(--tdb-accent); transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 8px 18px rgba(16, 24, 40, .08); }
button.tdb-ind[disabled] { cursor: default; }
.tdb-ind-pieces { --tdb-accent: #0e7490; --tdb-accent-fond: #e0f2f6; }
.tdb-ind-lettrage { --tdb-accent: #7c3aed; --tdb-accent-fond: #efe9fe; }
.tdb-ind-taches { --tdb-accent: #c2410c; --tdb-accent-fond: #fdeee4; }
.tdb-ind-resultat { --tdb-accent: #15803d; --tdb-accent-fond: #e3f5e9; }
.tdb-ind-negatif { --tdb-accent: #b91c1c; --tdb-accent-fond: #fde8e8; }
.tdb-ind-alerte { border-color: #f5c2a8; }
.tdb-ind-icone { flex: 0 0 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--tdb-accent-fond); color: var(--tdb-accent); font-size: 18px; }
.tdb-ind-texte { display: flex; flex-direction: column; min-width: 0; }
.tdb-ind-libelle { font-size: 12.5px; font-weight: 600; color: #64748b; }
.tdb-ind-valeur { font-size: 26px; font-weight: 700; line-height: 1.15; color: #101828; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tdb-ind-resultat .tdb-ind-valeur, .tdb-ind-negatif .tdb-ind-valeur { color: var(--tdb-accent); }
.tdb-ind-alerte .tdb-ind-valeur { color: #c2410c; }
.tdb-ind-sous { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tuiles (lettrage) */
.tdb-tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tdb-tuile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; background: #f7f9fc; border: 1px solid #e6eaf0; min-width: 0; }
.tdb-tuile-tete { font-size: 12.5px; font-weight: 600; color: #475569; display: flex; align-items: center; gap: 6px; }
.tdb-tuile-tete i { color: var(--tdb-accent); }
.tdb-tuile-valeur { font-size: 20px; font-weight: 700; color: #101828; font-variant-numeric: tabular-nums; }
.tdb-tuile-valeur small { font-size: 12px; font-weight: 500; color: #94a3b8; }
.tdb-tuile-sous { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tdb-tuile-ok { background: #f3faf5; border-color: #d5eedc; }
.tdb-tuile-ok .tdb-tuile-valeur, .tdb-tuile-ok .tdb-tuile-sous { color: #15803d; }

/* Lien d'action discret en pied de widget (au lieu d'un gros bouton pleine largeur) */
.tdb-pied-lien { display: flex; justify-content: flex-end; margin-top: 12px; }
.tdb-lien-discret { border: 0; background: none; padding: 6px 8px; margin-right: -8px; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: var(--tdb-accent); display: inline-flex; align-items: center; gap: 6px; }
.tdb-lien-discret:hover { background: var(--tdb-accent-fond); }
.tdb-lien-discret i { transition: transform .15s ease; }
.tdb-lien-discret:hover i { transform: translateX(2px); }

/* Documents envoyés : filtre à plat (pas de carte dans la carte), tableau compact, barre de comparaison */
.tdb-w-DOCUMENTS_ENVOYES .dashboard-filter-bar { background: none; border: 0; padding: 0; margin-bottom: 12px; align-items: flex-end; }
.tdb-w-DOCUMENTS_ENVOYES .dashboard-doc-table { border: 1px solid #e6eaf0; border-radius: 10px; }
.tdb-w-DOCUMENTS_ENVOYES .dashboard-doc-table thead th { background: #f7f9fc; border-bottom: 1px solid #e6eaf0; font-size: 11.5px; color: #64748b; }
.tdb-w-DOCUMENTS_ENVOYES .dashboard-doc-table tbody { max-height: 300px; }
.tdb-w-DOCUMENTS_ENVOYES .dashboard-doc-table .col-entreprise { width: 45%; }
.tdb-w-DOCUMENTS_ENVOYES .dashboard-doc-table .col-nb-pieces { width: 55%; justify-content: flex-end; gap: 12px; }
.tdb-w-DOCUMENTS_ENVOYES .dashboard-doc-table thead .col-nb-pieces { justify-content: flex-end; }
.tdb-barre-doc { flex: 1; max-width: 260px; height: 6px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.tdb-barre-doc span { display: block; height: 100%; border-radius: 999px; background: #0e7490; opacity: .75; }
@media (prefers-reduced-motion: reduce) { button.tdb-ind, .tdb-lien-discret i { transition: none; } button.tdb-ind:hover { transform: none; } }
/* Widget étroit (1/3) : tuiles en lignes (nom et montant à gauche, nombre à droite) */
.tdb-l4 .tdb-tuiles { grid-template-columns: 1fr; gap: 8px; }
.tdb-l4 .tdb-tuile { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "tete valeur" "sous valeur";
    align-items: center; column-gap: 12px; row-gap: 2px; padding: 10px 12px; }
.tdb-l4 .tdb-tuile-tete { grid-area: tete; }
.tdb-l4 .tdb-tuile-valeur { grid-area: valeur; font-size: 18px; text-align: right; }
.tdb-l4 .tdb-tuile-sous { grid-area: sous; }
@media (max-width: 1279px) { .tdb-l4 .tdb-tuiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .tdb-l4 .tdb-tuile { display: flex; } }

/* ═══ Widgets Échéances fiscales, Relevés bancaires, Contrats et échéances, Délais de paiement ═══ */
.tdb-w-ECHEANCES_FISCALES { --tdb-accent: #b45309; --tdb-accent-fond: #fdf1dc; }
.tdb-w-RELEVES_BANCAIRES { --tdb-accent: #1d4ed8; --tdb-accent-fond: #e4ebff; }
.tdb-w-CONTRATS_ECHEANCES { --tdb-accent: #0f766e; --tdb-accent-fond: #dcf3f0; }
.tdb-w-DELAIS_PAIEMENT { --tdb-accent: #be123c; --tdb-accent-fond: #fde4ea; }
.tdb-entete-widget { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; font-size: 13px; color: #475569; }
.tdb-echeance-globale { font-size: 12px; font-weight: 600; color: var(--tdb-accent); background: var(--tdb-accent-fond); padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.tdb-pastille-ok { background: #e3f5e9; color: #166534; }
.tdb-liste-defile { max-height: 264px; overflow: auto; margin-right: -6px; padding-right: 6px; }
.tdb-statut-point { flex: 0 0 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.tdb-st-A_FAIRE { background: #94a3b8; }
.tdb-st-EN_COURS { background: #3b82f6; }
.tdb-st-CLOTUREE { background: #f59e0b; }
.tdb-st-DEPOSEE { background: #16a34a; }
.tdb-st-IGNOREE { background: #cbd5e1; }
.tdb-st-RETARD { background: #dc2626; box-shadow: 0 0 0 3px #fde2e2; }
.tdb-etiquette { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; background: #f1f5f9; color: #475569; }
.tdb-et-EN_COURS { background: #e4ebff; color: #1e40af; }
.tdb-et-CLOTUREE { background: #fef3c7; color: #92400e; }
.tdb-et-DEPOSEE { background: #e3f5e9; color: #166534; }
.tdb-et-RETARD { background: #fee2e2; color: #991b1b; }
.tdb-sous-titre { margin: 14px 0 8px; font-size: 12.5px; font-weight: 600; color: #64748b; display: flex; align-items: center; gap: 6px; }
.tdb-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.tdb-puce { font-size: 12px; font-weight: 600; color: #334155; background: #f7f9fc; border: 1px solid #e6eaf0; border-radius: 8px; padding: 3px 8px; }
.tdb-puce small { font-weight: 500; color: #94a3b8; margin-left: 4px; }
.tdb-tuile-alerte { background: #fff5f5; border-color: #fbd5d5; }
.tdb-tuile-alerte .tdb-tuile-valeur { color: #b91c1c; }
.tdb-bandeau { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; padding: 10px 12px; border-radius: 10px;
    background: var(--tdb-accent-fond); color: #334155; font-size: 13px; }
.tdb-bandeau > i { color: var(--tdb-accent); }
.tdb-bandeau-alerte { background: #fee2e2; color: #7f1d1d; }
.tdb-pied-lien .tdb-lien-discret + .tdb-lien-discret { margin-left: 8px; }

/* ═══ Hauteurs : les cartes d'une même rangée ont la même hauteur, le lien d'action reste en bas ═══ */
.tdb-grille:not(.tdb-grille-edition) { align-items: stretch; }
.tdb-grille:not(.tdb-grille-edition) > .tdb-widget { display: flex; flex-direction: column; }
.tdb-grille:not(.tdb-grille-edition) > .tdb-widget > .tdb-widget-corps { flex: 1 1 auto; display: flex; flex-direction: column; }
.tdb-widget-corps > [ng-controller] { flex: 1 1 auto; display: flex; flex-direction: column; }
.tdb-widget-corps > [ng-controller] > div:not(.tdb-vide):not(.tdb-chargement):not(.tdb-succes):not(.tdb-tuiles):not(.tdb-ind) { flex: 1 1 auto; display: flex; flex-direction: column; }
.tdb-widget-corps .tdb-pied-lien { margin-top: auto; padding-top: 12px; }
.tdb-widget-corps > [ng-controller] > .tdb-vide,
.tdb-widget-corps > [ng-controller] > .tdb-chargement { margin: auto 0; }
/* Les indicateurs clés gardent leur hauteur naturelle */
.tdb-grille:not(.tdb-grille-edition) > .tdb-w-SYNTHESE > .tdb-widget-corps > [ng-controller] { display: grid; }

/* Lettrage à faire (tous les dossiers) : barre empilée clients / fournisseurs / créditeurs */
.tdb-lettrage-nom { flex: 0 0 34%; }
.tdb-barre-empilee { flex: 1; height: 8px; border-radius: 999px; background: #eef1f5; overflow: hidden; display: flex; }
.tdb-barre-empilee > span { display: block; height: 100%; }
.tdb-seg-c, .tdb-leg-c { background: #7c3aed; }
.tdb-seg-f, .tdb-leg-f { background: #c4b5fd; }
.tdb-seg-d, .tdb-leg-d { background: #f59e0b; }
.tdb-legende { margin-left: auto; font-weight: 500; font-size: 11.5px; color: #94a3b8; display: inline-flex; align-items: center; gap: 4px; }
.tdb-leg { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-left: 6px; }
.tdb-ligne-courante { background: #f6f3ff; border-radius: 8px; padding-left: 6px !important; padding-right: 6px !important; }
/* Lettrage à faire : un clic (ou Entrée) sur un dossier l'ouvre et affiche son lettrage. */
.tdb-ligne-cliquable { cursor: pointer; border-radius: 8px; transition: background-color .15s; }
.tdb-ligne-cliquable:hover { background: #f3f0ff; }
.tdb-ligne-cliquable:focus-visible { outline: 2px solid #7c3aed; outline-offset: 1px; }
.tdb-sous-titre { flex-wrap: wrap; }

/* Sélecteur de portée : tous les dossiers / dossier en cours (contexte comptable) */
.tdb-portee { display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin-left: auto; border-radius: 10px;
    background: #e3e7ee; border: 1px solid #d8dde6; }
.tdb-portee button { border: 0; background: none; min-height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: #475569; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.tdb-portee button:hover:not([disabled]) { color: var(--ax-primary, #3f51b5); }
.tdb-portee button.tdb-portee-active { background: #fff; color: var(--ax-primary, #3f51b5); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.tdb-portee button[disabled] { opacity: .5; cursor: not-allowed; }
.tdb-portee button:focus-visible { outline: 2px solid var(--ax-border-focus, #2563eb); outline-offset: 1px; }
@media (max-width: 991px) { .tdb-portee { margin-left: 0; order: 3; width: 100%; } .tdb-portee button { flex: 1; justify-content: center; } }
