/* =====================================================================
 * CFA CRM — Composants & overrides Bootstrap
 * Modernise les composants sans toucher au markup des templates.
 * =====================================================================
 */

/* ============== Base / typo ========================================= */
body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: var(--fw-semibold);
    color: var(--c-text-strong);
    letter-spacing: -0.01em;
}

.h1, h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); }
.h2, h2 { font-size: var(--fs-2xl); line-height: var(--lh-tight); }
.h3, h3 { font-size: var(--fs-xl);  line-height: var(--lh-snug); }
.h4, h4 { font-size: var(--fs-lg);  line-height: var(--lh-snug); }
.h5, h5 { font-size: var(--fs-md);  line-height: var(--lh-snug); }
.h6, h6 { font-size: var(--fs-sm);  line-height: var(--lh-snug); text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-muted); }

a { color: var(--c-primary-600); }
a:hover { color: var(--c-primary-700); }

.text-muted { color: var(--c-text-muted) !important; }
.small, small { font-size: var(--fs-sm); }

/* ============== App shell (sidebar + topbar + content) ============= */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
    background: var(--c-bg);
    transition: grid-template-columns 0.22s ease;
}
.app-shell--collapsed {
    grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}
@media (max-width: 991.98px) {
    .app-shell, .app-shell--collapsed { grid-template-columns: 1fr; }
}

/* ----- Sidebar ----- */
.sidebar {
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 30;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--c-divider);
    min-height: var(--topbar-h);
}
.sidebar__brand-logo {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
}
.sidebar__brand-logo img { width: 32px; height: 32px; object-fit: contain; }
.sidebar__brand-text {
    font-weight: var(--fw-semibold);
    font-size: var(--fs-md);
    color: var(--c-text-strong);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar__nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar__section {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-text-faint);
    padding: 14px 10px 6px;
}
.sidebar__group-items { display: flex; flex-direction: column; gap: 2px; }
/* Menu staff : moins d'espace entre le champ de recherche et le premier label */
.sidebar__search + .sidebar__nav { padding-top: 0; }
.sidebar__search + .sidebar__nav .sidebar__rubriques > .sidebar__section:first-child { padding-top: 8px; }
/* Chercher un menu : le champ reste en haut, seule la liste défile */
.sidebar__menu { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sidebar__search { position: relative; flex-shrink: 0; padding: 10px 10px 0; }
.sidebar__search .form-control { height: 34px; padding: 4px 10px 4px 32px; font-size: var(--fs-sm); background-color: var(--c-gray-100); border-color: transparent; }
.sidebar__search .form-control:focus { background-color: var(--c-surface); border-color: var(--c-primary-400); }
.sidebar__search-btn {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 28px;
    height: 34px;
    border: 0;
    background: none;
    color: var(--c-gray-500);
    font-size: 0.85rem;
    cursor: pointer;
}
.sidebar__rubriques { display: contents; }
.sidebar__link--resultat { white-space: normal; }
.sidebar__resultat { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar__resultat small { color: var(--c-text-muted); font-size: var(--fs-xs); font-weight: var(--fw-regular, 400); }
.sidebar__vide { margin: 8px 10px; color: var(--c-text-muted); font-size: var(--fs-sm); }
.sidebar__sep { height: 1px; background: var(--c-divider); margin: 6px 10px; flex-shrink: 0; }
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border-radius: var(--radius-md);
    color: var(--c-gray-700);
    font-weight: var(--fw-medium);
    font-size: var(--fs-base);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}
.sidebar__link:hover {
    background: var(--c-gray-100);
    color: var(--c-text-strong);
}
.sidebar__link.is-active {
    background: var(--c-primary-50);
    color: var(--c-primary-700);
}
.sidebar__link.is-active i { color: var(--c-primary-600); }
/* Pastille sur une entrée de menu (ex. « Bêta ») : à droite du libellé */
.sidebar__tag {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--c-primary-50);
    color: var(--c-primary-700);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.02em;
    line-height: 1.5;
}
.sidebar__link i {
    font-size: 1.05rem;
    color: var(--c-gray-500);
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.sidebar__link-badge {
    margin-left: auto;
    font-size: var(--fs-xs);
    background: var(--c-gray-100);
    color: var(--c-gray-600);
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    font-weight: var(--fw-medium);
}
.sidebar__link.is-active .sidebar__link-badge {
    background: var(--c-primary-100);
    color: var(--c-primary-700);
}
.sidebar__footer {
    border-top: 1px solid var(--c-divider);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* État collapsed : on cache les libellés */
.app-shell--collapsed .sidebar__brand-text,
.app-shell--collapsed .sidebar__section,
.app-shell--collapsed .sidebar__link span:not(.sidebar__link-badge),
.app-shell--collapsed .sidebar__link-badge { display: none; }
.app-shell--collapsed .sidebar__brand { justify-content: center; padding: 16px 0 14px; }
/* Menu réduit : la loupe seule, qui rouvre le menu et place le curseur dans le champ */
.app-shell--collapsed .sidebar__search .form-control { display: none; }
.app-shell--collapsed .sidebar__search { height: 44px; padding: 10px 0 0; }
.app-shell--collapsed .sidebar__search-btn { left: 20px; font-size: 1rem; }
/* Menu réduit aux icônes : le compteur de la rubrique devient une pastille */
.app-shell--collapsed .sidebar__link.has-badge::after {
    content: '';
    position: absolute;
    top: 7px;
    right: 13px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bs-warning);
}
.app-shell--collapsed .sidebar__link { justify-content: center; padding: 10px; }
.app-shell--collapsed .sidebar__nav { padding: 12px 6px; }

/* Drawer mobile : la sidebar devient un overlay */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow-lg);
    }
    .app-shell--mobile-open .sidebar { transform: translateX(0); }
    .sidebar__backdrop {
        position: fixed;
        inset: 0;
        background: rgba(47, 41, 37, 0.5);
        z-index: 25;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease;
    }
    .app-shell--mobile-open .sidebar__backdrop { opacity: 1; pointer-events: auto; }
}

