/* ============================================================
   CheckList Manager — Design system
   Tokens + composants partagés par toutes les pages.
   Migré depuis le CSS inline de base.html, puis enrichi.
   ============================================================ */

:root {
    --bg: #eef3fc;
    --surface: #ffffff;
    --surface-soft: #f6f9ff;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-soft: #dbeafe;
    --border: #cbd8ee;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
    --focus-ring: #1d4ed8;
    --radius: 12px;
    --shell-bg: var(--bg);
    --shell-border: var(--border);
    --shell-text: var(--text);
    --shell-muted: var(--muted);
    --shell-accent: var(--primary);
    --shell-sidebar-width: 17.5rem;
    --shell-sidebar-bg: #0f2744;
    --shell-sidebar-text: #e2e8f0;
    --shell-sidebar-muted: #94a3b8;
    --shell-sidebar-hover: rgba(148, 163, 184, 0.14);
    --shell-sidebar-active: rgba(37, 99, 235, 0.28);

    /* États de tâches — source unique de vérité pour toute l'app */
    --state-todo: #b45309;
    --state-todo-bg: #fef3c7;
    --state-todo-border: #fcd34d;
    --state-in-progress: #0369a1;
    --state-in-progress-bg: #e0f2fe;
    --state-in-progress-border: #7dd3fc;
    --state-blocked: #b91c1c;
    --state-blocked-bg: #fee2e2;
    --state-blocked-border: #fca5a5;
    --state-info: #1d4ed8;
    --state-info-bg: #dbeafe;
    --state-info-border: #93c5fd;
    --state-done: #15803d;
    --state-done-bg: #dcfce7;
    --state-done-border: #86efac;
    --state-skipped: #475569;
    --state-skipped-bg: #f1f5f9;
    --state-skipped-border: #cbd5e1;
    --state-cancelled: #475569;
    --state-cancelled-bg: #f1f5f9;
    --state-cancelled-border: #cbd5e1;
}