/* ----- Topbar ----- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--topbar-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
}
.topbar__menu-btn {
    border: none;
    background: transparent;
    color: var(--c-gray-600);
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}
.topbar__menu-btn:hover { background: var(--c-gray-100); color: var(--c-text-strong); }
/* Replier / déplier le menu : à gauche du titre (ordinateur ; sur téléphone le bouton ci-dessus ouvre le menu) */
.topbar__collapse-btn {
    border: none;
    background: transparent;
    color: var(--c-gray-600);
    padding: 8px;
    margin-left: -8px;
    border-radius: var(--radius-sm);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    align-items: center;
}
.topbar__collapse-btn:hover { background: var(--c-gray-100); color: var(--c-text-strong); }
.topbar__collapse-btn:focus-visible { outline: 2px solid var(--c-primary-400); outline-offset: 1px; }
@media (max-width: 991.98px) { .topbar__menu-btn { display: inline-flex; } }

.topbar__title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--c-text-strong);
    margin: 0;
}
.topbar__crumbs {
    color: var(--c-text-muted);
    font-size: var(--fs-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.topbar__crumbs a { color: var(--c-text-muted); text-decoration: none; }
.topbar__crumbs a:hover { color: var(--c-text-strong); }
.topbar__crumbs .sep { color: var(--c-text-faint); }

.topbar__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar__search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--c-gray-100);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--c-text-muted);
    font-size: var(--fs-sm);
    cursor: text;
    min-width: 220px;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.topbar__search:hover { background: var(--c-surface); border-color: var(--c-border); }
.topbar__search kbd {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    margin-left: auto;
}

.topbar__user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    color: var(--c-text);
    text-decoration: none;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.topbar__user:hover { background: var(--c-gray-100); }
.topbar__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--c-primary-600);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: var(--fw-semibold);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.topbar__user-name { font-weight: var(--fw-medium); color: var(--c-text-strong); }
.topbar__user-role { color: var(--c-text-muted); font-size: var(--fs-xs); }
@media (max-width: 575.98px) { .topbar__search, .topbar__user-name, .topbar__user-role { display: none; } }

/* ----- Barre horizontale : les pages de la rubrique ouverte dans la colonne de gauche ----- */
.subnav {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 44px;
    padding: 0 16px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}
.subnav__track {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.subnav__track::-webkit-scrollbar { display: none; }
.subnav > [data-plus-more] { flex: 0 0 auto; }
.subnav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 5px 13px;
    border: 0;
    background: none;
    border-radius: var(--radius-pill);
    color: var(--c-gray-600);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.subnav__link[hidden] { display: none; }
.subnav__link:hover { background: var(--c-gray-100); color: var(--c-text-strong); }
.subnav__link.is-active { background: var(--c-primary-100); color: var(--c-primary-800); font-weight: var(--fw-semibold); }
.subnav__link:focus-visible { outline: 2px solid var(--c-primary-600); outline-offset: -2px; }
.subnav__link .bi { font-size: 0.7rem; }
.subnav__link .badge { font-size: 0.68rem; }
[data-plus-more] .dropdown-item { font-size: var(--fs-sm); }
[data-plus-more] .dropdown-item .badge { margin-left: auto; }
@media (max-width: 991.98px) {
    /* Sur téléphone la barre défile : le bord droit s'estompe pour montrer qu'il y a une suite */
    .subnav { padding: 0 4px 0 8px; }
    .subnav__track {
        padding-right: 24px;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    }
    .subnav__link { padding: 7px 12px; font-size: var(--fs-base); }
}

/* Onglets d'une promo : même principe que la barre horizontale (« Plus » sur ordinateur, défilement sur téléphone) */
.promo-tabs {
    display: flex;
    align-items: flex-end;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--c-border);
}
.promo-tabs__track {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    border-bottom: 0;
}
.promo-tabs__track::-webkit-scrollbar { display: none; }
.promo-tabs .promo-tabs__track { scrollbar-width: none; } /* responsive.css remet une barre fine sur tous les .nav-tabs */
.promo-tabs .nav-link { white-space: nowrap; padding: .45rem .75rem; font-size: .875rem; }
.promo-tabs .nav-link.active { font-weight: 600; }
.promo-tabs > [data-plus-more] { flex: 0 0 auto; }
.promo-tabs > [data-plus-more] .nav-link { border: 0; background: none; color: var(--c-primary-600); }