body {
    background-color: var(--shell-bg);
    min-height: 100vh;
    color: var(--shell-text);
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}
a { color: var(--primary-dark); }
a:hover { color: var(--primary); }
.card {
    border-color: var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ------------------------------------------------------------
   Shell (sidebar / topbar / footer)
   ------------------------------------------------------------ */
.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}
.app-sidebar {
    width: var(--shell-sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, #0f2744 0%, #122847 100%);
    color: var(--shell-sidebar-text);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1.1rem 0.85rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 3.5rem;
}
.app-sidebar__brand:hover,
.app-sidebar__brand:focus {
    color: #fff;
}
.app-sidebar__brand-mark {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 0.65rem;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.app-sidebar__brand-text {
    min-width: 0;
    line-height: 1.15;
}
.app-sidebar__brand-text strong {
    display: block;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar__brand-text small {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.app-sidebar__section {
    padding: 0.85rem 0.75rem 0.5rem;
}
.app-sidebar__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 0.35rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--shell-sidebar-muted);
}
.app-sidebar__projects {
    max-height: min(52vh, 28rem);
    overflow-y: auto;
    margin-bottom: 0.35rem;
}
.app-project-block {
    margin-bottom: 0.15rem;
}
.app-project-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: #e2e8f0 !important;
    text-align: left;
    border-radius: 0.5rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.9rem;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}
.app-project-btn:hover,
.app-project-btn:focus {
    background: var(--shell-sidebar-hover);
    color: #fff !important;
}
.app-project-btn.is-active {
    background: var(--shell-sidebar-active);
    color: #fff !important;
    font-weight: 600;
}
.app-project-btn__dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #64748b;
    flex-shrink: 0;
}
.app-project-btn.is-active .app-project-btn__dot {
    background: #60a5fa;
}
.app-project-btn__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-sidebar__section--context {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    flex-shrink: 0;
}
.app-sidebar__section--context .app-sidebar__label span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #93c5fd;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.82rem;
    font-weight: 600;
}
.app-sidebar__subnav--panel {
    margin: 0;
    padding: 0.15rem 0 0.35rem;
    border-left: 0;
}
.app-sidebar__subnav {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin: 0.15rem 0 0.45rem 0.85rem;
    padding: 0.2rem 0 0.2rem 0.55rem;
    border-left: 2px solid rgba(96, 165, 250, 0.45);
}
.app-sidebar__sublink {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.4rem;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.88rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.app-sidebar__sublink:hover,
.app-sidebar__sublink:focus {
    background: var(--shell-sidebar-hover);
    color: #fff;
}
.app-sidebar__sublink.is-active {
    background: var(--shell-sidebar-active);
    color: #fff;
    font-weight: 600;
}
.app-sidebar__hint {
    padding: 0.35rem 0.55rem 0.65rem;
    font-size: 0.8rem;
    color: var(--shell-sidebar-muted);
}
.app-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.35rem 0.75rem 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    flex: 1;
}
.app-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    color: var(--shell-sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.app-sidebar__link:hover,
.app-sidebar__link:focus {
    background: var(--shell-sidebar-hover);
    color: #fff;
}
.app-sidebar__link.is-active {
    background: var(--shell-sidebar-active);
    color: #fff;
    font-weight: 600;
}
.app-sidebar__link.is-disabled {
    opacity: 0.42;
    pointer-events: none;
    cursor: not-allowed;
}
.app-sidebar__footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 0.8rem;
    color: var(--shell-sidebar-muted);
}
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.45rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--shell-border);
    box-shadow: 0 1px 10px rgba(15, 23, 42, 0.06);
}
.app-topbar__context {
    min-width: 0;
    color: var(--shell-muted);
    font-size: 0.88rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-topbar__context strong {
    color: var(--shell-text);
    font-weight: 600;
}
.app-topbar-instance {
    min-width: 0;
    max-width: min(28rem, 55vw);
}
.app-topbar-instance .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
    border: 1px solid var(--shell-border);
    background: #fff;
    color: var(--shell-text);
    border-radius: 0.5rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.app-topbar-instance .dropdown-toggle:hover,
.app-topbar-instance .dropdown-toggle:focus {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}
.app-topbar-instance .dropdown-toggle::after {
    margin-left: 0.15rem;
    flex-shrink: 0;
}
.app-topbar-instance__label {
    color: var(--shell-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.app-topbar-instance__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.app-topbar-instance__name.is-empty {
    color: #b45309;
    font-weight: 500;
}
.app-topbar-instance .dropdown-menu {
    min-width: min(22rem, 90vw);
    max-height: min(60vh, 24rem);
    overflow-y: auto;
}
.app-topbar-instance .dropdown-item form {
    margin: 0;
}
.app-topbar-instance .dropdown-item button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0;
    color: inherit;
    font: inherit;
}
.app-topbar-instance .dropdown-item.active,
.app-topbar-instance .dropdown-item:active {
    background-color: #e8eefc;
    color: #0f172a;
}
.app-topbar .nav-link {
    color: #334155;
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
}
.app-topbar .nav-link:hover,
.app-topbar .nav-link:focus,
.app-topbar .nav-link.active {
    color: #0f172a;
    background: #e8eefc;
}
.app-content {
    flex: 1;
}
.app-footer {
    border-top: 1px solid #cfdcf3;
    background: linear-gradient(135deg, #0b1220 0%, #111b2f 55%, #162441 100%);
    color: #e6edf8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.site-footer-inner {
    display: flex;
    gap: 1.1rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 0;
    flex-wrap: wrap;
}
.site-footer-brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    min-width: 0;
}
.site-footer-brand strong {
    font-size: 0.9rem;
    color: #fff;
}
.site-footer-brand p {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: #a5b7d6;
}
.site-footer-logo {
    height: 40px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
}
.site-footer-api {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.site-footer-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #cddbf4;
}
.site-footer-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.site-footer-links a {
    color: #dbeafe;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(147, 197, 253, 0.32);
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    background: rgba(30, 64, 175, 0.2);
}
.site-footer-links a:hover,
.site-footer-links a:focus {
    color: #fff;
    background: rgba(59, 130, 246, 0.28);
}
.app-footer-link {
    color: #dbeafe;
    text-decoration: none;
    font-size: 0.92rem;
    padding: 0.25rem 0.55rem;
    border-radius: 0.4rem;
}
.page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.page-title {
    font-size: 1.6rem;
    line-height: 1.25;
    font-weight: 600;
}
.page-actions .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
.card {
    border-radius: 0.6rem;
}
.card + .card {
    margin-top: 1rem;
}
@media (max-width: 991.98px) {
    .app-sidebar {
        display: none;
    }
    .offcanvas.app-sidebar-offcanvas {
        width: min(20rem, 88vw);
        background: var(--shell-sidebar-bg);
        color: var(--shell-sidebar-text);
    }
}
@media (min-width: 992px) {
    .app-sidebar-toggle {
        display: none !important;
    }
}
@media (max-width: 767.98px) {
    .page-header {
        margin-bottom: 1rem;
        padding-bottom: 0.4rem;
    }
    .page-title {
        font-size: 1.25rem;
        line-height: 1.25;
    }
    .page-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .page-actions .btn {
        min-height: 36px;
        padding: 0.375rem 0.65rem;
    }
    .page-actions .btn.btn-primary {
        min-width: 112px;
    }
    .breadcrumb {
        font-size: 0.78rem;
    }
}
/* Formulaires longs : action principale accessible en bas sur mobile */
@media (max-width: 767.98px) {
    .app-mobile-sticky-actions {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        margin-top: 1rem;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0));
        background: linear-gradient(180deg, rgba(245, 247, 251, 0) 0%, rgba(255, 255, 255, 0.97) 18%);
        border-top: 1px solid var(--shell-border);
        z-index: 1010;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Composants premium partagés
   ============================================================ */

/* --- En-tête de page contextuel --- */
.page-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.page-hero__overline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.3rem;
}
.page-hero__title {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
    margin: 0;
    overflow-wrap: anywhere;
}
.page-hero__badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.page-hero__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.page-hero__actions .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
@media (max-width: 767.98px) {
    .page-hero__title {
        font-size: 1.2rem;
    }
    .page-hero__actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* --- Pills d'état (source unique pour toute l'app) --- */
.state-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    white-space: nowrap;
}
.state-pill::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.state-pill--todo { color: var(--state-todo); background: var(--state-todo-bg); border-color: var(--state-todo-border); }
.state-pill--in_progress { color: var(--state-in-progress); background: var(--state-in-progress-bg); border-color: var(--state-in-progress-border); }
.state-pill--blocked { color: var(--state-blocked); background: var(--state-blocked-bg); border-color: var(--state-blocked-border); }
.state-pill--info { color: var(--state-info); background: var(--state-info-bg); border-color: var(--state-info-border); }
.state-pill--done { color: var(--state-done); background: var(--state-done-bg); border-color: var(--state-done-border); }
.state-pill--skipped { color: var(--state-skipped); background: var(--state-skipped-bg); border-color: var(--state-skipped-border); }
.state-pill--cancelled { color: var(--state-cancelled); background: var(--state-cancelled-bg); border-color: var(--state-cancelled-border); }