/* ----- Contenu ----- */
.app-content {
    padding: 24px 28px 40px;
    width: 100%;
    /* Pas de max-width : on utilise toute la largeur dispo (sidebar exclue).
       Les pages avec tableaux larges (candidats, entreprises) bénéficient
       directement de plus d'espace. */
    min-width: 0;            /* permet à la grille parent de rétrécir ce bloc */
    overflow-x: hidden;      /* empêche la page de pousser hors du viewport */
    overflow-x: clip;        /* idem sans créer de zone de défilement : les éléments position: sticky restent collés */
}
@media (max-width: 575.98px) { .app-content { padding: 16px; } }
/* Les tables doivent scroller HORIZONTALEMENT à l'intérieur de leur carte,
   sans pousser le contenu de la page. */
.table-responsive { overflow-x: auto !important; max-width: 100%; }

/* ============== Composants Bootstrap modernisés ===================== */

/* ----- Cards ----- */
.card {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    box-shadow: none;
}
/* À plat : seuls les éléments qui flottent (menus, fenêtres, messages) gardent une ombre */
.card.shadow-sm, .alert.shadow-sm, .list-group.shadow-sm, .table-responsive.shadow-sm { box-shadow: none !important; }
.card-body { padding: 18px 20px; }

/* On supprime l'effet "vieux template" des border-start colorées
   en transformant la barre verticale en un fin point coloré. */
.card.border-start.border-4 {
    border-left-width: 1px !important;
    border-color: var(--c-border) !important;
    position: relative;
    overflow: hidden;
}
.card.border-start.border-4::before {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 3px;
}
.card.border-start.border-primary::before { background: var(--c-primary-500); }
.card.border-start.border-info::before    { background: var(--c-info-500); }
.card.border-start.border-warning::before { background: var(--c-warning-500); }
.card.border-start.border-success::before { background: var(--c-success-500); }
.card.border-start.border-danger::before  { background: var(--c-danger-500); }
.card.border-start.border-secondary::before { background: var(--c-gray-400); }

.card.border-danger { border-color: var(--c-danger-200, var(--c-danger-100)); }

/* ----- Boutons ----- */
.btn {
    font-weight: var(--fw-medium);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}
.btn:focus, .btn:focus-visible { box-shadow: var(--shadow-focus); outline: none; }
.btn-sm { padding: 4px 10px; font-size: var(--fs-sm); }
.btn-lg { padding: 10px 20px; font-size: var(--fs-md); }

.btn-primary {
    background: var(--c-primary-600);
    border-color: var(--c-primary-600);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--c-primary-700);
    border-color: var(--c-primary-700);
    color: #fff;
}
.btn-primary:active { background: var(--c-primary-800); border-color: var(--c-primary-800); }

.btn-outline-primary {
    color: var(--c-primary-700);
    border-color: var(--c-primary-200);
    background: transparent;
}
.btn-outline-primary:hover {
    background: var(--c-primary-50);
    border-color: var(--c-primary-300);
    color: var(--c-primary-800);
}

.btn-outline-secondary {
    color: var(--c-gray-700);
    border-color: var(--c-border);
    background: var(--c-surface);
}
.btn-outline-secondary:hover {
    background: var(--c-gray-100);
    border-color: var(--c-gray-300);
    color: var(--c-text-strong);
}

.btn-outline-success {
    color: var(--c-success-700);
    border-color: var(--c-success-100);
    background: var(--c-success-50);
}
.btn-outline-success:hover {
    background: var(--c-success-100);
    border-color: var(--c-success-500);
    color: var(--c-success-700);
}