/* --- Sélecteur d'état (radios stylées en pills) --- */
.state-choice {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.state-choice .btn-check + .state-pill {
    cursor: pointer;
    opacity: 0.55;
    background: var(--surface);
    border-color: var(--border);
    color: var(--muted);
    transition: all 0.12s ease;
    user-select: none;
}
.state-choice .btn-check + .state-pill:hover {
    opacity: 0.85;
}
.state-choice .btn-check:focus-visible + .state-pill {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}
.state-choice .btn-check:checked + .state-pill--todo { opacity: 1; color: var(--state-todo); background: var(--state-todo-bg); border-color: var(--state-todo-border); }
.state-choice .btn-check:checked + .state-pill--in_progress { opacity: 1; color: var(--state-in-progress); background: var(--state-in-progress-bg); border-color: var(--state-in-progress-border); }
.state-choice .btn-check:checked + .state-pill--blocked { opacity: 1; color: var(--state-blocked); background: var(--state-blocked-bg); border-color: var(--state-blocked-border); }
.state-choice .btn-check:checked + .state-pill--info { opacity: 1; color: var(--state-info); background: var(--state-info-bg); border-color: var(--state-info-border); }
.state-choice .btn-check:checked + .state-pill--done { opacity: 1; color: var(--state-done); background: var(--state-done-bg); border-color: var(--state-done-border); }
.state-choice .btn-check:checked + .state-pill--skipped { opacity: 1; color: var(--state-skipped); background: var(--state-skipped-bg); border-color: var(--state-skipped-border); }
.state-choice .btn-check:checked + .state-pill--cancelled { opacity: 1; color: var(--state-cancelled); background: var(--state-cancelled-bg); border-color: var(--state-cancelled-border); }

/* --- Échelle de priorité 1-10 --- */
.priority-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.priority-scale .btn-check + .priority-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.4rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
}
.priority-scale .btn-check + .priority-dot:hover {
    border-color: var(--p-color, var(--primary));
    color: var(--p-color, var(--primary));
}
.priority-scale .btn-check:checked + .priority-dot {
    background: var(--p-color, var(--primary));
    border-color: var(--p-color, var(--primary));
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}
.priority-scale .btn-check:focus-visible + .priority-dot {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}
/* Dégradé P1 (critique) → P10 (faible) */
.priority-dot[data-p="1"] { --p-color: #b91c1c; }
.priority-dot[data-p="2"] { --p-color: #dc2626; }
.priority-dot[data-p="3"] { --p-color: #ea580c; }
.priority-dot[data-p="4"] { --p-color: #d97706; }
.priority-dot[data-p="5"] { --p-color: #ca8a04; }
.priority-dot[data-p="6"] { --p-color: #65a30d; }
.priority-dot[data-p="7"] { --p-color: #16a34a; }
.priority-dot[data-p="8"] { --p-color: #0d9488; }
.priority-dot[data-p="9"] { --p-color: #0284c7; }
.priority-dot[data-p="10"] { --p-color: #64748b; }

/* --- Panneau de propriétés (colonne latérale) --- */
.prop-panel {
    position: sticky;
    top: 4.25rem;
}
.prop-panel .card {
    border-radius: 14px;
}
.prop-group {
    padding: 1rem 1.15rem;
}
.prop-group + .prop-group {
    border-top: 1px solid #eef2fa;
}
.prop-group__label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.6rem;
}
.prop-group__label i {
    font-size: 0.85rem;
}
@media (max-width: 991.98px) {
    .prop-panel {
        position: static;
    }
}

/* --- Avatars à initiales --- */
.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}
.avatar-initials--sm {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.65rem;
}

/* --- Chips participants (checkboxes stylées) --- */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.chip-list .btn-check + .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.28rem 0.75rem 0.28rem 0.35rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
    max-width: 100%;
}
.chip-list .btn-check + .chip .chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chip-list .btn-check + .chip:hover {
    border-color: var(--primary);
}
.chip-list .btn-check + .chip .chip__tick {
    display: none;
    font-size: 0.8rem;
}
.chip-list .btn-check:checked + .chip {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 600;
}
.chip-list .btn-check:checked + .chip .chip__tick {
    display: inline;
}
.chip-list .btn-check:focus-visible + .chip {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}
.chip-list .btn-check:disabled + .chip {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Champ titre "document" --- */
.input-title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border: 1px solid transparent;
    border-radius: 0.55rem;
    padding: 0.45rem 0.65rem;
    background: transparent;
    transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}
.input-title:hover {
    background: var(--surface-soft);
}
.input-title:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}
.input-title::placeholder {
    color: #b6c2d9;
    font-weight: 500;
}

/* --- Cartes de section avec en-tête discret --- */
.section-card .card-header {
    background: transparent;
    border-bottom: 1px solid #eef2fa;
    padding: 0.85rem 1.25rem;
}
.section-card .card-header h2,
.section-card .card-header h6 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

/* --- Fil d'activité (notes) --- */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    position: relative;
}
.activity-item + .activity-item {
    border-top: 1px solid #f1f5fb;
}
.activity-item__body {
    min-width: 0;
    flex: 1;
}
.activity-item__meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}
.activity-item__author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.activity-item__date {
    font-size: 0.75rem;
    color: var(--muted);
}
.activity-item__content {
    font-size: 0.92rem;
    color: #1e293b;
    overflow-wrap: anywhere;
}

/* --- Métadonnées discrètes --- */
.meta-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0;
}
.meta-list i {
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}
.meta-list > div {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}
.meta-list strong {
    color: var(--text);
    font-weight: 600;
}

/* --- Chips de filtres (catégories, états…) --- */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.filter-chips__label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: 0.35rem;
    flex-shrink: 0;
}
.filter-chip {
    --chip-color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.26rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: all 0.12s ease;
    max-width: 100%;
}
.filter-chip:hover {
    border-color: var(--chip-color);
    color: var(--text);
}
.filter-chip__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--chip-color);
    flex-shrink: 0;
}
.filter-chip__count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid #e6edf9;
    border-radius: 999px;
    padding: 0.02rem 0.42rem;
    line-height: 1.35;
}
.filter-chip.is-active {
    background: var(--chip-color);
    border-color: var(--chip-color);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
}
.filter-chip.is-active .filter-chip__dot {
    background: #fff;
}
.filter-chip.is-active .filter-chip__count {
    background: rgba(255, 255, 255, 0.22);
    border-color: transparent;
    color: #fff;
}
/* Variantes couleur par état de tâche */
.filter-chip--open { --chip-color: #7c3aed; } /* "Reste à faire" : todo + en cours + bloquées */
.filter-chip--todo { --chip-color: var(--state-todo); }
.filter-chip--in_progress { --chip-color: var(--state-in-progress); }
.filter-chip--info { --chip-color: var(--state-info); }
.filter-chip--done { --chip-color: var(--state-done); }
.filter-chip--dark { --chip-color: #0f172a; }

/* --- Variante compacte des pills d'état (listes denses) --- */
.state-pill--sm {
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    gap: 0.28rem;
}
.state-pill--sm::before {
    width: 0.38rem;
    height: 0.38rem;
}

/* --- Badge catégorie coloré (arbre, listes) --- */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.14rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    white-space: nowrap;
}

/* --- Chip participant assigné (lecture seule) --- */
.assignee-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.08rem 0.55rem 0.08rem 0.12rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
    cursor: pointer;
    transition: border-color 0.12s ease;
}
.assignee-chip:hover {
    border-color: var(--primary);
}
.assignee-chip .avatar-initials {
    width: 1.15rem;
    height: 1.15rem;
    font-size: 0.55rem;
}