.btn-warning {
    background: var(--c-warning-500);
    border-color: var(--c-warning-500);
    color: #fff;
}
.btn-warning:hover { background: var(--c-warning-600); border-color: var(--c-warning-600); color: #fff; }

.btn-danger {
    background: var(--c-danger-600);
    border-color: var(--c-danger-600);
    color: #fff;
}
.btn-danger:hover { background: var(--c-danger-700); border-color: var(--c-danger-700); }

/* ----- Inputs / forms ----- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--c-border);
    padding: 7px 11px;
    font-size: var(--fs-base);
    color: var(--c-text-strong);
    background-color: var(--c-surface);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.form-select { padding-right: 34px; } /* place de la flèche : le `padding` ci-dessus écrase celui de Bootstrap */
.table td .form-select { min-width: 6.5rem; } /* un tableau étroit écrase sinon la liste jusqu'à couper son texte */
.table td .form-select--ajuste { min-width: max-content; } /* la colonne prend la largeur de l'option la plus longue */
/* Barres de filtres : les colonnes Bootstrap ignorent le menu de gauche. Sous 1400 px, elles se calent sur leur
   contenu et passent à la ligne plutôt que de couper le texte des listes. */
@media (max-width: 1399.98px) {
    form[method="get"] .row > [class*="col-"]:has(> .form-select) {
        flex: 1 1 auto;
        width: auto;
        max-width: min(100%, 20rem);
    }
}
.form-control:focus, .form-select:focus {
    border-color: var(--c-primary-400);
    box-shadow: var(--shadow-focus);
}
.form-control::placeholder { color: var(--c-text-faint); }
.form-label {
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    color: var(--c-gray-700);
    margin-bottom: 6px;
}
.form-check-input:checked { background-color: var(--c-primary-600); border-color: var(--c-primary-600); }
.form-check-input:focus { box-shadow: var(--shadow-focus); border-color: var(--c-primary-400); }

/* ----- Tables ----- */
.table {
    --bs-table-bg: transparent;
    color: var(--c-text);
    border-color: var(--c-divider);
}
.table > :not(caption) > * > * {
    padding: 11px 12px;
    border-bottom-color: var(--c-divider);
}
.table > thead {
    background: var(--c-gray-50);
}
.table > thead th {
    font-weight: var(--fw-semibold);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--c-text-muted);
    border-bottom: 1px solid var(--c-border);
}
.table-sm > :not(caption) > * > * { padding: 8px 10px; }
.table tbody tr:hover { background: var(--c-gray-50); }

/* ----- Badges ----- */
.badge {
    font-weight: var(--fw-medium);
    font-size: var(--fs-xs);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.01em;
}
.badge.bg-primary    { background: var(--c-primary-100) !important; color: var(--c-primary-700) !important; }
.badge.bg-info       { background: var(--c-info-100) !important;    color: var(--c-info-700) !important; }
.badge.bg-success    { background: var(--c-success-100) !important; color: var(--c-success-700) !important; }
.badge.bg-warning    { background: var(--c-warning-100) !important; color: var(--c-warning-700) !important; }
.badge.bg-warning.text-dark { color: var(--c-warning-700) !important; }
.badge.bg-danger     { background: var(--c-danger-100) !important;  color: var(--c-danger-700) !important; }
.badge.bg-secondary  { background: var(--c-gray-100) !important;    color: var(--c-gray-700) !important; }
.badge.bg-dark       { background: var(--c-gray-800) !important;    color: #fff !important; }
.badge.bg-light      { background: var(--c-gray-100) !important;    color: var(--c-gray-700) !important; }
.badge.bg-light.text-dark { color: var(--c-gray-700) !important; border: 1px solid var(--c-border); }

/* ----- Alerts ----- */
.alert {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: var(--fs-base);
}
.alert-success { background: var(--c-success-50); border-color: var(--c-success-100); color: var(--c-success-700); }
.alert-warning { background: var(--c-warning-50); border-color: var(--c-warning-100); color: var(--c-warning-700); }
.alert-danger  { background: var(--c-danger-50);  border-color: var(--c-danger-100);  color: var(--c-danger-700); }
.alert-info    { background: var(--c-info-50);    border-color: var(--c-info-100);    color: var(--c-info-700); }

/* ----- List groups ----- */
.list-group-item {
    background: transparent;
    border-color: var(--c-divider);
    padding: 12px 0;
    color: var(--c-text);
}
.list-group-flush > .list-group-item:first-child { padding-top: 8px; }
.list-group-flush > .list-group-item:last-child { border-bottom: 0; }
.list-group-item-action { color: var(--c-text); transition: background 0.12s ease; }
.list-group-item-action:hover {
    background: var(--c-gray-50);
    color: var(--c-text-strong);
    border-radius: var(--radius-sm);
}

/* ----- Progress ----- */
.progress {
    background: var(--c-gray-100);
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.progress-bar { background: var(--c-primary-500); }
.progress-bar.bg-primary { background: var(--c-primary-500) !important; }
.progress-bar.bg-info    { background: var(--c-info-500) !important; }
.progress-bar.bg-success { background: var(--c-success-500) !important; }
.progress-bar.bg-warning { background: var(--c-warning-500) !important; }
.progress-bar.bg-danger  { background: var(--c-danger-500) !important; }

/* ----- KPI cards (touche distinctive) ----- */
.card .text-uppercase.small.text-muted {
    font-size: var(--fs-xs);
    letter-spacing: 0.06em;
    font-weight: var(--fw-semibold);
    color: var(--c-text-muted) !important;
}
.card .h2 {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-semibold);
    color: var(--c-text-strong);
    letter-spacing: -0.02em;
}

/* ----- Login ----- */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--c-bg);
}
.login-card {
    max-width: 400px;
    width: 100%;
    margin: 0;
}

/* ----- Footer ----- */
.app-footer {
    border-top: 1px solid var(--c-divider);
    padding: 16px 28px;
    font-size: var(--fs-xs);
    color: var(--c-text-muted);
    background: transparent;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}
.app-footer a { color: var(--c-text-muted); text-decoration: none; }
.app-footer a:hover { color: var(--c-text); text-decoration: underline; }

/* ============== Mobile : barre basse, recherche plein écran ========== */
/* Colonne principale (topbar + contenu + footer) : reçoit le padding-bottom
   qui laisse la place à la barre basse sur téléphone. */
.app-main { min-width: 0; }

.topbar__icon-btn {
    border: none;
    background: transparent;
    color: var(--c-gray-600);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
}
.topbar__icon-btn:hover { background: var(--c-gray-100); color: var(--c-text-strong); }

.mobile-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 24;                 /* sous le backdrop (25) et le menu latéral (30) */
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav__inner {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    height: 60px;
}
.mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 0 2px;
    border: none;
    background: transparent;
    color: var(--c-gray-600);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: var(--fw-medium);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.mobile-nav__item i { font-size: 1.35rem; line-height: 1; }
.mobile-nav__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-nav__item.is-active { color: var(--c-primary-700); }
.mobile-nav__item.is-active i { color: var(--c-primary-600); }
.mobile-nav__badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--c-danger, #dc2626);
    color: #fff;
    font-size: 0.62rem;
    font-weight: var(--fw-semibold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 991.98px) {
    .mobile-nav { display: block; }
    .app-main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}

.msearch {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--c-bg);
    display: flex;
    flex-direction: column;
}
.msearch__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    min-height: var(--topbar-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}
.msearch__bar input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 16px;            /* évite le zoom iOS */
    background: var(--c-gray-100);
}
.msearch__results { flex: 1; overflow-y: auto; padding: 6px 0; background: var(--c-surface); }
.msearch__results .dropdown-item { white-space: normal; padding: 10px 14px; }

/* ============== Agenda : liste par jour (rendu téléphone) ============ */
.agenda-jours__head {
    padding: 8px 12px;
    font-weight: var(--fw-semibold);
    background: var(--c-gray-50);
    border-bottom: 1px solid var(--c-border);
    border-top: 1px solid var(--c-border);
}
.agenda-jours__head.is-today { background: var(--c-primary-50); color: var(--c-primary-700); }
.agenda-jours__item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px 10px 10px;
    border-left: 4px solid var(--c-primary-500);
    border-bottom: 1px solid var(--c-divider);
}
.agenda-jours__item--autre { background: var(--c-gray-50); opacity: 0.85; }
.agenda-jours__time {
    flex: 0 0 48px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}
.agenda-jours__body { flex: 1 1 auto; min-width: 0; }
.agenda-jours__actions { flex: 0 0 auto; display: flex; gap: 6px; }

/* ----- Petites finitions ----- */
hr { color: var(--c-divider); opacity: 1; }
code, kbd { font-family: var(--font-mono); }

/* Focus visible cohérent */
*:focus-visible {
    outline: none;
}
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible,
a:focus-visible, .sidebar__link:focus-visible, .topbar__user:focus-visible {
    box-shadow: var(--shadow-focus);
    outline: none;
    border-radius: var(--radius-sm);
}

/* ============================================================
   Confirmations et toasts de l'application (guard.js : data-confirm, iswToast)
   ============================================================ */
.isw-dialog {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(47, 41, 37, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.isw-dialog[hidden] { display: none; }
.isw-dialog__box {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: min(440px, 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.isw-dialog__head { display: flex; align-items: center; gap: 12px; }
.isw-dialog__head[hidden] { display: none; }
.isw-dialog__icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem; background: var(--c-primary-50, #EFF6FF); color: var(--c-primary-600, #2563EB); }
.isw-dialog__head--danger .isw-dialog__icon { background: var(--c-danger-100); color: var(--c-danger-600); }
.isw-dialog__title { margin: 0; font-size: var(--fs-lg, 1.1rem); font-weight: 600; color: var(--c-text-strong); }
.isw-dialog__head + .isw-dialog__msg { color: var(--c-text-muted); }
.isw-dialog__msg { margin: 0; white-space: pre-line; color: var(--c-text-strong); font-size: var(--fs-md); line-height: var(--lh-snug); }
.isw-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
html.isw-dialog-open { overflow: hidden; }

.isw-toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(380px, calc(100vw - 32px));
}
@media (max-width: 991.98px) {
    /* En haut sur téléphone : en bas, les toasts couvriraient la barre de navigation et les barres d'actions des fiches */
    .isw-toasts { right: 50%; transform: translateX(50%); bottom: auto; top: calc(var(--topbar-h) + 8px + env(safe-area-inset-top, 0px)); }
}
.isw-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--c-gray-900);
    color: #fff;
    box-shadow: var(--shadow-lg);
    font-size: var(--fs-sm);
    border-left: 4px solid var(--c-info-500);
}
.isw-toast--success { border-left-color: var(--c-success-500); }
.isw-toast--warning { border-left-color: var(--c-warning-500); }
.isw-toast--danger  { border-left-color: var(--c-danger-500); }
.isw-toast__msg { flex: 1; min-width: 0; white-space: pre-line; }
.isw-toast__action { background: none; border: 0; color: var(--c-primary-300); font-weight: var(--fw-semibold); text-decoration: underline; padding: 0; white-space: nowrap; }
.isw-toast__close { background: none; border: 0; color: var(--c-gray-400); font-size: 1.2rem; line-height: 1; padding: 0 2px; }

/* ============================================================
   Explication repliable « Comment ça marche » (partials/help.twig)
   ============================================================ */
.isw-help { margin-bottom: 14px; }
.isw-help__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    padding: 2px 0;
    color: var(--c-primary-700);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
}
.isw-help__toggle .bi-chevron-down { transition: transform .15s; font-size: .75em; }
.isw-help.is-open .isw-help__toggle .bi-chevron-down { transform: rotate(180deg); }
.isw-help__body {
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--c-gray-100);
    border: 1px solid var(--c-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    color: var(--c-gray-700);
    max-width: 920px;
}
.isw-help__body > :last-child { margin-bottom: 0; }

/* ============================================================
   En-tête de page commun (partials/page_header.twig)
   ============================================================ */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 16px;
}
.page-header__title { margin: 0; font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--c-text-strong); letter-spacing: -0.01em; }
.page-header__count { color: var(--c-text-muted); font-weight: var(--fw-medium); font-size: var(--fs-lg); margin-left: 4px; }
.page-header__sub { flex-basis: 100%; order: 3; margin: -6px 0 0; color: var(--c-text-muted); font-size: var(--fs-sm); }
.page-header__actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 575.98px) {
    .page-header__actions { margin-left: 0; width: 100%; }
}