/* --- Petits badges d'échéance --- */
.due-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.5;
    background: var(--surface-soft);
    border: 1px solid #e6edf9;
    color: var(--muted);
    white-space: nowrap;
}
.due-badge--late {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

/* --- Tuiles de statistiques (dashboard) --- */
.stat-tile {
    --tile-color: var(--primary);
    --tile-bg: var(--primary-soft);
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.1rem;
    height: 100%;
}
.stat-tile__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 12px;
    background: var(--tile-bg);
    color: var(--tile-color);
    font-size: 1.35rem;
    flex-shrink: 0;
}
.stat-tile__value {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
}
.stat-tile__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}
.stat-tile__sub {
    font-size: 0.72rem;
    color: var(--muted);
}
.stat-tile--warning { --tile-color: var(--state-todo); --tile-bg: var(--state-todo-bg); }
.stat-tile--danger { --tile-color: var(--state-blocked); --tile-bg: var(--state-blocked-bg); }
.stat-tile--success { --tile-color: var(--state-done); --tile-bg: var(--state-done-bg); }

/* --- Cartes participants --- */
.participant-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1rem;
    min-width: 0;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.participant-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}
.participant-card__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.participant-card__name {
    display: block;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
a.participant-card__name:hover {
    color: var(--primary);
}
.participant-card__meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--muted);
    min-width: 0;
}
.participant-card__progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.participant-card__count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}
.participant-card__cats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}
.avatar-initials--lg {
    width: 2.3rem;
    height: 2.3rem;
    font-size: 0.95rem;
}