/* Boutons Appeler / WhatsApp / Email (partials/ui.twig → contact_buttons) */
.contact-actions { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.contact-actions .btn { padding: 2px 8px; }
.tel-link { color: inherit; text-decoration: none; white-space: nowrap; }
.tel-link:hover { color: var(--c-primary-700); text-decoration: underline; }

/* Tableau large : en-tête et première colonne restent visibles au défilement */
.table-sticky { border-collapse: separate; border-spacing: 0; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; background: var(--c-gray-50); }
.table-sticky th:first-child, .table-sticky td:first-child { position: sticky; left: 0; z-index: 1; background: var(--c-surface); box-shadow: 1px 0 0 var(--c-border); }
.table-sticky thead th:first-child { z-index: 3; background: var(--c-gray-50); }
.table-sticky tr[class*="table-"] td:first-child { background: inherit; }

/* Sélecteur de fiche par recherche (partials/entity_picker.twig) */
.entity-picker { position: relative; }
.entity-picker__menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 50;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 260px;
    overflow-y: auto;
}
.entity-picker__item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 12px; font-size: var(--fs-sm); }
.entity-picker__item:hover, .entity-picker__item:focus { background: var(--c-primary-50); }
.entity-picker__item small { display: block; color: var(--c-text-muted); }

/* Fonds de carte OpenStreetMap adoucis (style proche de l'ancien CARTO Positron) */
.isw-tiles { filter: grayscale(0.85) brightness(1.04) contrast(0.92); }

/* Barre du haut : titre + fil d'Ariane recalculé depuis le menu (layout.twig) */
.topbar__heading { display: flex; flex-direction: column; min-width: 0; }
.topbar__heading .topbar__crumbs span { overflow: hidden; text-overflow: ellipsis; }
.topbar__heading .topbar__title + .topbar__crumbs { margin-top: 1px; }
.topbar__heading > .topbar__crumbs:only-child { font-size: var(--fs-base); color: var(--c-text); }
/* Sur téléphone, le fil d'Ariane n'a la place que pour son dernier élément */
@media (max-width: 767.98px) {
    .topbar__crumbs { flex-wrap: nowrap; min-width: 0; }
    .topbar__crumbs > :not(:last-child) { display: none; }
    .topbar__crumbs > :last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Menu : fiches récentes, posées en bas de la colonne pour ne pas décaler les rubriques */
.sidebar__recents { margin-top: auto; }
.sidebar__recents .sidebar__section { padding-top: 6px; }
.sidebar__recents .sidebar__link--recent { font-size: var(--fs-sm); color: var(--c-text-muted); }
.sidebar__recents .sidebar__link--recent span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-shell--collapsed .sidebar__recents { display: none; }
/* Conteneur de tableau long : hauteur bornée pour que l'en-tête .table-sticky reste collé */
.table-scroll { max-height: 75vh; overflow: auto; }

/* ============== Pastilles de rubrique (menu de l'équipe) ============ */
.nav-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--tile-gris);
}
.sidebar__link .nav-tile i,
.sidebar__link.is-active .nav-tile i { color: #fff; font-size: 0.85rem; width: auto; line-height: 1; }
.nav-tile--ambre  { background: var(--tile-ambre); }
.nav-tile--rouge  { background: var(--tile-rouge); }
.nav-tile--vert   { background: var(--tile-vert); }
.nav-tile--terre  { background: var(--tile-terre); }
.nav-tile--canard { background: var(--tile-canard); }
.nav-tile--prune  { background: var(--tile-prune); }
.nav-tile--bleu   { background: var(--tile-bleu); }
.nav-tile--ocre   { background: var(--tile-ocre); }
.nav-tile--olive  { background: var(--tile-olive); }
.nav-tile--gris   { background: var(--tile-gris); }
.sidebar__link.is-active { font-weight: var(--fw-semibold); }
.app-shell--collapsed .sidebar__link span.nav-tile { display: inline-flex; }
.app-shell--collapsed .sidebar__link:has(.nav-tile) { padding: 7px; }

/* ============== Hiérarchie de texte et chiffres ===================== */
/* Trois niveaux : le nom (foncé, cliquable), l'information (normal), le secondaire (petit et clair). */
.table tbody a:not(.btn):not(.badge):not(.dropdown-item) {
    color: var(--c-text-strong);
    font-weight: var(--fw-medium);
    text-decoration: none;
}
.table tbody a:not(.btn):not(.badge):not(.dropdown-item):hover { color: var(--c-primary-700); text-decoration: underline; }
.table tbody .text-muted, .table tbody small { font-size: var(--fs-sm); }
/* Chiffres de même largeur : heures, montants et dates se comparent d'un coup d'œil */
.table, .badge, .card .h2, .num, .kpi, time { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }

/* ============== Liste groupée (fiches, façon Réglages iOS) ========== */
/* Toute liste <dl class="row"> (dt.col-* + dd.col-*) : une ligne par information, libellé discret à gauche,
   valeur foncée à droite, séparées par un filet. Rien à changer dans les pages. */
dl.row { --bs-gutter-y: 0; }
dl.row > dt, dl.row > dd {
    margin: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    border-top: 1px solid var(--c-divider);
}
dl.row > dt:first-of-type, dl.row > dt:first-of-type + dd { border-top: 0; padding-top: 2px; }
dl.row > dt:last-of-type, dl.row > dd:last-of-type { padding-bottom: 2px; }
dl.row > dt { font-weight: var(--fw-regular); color: var(--c-text-muted); font-size: var(--fs-sm); line-height: 1.6; }
dl.row > dd { color: var(--c-text-strong); min-width: 0; overflow-wrap: anywhere; }

/* ============== États « sélectionné » : plus de bleu Bootstrap par défaut ============== */
.btn-primary {
    --bs-btn-bg: var(--c-primary-600); --bs-btn-border-color: var(--c-primary-600);
    --bs-btn-hover-bg: var(--c-primary-700); --bs-btn-hover-border-color: var(--c-primary-700);
    --bs-btn-active-bg: var(--c-primary-800); --bs-btn-active-border-color: var(--c-primary-800);
    --bs-btn-disabled-bg: var(--c-primary-300); --bs-btn-disabled-border-color: var(--c-primary-300);
}
.btn-outline-primary {
    --bs-btn-color: var(--c-primary-700); --bs-btn-border-color: var(--c-primary-200);
    --bs-btn-hover-bg: var(--c-primary-50); --bs-btn-hover-color: var(--c-primary-800); --bs-btn-hover-border-color: var(--c-primary-300);
    --bs-btn-active-bg: var(--c-primary-600); --bs-btn-active-border-color: var(--c-primary-600); --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: var(--c-primary-300); --bs-btn-disabled-border-color: var(--c-primary-100);
}
.btn-check:checked + .btn-outline-primary, .btn-outline-primary.active, .btn-outline-primary.show {
    background: var(--c-primary-600); border-color: var(--c-primary-600); color: #fff;
}
.btn-outline-secondary {
    --bs-btn-active-bg: var(--c-gray-700); --bs-btn-active-border-color: var(--c-gray-700); --bs-btn-active-color: #fff;
}
.btn-check:checked + .btn-outline-secondary, .btn-outline-secondary.active {
    background: var(--c-gray-700); border-color: var(--c-gray-700); color: #fff;
}
.btn-link { --bs-btn-color: var(--c-primary-700); --bs-btn-hover-color: var(--c-primary-800); --bs-btn-active-color: var(--c-primary-800); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--c-primary-600); }
.nav { --bs-nav-link-color: var(--c-primary-700); --bs-nav-link-hover-color: var(--c-primary-800); }
.nav-tabs { --bs-nav-tabs-link-active-color: var(--c-text-strong); }
.pagination { --bs-pagination-color: var(--c-primary-700); --bs-pagination-hover-color: var(--c-primary-800); --bs-pagination-active-bg: var(--c-primary-600); --bs-pagination-active-border-color: var(--c-primary-600); --bs-pagination-focus-box-shadow: var(--shadow-focus); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--c-primary-600); --bs-dropdown-link-hover-bg: var(--c-gray-100); }
.list-group { --bs-list-group-active-bg: var(--c-primary-600); --bs-list-group-active-border-color: var(--c-primary-600); }
.form-range::-webkit-slider-thumb { background: var(--c-primary-600); }
.form-range::-moz-range-thumb { background: var(--c-primary-600); }