/* --- Barre de progression fine --- */
.progress-slim {
    flex-grow: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--surface-soft);
    border: 1px solid #e6edf9;
    overflow: hidden;
}
.progress-slim__bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--state-done));
}

/* --- Journal d'audit --- */
.audit-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.14rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    background: #e5e7eb;
    color: #374151;
}
.audit-pill--create { background: #dcfce7; color: #166534; }
.audit-pill--update { background: #dbeafe; color: #1e40af; }
.audit-pill--delete { background: #fee2e2; color: #991b1b; }
.audit-pill--auth { background: #fef9c3; color: #854d0e; }
.audit-table {
    font-size: 0.85rem;
}
.audit-table td {
    vertical-align: top;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}
.audit-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom-color: var(--border);
}
.audit-date {
    white-space: nowrap;
    font-weight: 600;
    color: var(--text);
}
.audit-date small {
    display: block;
    font-weight: 400;
    color: var(--muted);
}
.audit-actor {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    max-width: 14rem;
}
.audit-actor span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audit-details {
    max-width: 480px;
    overflow-wrap: anywhere;
}
.audit-json summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.72rem;
}
.audit-json summary:hover {
    color: var(--primary);
}
.audit-json code {
    display: block;
    font-size: 0.72rem;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface-soft);
    border: 1px solid #e6edf9;
    border-radius: 6px;
    padding: 6px 8px;
    margin-top: 4px;
    color: var(--text);
}
button.filter-chip {
    cursor: pointer;
}

/* --- Indicateur de modifications non enregistrées --- */
.unsaved-dot {
    display: none;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
    flex-shrink: 0;
}
form.is-dirty .unsaved-dot {
    display: inline-block;
}