/* ============== Projets et tâches : quatre cadrans (templates/taches) ============== */
.taches-filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.taches-filtres__sep { width: 1px; height: 20px; background: var(--c-border); }
.taches-projet {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 11px;
    border: 1px solid var(--c-border); border-radius: var(--radius-pill);
    background: var(--c-surface); color: var(--c-gray-700);
    font-size: var(--fs-sm); text-decoration: none;
}
.taches-projet:hover { border-color: var(--c-gray-300); color: var(--c-text-strong); }
.taches-projet.is-active { background: var(--c-primary-100); border-color: var(--c-primary-200); color: var(--c-primary-800); font-weight: var(--fw-semibold); }
.taches-projet__barre { width: 44px; height: 5px; border-radius: var(--radius-pill); background: var(--c-gray-200); overflow: hidden; }
.taches-projet__barre > span { display: block; height: 100%; background: var(--c-success-500); }
.taches-projet__n { color: var(--c-text-muted); font-variant-numeric: tabular-nums; }

.cadrans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 767.98px) { .cadrans { grid-template-columns: minmax(0, 1fr); } }
.cadran {
    display: flex; flex-direction: column;
    min-height: 220px;
    background: var(--c-surface);
    border: 1px solid var(--c-border); border-radius: var(--radius-lg);
}
.cadran__tete { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.cadran__tile i { color: #fff; font-size: 0.85rem; line-height: 1; }
.cadran__titres { min-width: 0; flex: 1 1 auto; }
.cadran__titre { margin: 0; font-size: var(--fs-md); line-height: 1.25; }
.cadran__sous { color: var(--c-text-muted); font-size: var(--fs-xs); }
.cadran__n { color: var(--c-text-muted); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.cadran__liste { flex: 1 1 auto; list-style: none; margin: 0; padding: 4px 8px; min-height: 48px; border-radius: var(--radius-md); }
.cadran__liste.is-cible { background: var(--c-primary-50); }
.cadran__ajout { display: flex; gap: 6px; padding: 8px 10px 10px; }
.cadran__ajout .form-control { background: var(--c-gray-50); border-color: transparent; }
.cadran__ajout .form-control:focus { background: var(--c-surface); border-color: var(--c-primary-400); }

.tache {
    display: flex; align-items: flex-start; gap: 4px;
    padding: 4px 6px;
    border-top: 1px solid var(--c-divider);
    border-radius: var(--radius-sm);
    scroll-margin-top: 90px;
}
.tache:first-child { border-top-color: transparent; }
.tache[draggable="true"] { cursor: grab; }
.tache:hover { background: var(--c-gray-50); }
.tache.is-prise { opacity: 0.35; }
.tache:target { background: var(--c-primary-50); outline: 2px solid var(--c-primary-300); }
.tache__fait { flex: 0 0 auto; margin: 0; }
.tache__coche { width: 32px; height: 32px; border: 0; background: none; color: var(--c-gray-400); font-size: 1.1rem; line-height: 1; border-radius: 50%; cursor: pointer; }
.tache__coche:hover { color: var(--c-success-600); background: var(--c-success-50); }
.tache.is-faite .tache__coche { color: var(--c-success-600); }
.tache__corps { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 5px 2px; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; }
.tache__titre { color: var(--c-text-strong); font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.tache.is-faite .tache__titre { color: var(--c-text-muted); text-decoration: line-through; font-weight: var(--fw-regular); }
.tache__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--c-text-muted); font-size: var(--fs-xs); }
.tache__meta:empty { display: none; }
.tache__date.is-retard { color: var(--c-danger-600); font-weight: var(--fw-semibold); }
.tache__gens { display: flex; flex: 0 0 auto; padding-top: 5px; }
.tache__pers {
    width: 24px; height: 24px; margin-left: -5px;
    display: grid; place-items: center;
    border-radius: 50%; border: 2px solid var(--c-surface);
    background: var(--c-primary-100); color: var(--c-primary-800);
    font-size: 0.62rem; font-weight: var(--fw-semibold);
}
/* Le formulaire entoure l'en-tête, le corps et le pied de la fenêtre : il doit transmettre la hauteur
   pour que seul le corps défile et que « Enregistrer » reste visible. */
.tache-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.tache-form .modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 575.98px) {
    #tacheModal .modal-dialog { width: 100%; max-width: none; height: 100dvh; margin: 0; }
    #tacheModal .modal-content { border: 0; border-radius: 0; }
    /* Ouverture immédiate : l'animation saccade sur téléphone */
    #tacheModal.fade, #tacheModal.fade .modal-dialog { transition: none; transform: none; }
    #tacheModal .modal-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); flex-wrap: nowrap; }
}
.taches-choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.taches-choix .btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 6px 10px; }
.taches-choix .btn small { font-weight: var(--fw-regular); opacity: 0.8; }
.taches-gens { display: flex; flex-wrap: wrap; gap: 6px; }

/* Panneau « Noter l'appel » (guard.js) : flotte en bas à droite jusqu'à la réponse */
.isw-appel {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2090;
    width: min(340px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--c-surface);
    border: 1px solid var(--c-gray-200);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, .16));
}
.isw-appel__titre { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; font-weight: var(--fw-semibold); color: var(--c-gray-900); }
.isw-appel__close { background: none; border: 0; color: var(--c-gray-500); font-size: 1.2rem; line-height: 1; padding: 0 2px; }
.isw-appel__choix { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 767.98px) {
    .isw-appel { right: 16px; left: 16px; width: auto; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}
