/* ==========================================================================
   Chronos — Accueil : tableaux de tâches (cartes par projet)
   Les couleurs choisies par l'utilisateur (niveaux, en-têtes, bordures de
   projet, fond d'écran) restent prioritaires : on ne touche qu'à la forme.
   ========================================================================== */

/* #content était un conteneur de défilement « vide » : il empêchait la barre d'outils collante. */
#content { overflow: visible !important; }

.home {
    --h-surface: rgba(20, 21, 24, 0.78);
    --h-line: rgba(255, 255, 255, 0.09);
    --h-muted: #9aa1ad;
    --h-faint: #6b7280;
    --h-accent: #7aa7ff;
    padding-top: 0 !important;
}

/* ---------- Barre d'outils collante ------------------------------------- */

.home-toolbar {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 -24px 6px;
    padding: 14px 24px 12px;
    background: linear-gradient(to bottom, rgba(12, 13, 16, 0.86), rgba(12, 13, 16, 0.62));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--h-line);
}

/* ---------- Ajout rapide + résumé --------------------------------------- */

.home-quick { display: flex; align-items: center; gap: 16px; margin: 14px 0 6px; flex-wrap: wrap; }

.quick-add {
    flex: 1 1 420px;
    max-width: 760px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 8px 0 14px;
    color: var(--text-light);
    background-color: var(--h-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--h-line);
    border-radius: 14px;
    box-shadow: 0 10px 26px -16px rgba(0, 0, 0, 0.8);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.quick-add:focus-within { border-color: var(--h-accent); box-shadow: 0 0 0 3px rgba(122, 167, 255, 0.2), 0 10px 26px -16px rgba(0, 0, 0, 0.8); }
.quick-add-icon { font-size: 20px; color: var(--h-accent); flex-shrink: 0; }
.quick-add input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 100%;
    font-size: 14.5px;
    color: inherit;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none;
}
.quick-add input::placeholder { color: var(--h-faint); }
.quick-add select {
    max-width: 170px;
    height: 30px;
    padding: 0 8px;
    font-size: 12.5px;
    color: var(--h-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid transparent;
    border-radius: 8px;
    color-scheme: dark;
    cursor: pointer;
}
.quick-add select:hover, .quick-add select:focus { color: #fff; border-color: var(--h-line); outline: none; }
.quick-add-hint { flex-shrink: 0; }
.quick-add:focus-within .quick-add-hint { display: none; }
.quick-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    font-size: 16px;
    color: #0b1220;
    background: var(--h-accent);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 0.15s ease, transform 0.1s ease;
}
.quick-add:focus-within .quick-add-btn { opacity: 1; }
.quick-add-btn:active { transform: scale(0.94); }

.home-stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.home-stats .stat {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 12px;
    font-size: 12.5px;
    color: var(--h-muted);
    background: var(--h-surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--h-line);
    border-radius: 999px;
}
.home-stats .stat b { color: #fff; font-weight: 700; }
.home-stats .dot { width: 7px; height: 7px; border-radius: 50%; }
.home-stats .dot-run { background: #60a5fa; }
.home-stats .dot-done { background: #34d399; }
.home-stats .stat-late { color: #fecaca; border-color: rgba(248, 113, 113, 0.45); background: rgba(127, 29, 29, 0.35); }

/* ==========================================================================
   Tableaux — identité « typographique »
   Plus de cartes ni de colonnes titrées : chaque projet est une section
   aérée (grand titre + liseré à la couleur du projet) et chaque tâche une
   ligne dont l'icône de statut ouvre la marche. La mise en page repose sur
   la position des cellules (1 poignée, 2 nom, 3 catégorie, 4 statut,
   5 progression, 6 priorité, 7 début, 8 fin, 9 échéance, 10 actions), ce
   qui garde le HTML et le JavaScript existants intacts.
   ========================================================================== */

/* Une seule « feuille » de verre sous toutes les sections : lisible sur n'importe quel fond d'écran */
#tasks-container {
    margin-top: 14px;
    padding: 24px 22px 4px;
    background: rgba(11, 12, 15, 0.62);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 22px;
    box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9);
}
#tasks-container:empty { display: none; }

/* ---------- Sections ---------------------------------------------------- */

#tasks-container .table_div {
    position: relative;
    margin: 0 0 30px;
    padding: 0;
    overflow: visible;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none !important;
    border-radius: 0;
    box-shadow: none;
}
#tasks-container .table_div:hover { background: none; }
.table_div::before { content: none; }

/* « Tâches sans projet » : pas de titre à l'accueil ; il n'apparaît que pendant le glisser-déposer
   des sections, pour qu'on reconnaisse le bloc quand tout est replié */
#tasks-container.sections-dragging #standalone_table::before {
    content: "Sans projet";
    display: block;
    padding: 0 14px 12px;
    margin-bottom: 4px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
    border-bottom: 1px solid color-mix(in srgb, var(--card-accent, rgba(255, 255, 255, 0.4)) 45%, transparent);
}

/* ---------- Tableau → lignes flexibles ----------------------------------- */

.task-table, .task-table tbody { display: block; width: 100%; }
.task-table colgroup, .task-table thead { display: none !important; }

.task-table tbody tr:not(.hidden):not(.filter-hidden) {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 10px 0 14px;
    border: none !important;
    border-radius: 10px;
    background: transparent !important;
    transition: background-color 0.12s ease;
}
.task-table tbody tr:not(.hidden):not(.filter-hidden):hover { background: rgba(255, 255, 255, 0.055) !important; }
.task-table tbody tr.task-drop-hover { box-shadow: inset 0 2px 0 0 var(--accent-primary); }
.task-table tbody td, .task-table tbody td.align-top {
    padding: 0 !important;
    border: none;
    box-shadow: none !important;
    vertical-align: middle;
    font-size: 13px;
    color: #c5cad4;
}

/* Colonnes (les cellules masquées par les réglages sont display:none et n'occupent rien) */
.task-table tbody td:nth-child(1) { position: absolute; left: -2px; top: 50%; width: 14px; transform: translateY(-50%); }
.task-table tbody td:nth-child(2) { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; padding-right: 12px !important; }
.task-table tbody td:nth-child(3) { flex: 0 0 120px; font-size: 12px; color: var(--h-faint); }
.task-table tbody td:nth-child(4) { flex: 0 0 142px; display: flex; justify-content: flex-start; }
.task-table tbody td:nth-child(5) { flex: 0 0 150px; }
.task-table tbody td:nth-child(6) { flex: 0 0 124px; display: flex; justify-content: flex-start; }
.task-table tbody td:nth-child(7),
.task-table tbody td:nth-child(8) { flex: 0 0 100px; text-align: right; color: var(--h-muted); font-size: 12.5px; }
.task-table tbody td:nth-child(9) { flex: 0 0 116px; text-align: right; font-size: 12.5px; }
.task-table tbody td:nth-child(10) { flex: 0 0 70px; text-align: right; }

/* Indentation par niveau */
.task-table tr.task-line[class*="child-of-project"] > td:nth-child(2) { padding-left: 4px !important; }
.task-table tr.subtask-line > td:nth-child(2) { padding-left: 34px !important; }

/* ---------- Colonne « nom » --------------------------------------------- */

.task-table td:nth-child(2) > div:first-child { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.task-table td:nth-child(2) > div:not(:first-child) { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; margin: 0 !important; padding: 0 !important; }
.task-table td:nth-child(2) .space-y-1 > * { margin: 0 !important; }
.task-table .task-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-table .task-line .task-title { font-size: 0.9rem; font-weight: 500; color: #e6e9ef; }
.task-table .subtask-line .task-title { font-size: 0.85rem; font-weight: 500; color: #c2c8d3; }
.task-table tr.task-line:has(.status_done) .task-title,
.task-table tr.subtask-line:has(.status_done) .task-title,
.task-table tr.task-line:has(.status_archived) .task-title,
.task-table tr.subtask-line:has(.status_archived) .task-title { color: #7f8797; }
.table-icon-emoji, .table-icon-image { transform: scale(0.9); }
.task-table .extra-vars { color: var(--h-faint); white-space: nowrap; }

.task-table .toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-right: 4px;
    color: var(--h-faint);
    border-radius: 6px;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.task-table .toggle-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
/* Même emprise que le chevron (22 px + 4 px de marge) pour aligner tâches simples et tâches parentes */
.task-table .task-toggle-area > span.mr-5 { display: inline-block; width: 26px; margin-right: 0 !important; flex-shrink: 0; }
.task-table tr.subtask-line td:nth-child(2) > div:first-child > span.mr-5 { display: inline-block; width: 26px; margin-right: 0 !important; flex-shrink: 0; }

/* Outils de ligne : flottent à droite au survol */
.row-tools {
    position: absolute;
    right: 8px;
    top: 50%;
    z-index: 4;
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    transform: translateY(-50%);
    background: rgba(24, 25, 29, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}
tr:hover .row-tools, .row-tools:focus-within { opacity: 1; pointer-events: auto; }
.row-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 15px;
    color: var(--h-muted);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.row-tool:hover { color: #fff; background: rgba(122, 167, 255, 0.3); }
.row-tool.row-run { color: #86efac; }
.row-tool.row-run:hover { color: #fff; background: rgba(52, 211, 153, 0.35); }
.row-tool.is-busy { cursor: progress; opacity: 0.7; }
.row-tool.is-busy i { animation: rowSpin 0.8s linear infinite; }
@keyframes rowSpin { to { transform: rotate(360deg); } }

/* ---------- En-tête de section (ligne projet) ---------------------------- */

#tasks-container .task-table tbody tr.project-line:not(.hidden):not(.filter-hidden) {
    min-height: 58px;
    margin-bottom: 4px;
    padding-top: 2px;
    border-radius: 0 !important;
    border-bottom: 1px solid color-mix(in srgb, var(--card-accent, rgba(255, 255, 255, 0.4)) 45%, transparent) !important;
    cursor: pointer;
}
#tasks-container .task-table tbody tr.project-line:not(.hidden):not(.filter-hidden):hover { background: rgba(255, 255, 255, 0.035) !important; }
.task-table .project-line .task-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.012em; color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6); }
.task-table .project-line .task-title[data-count]::after {
    content: attr(data-count);
    margin-left: 12px;
    padding: 0 9px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 20px;
    letter-spacing: 0;
    text-shadow: none;
    color: var(--h-muted);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}
.task-table .project-line .toggle-btn { width: 26px; height: 26px; color: var(--h-muted); }
.task-table .project-line .progress-ring { flex-basis: 96px; width: 96px; height: 8px; }
.task-table .project-line .progress-pct { font-size: 13px; }
.task-table .project-line td:nth-child(9) { font-size: 13px; }

/* ---------- Statut & priorité : icône + libellé -------------------------- */

.task-table .status-cell, .task-table .priority-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 3px 9px 3px 6px !important;
    font-size: 13px !important;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    color: #d8dce4 !important;
    background: transparent !important;
    border-radius: 9px;
    transition: background-color 0.12s ease;
}
.task-table button.toggle-dropdown:hover { background: rgba(255, 255, 255, 0.1) !important; box-shadow: none; }
.task-table .priority_urgent { color: #fecaca !important; font-weight: 600; }
.task-table .priority_off { color: var(--h-faint) !important; }
.task-table .status_archived { color: #8a93a3 !important; }

/* Dans les menus déroulants et les filtres : icône + libellé */
.dropdown-menu .status-cell, .dropdown-menu .priority-cell,
div[id^="filter-"][id$="-dropdown"] .status-cell, div[id^="filter-"][id$="-dropdown"] .priority-cell {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 3px 9px 3px 7px !important;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    color: #d8dce4 !important;
    background: transparent !important;
    border-radius: 8px;
}

.status-cell::before, .priority-cell::before { content: ""; flex-shrink: 0; width: 16px; height: 16px; box-sizing: border-box; }

.status-cell { --tone: #94a3b8; }
.status-cell::before { border: 2px solid var(--tone); border-radius: 50%; }
.status_not_started { --tone: #8b95a7; }
.status_in_progress { --tone: #60a5fa; }
.status_in_progress::before { background: conic-gradient(var(--tone) 0 50%, transparent 0); }
.status_is_waiting { --tone: #facc15; }
.status_is_waiting::before { border-style: dashed; }
.status_is_validation { --tone: #c084fc; }
.status_is_validation::before { background: conic-gradient(var(--tone) 0 75%, transparent 0); }
.status_wait { --tone: #fb923c; }
.status_wait::before { background: linear-gradient(90deg, transparent 3px, var(--tone) 3px 5px, transparent 5px 7px, var(--tone) 7px 9px, transparent 9px); }
.status_done { --tone: #34d399; }
.status_done::before { content: "\2713"; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 900; line-height: 1; color: #06281c; background: var(--tone); }
.status_archived { --tone: #6b7280; }
.status_archived::before { background: radial-gradient(var(--tone) 0 2.5px, transparent 3px); }

.priority-cell { --tone: #60a5fa; --b1: var(--tone); --b2: rgba(255, 255, 255, 0.18); --b3: rgba(255, 255, 255, 0.18); }
.priority-cell::before {
    width: 14px;
    height: 14px;
    background:
        linear-gradient(var(--b1), var(--b1)) 0 100% / 3px 5px no-repeat,
        linear-gradient(var(--b2), var(--b2)) 5.5px 100% / 3px 9px no-repeat,
        linear-gradient(var(--b3), var(--b3)) 11px 100% / 3px 14px no-repeat;
    border-radius: 1px;
}
.priority_off { color: var(--h-faint); }
.priority_off::before { width: 10px; height: 2px; background: rgba(255, 255, 255, 0.25); border-radius: 1px; }
.priority_bas { --tone: #34d399; }
.priority_moyen { --tone: #60a5fa; --b2: var(--tone); }
.priority_haut { --tone: #fb923c; --b2: var(--tone); --b3: var(--tone); }
.priority_urgent { --tone: #f87171; --b2: var(--tone); --b3: var(--tone); }

/* ---------- Progression : barre --------------------------------------- */

.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-ring {
    flex: 0 0 84px;
    width: 84px;
    height: 6px;
    border-radius: 999px;
    background:
        linear-gradient(90deg, var(--fill-a, #3b82f6), var(--fill-b, #10b981)) 0 0 / calc(var(--p) * 1%) 100% no-repeat,
        rgba(255, 255, 255, 0.12);
    transition: background-size 0.4s ease;
}
.progress-wrap[style*="--p: 100"] .progress-ring { --fill-a: #10b981; --fill-b: #34d399; }
.progress-pct { min-width: 32px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--h-muted); }

/* ---------- Échéances ---------------------------------------------------- */

.task-table td.is-overdue, .task-table td.is-soon { font-weight: 600; }
.task-table td.is-overdue { color: #ff8b8b !important; }
.task-table td.is-soon { color: #ffc95c !important; }
.task-table td.is-overdue::before, .task-table td.is-soon::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    vertical-align: 1px;
    background: currentColor;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

/* ---------- Tags --------------------------------------------------------- */

.task-table .bg-blue-100 {
    padding: 0 8px !important;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    color: #a9c5ff !important;
    background-color: rgba(122, 167, 255, 0.12) !important;
    border: none;
}

/* ---------- Mode compact ------------------------------------------------- */

body.dense .task-table tbody tr:not(.hidden):not(.filter-hidden) { min-height: 33px; }
body.dense #tasks-container .task-table tbody tr.project-line:not(.hidden):not(.filter-hidden) { min-height: 46px; }
body.dense .task-table .project-line .task-title { font-size: 1.12rem; }
body.dense .task-table .task-line .task-title { font-size: 0.85rem; }
body.dense #tasks-container .table_div { margin-bottom: 18px; }
body.dense .task-table .status-cell, body.dense .task-table .priority-cell { padding: 1px 8px 1px 5px !important; }
body.dense #density-btn { color: var(--h-accent); border-color: rgba(122, 167, 255, 0.5); }

/* ---------- Écrans étroits ---------------------------------------------- */

@media (max-width: 1250px) {
    .task-table tbody td:nth-child(3), .task-table tbody td:nth-child(7), .task-table tbody td:nth-child(8) { display: none; }
}
@media (max-width: 1100px) {
    .task-table tbody td:nth-child(5) { flex-basis: 60px; }
    .task-table .progress-ring { display: none; }
}
@media (max-width: 900px) {
    .home-toolbar { position: static; margin: 0; padding: 0 0 10px; background: none; backdrop-filter: none; border: none; }
    .home-stats { margin-left: 0; }
    .task-table tbody td:nth-child(5), .task-table tbody td:nth-child(10) { display: none; }
}

/* Sans priorité : le libellé « — » suffit, pas de double tiret */
.task-table .priority_off::before { display: none; }

/* ---------- Sélecteur de projet de la barre d'ajout ---------------------- */

.qa-select { position: relative; flex-shrink: 0; }
.qa-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    max-width: 210px;
    padding: 0 8px 0 10px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--h-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.qa-select-btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-select-btn:hover, .qa-select-btn[aria-expanded="true"] { color: #fff; background: rgba(255, 255, 255, 0.11); border-color: var(--h-line); }
.qa-select-btn i { font-size: 15px; flex-shrink: 0; }
.qa-chevron { opacity: 0.6; }

.qa-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 60;
    width: max-content;
    min-width: 220px;
    max-width: 320px;
    max-height: min(340px, 60vh);
    overflow-y: auto;
    padding: 6px;
    background: rgba(23, 24, 28, 0.97);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 14px;
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.6);
    animation: uxMenuIn 0.12s var(--ux-ease);
    transform-origin: top right;
}
.qa-menu[hidden] { display: none; }
.qa-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13.5px;
    font-family: inherit;
    text-align: left;
    color: #e3e6ec;
    background: none;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    outline: none;
    transition: background-color 0.1s ease;
}
.qa-option:hover, .qa-option:focus-visible { background: rgba(122, 167, 255, 0.16); color: #fff; }
.qa-option.is-on { color: #fff; font-weight: 600; }
.qa-option.is-on::after { content: "\2713"; margin-left: auto; color: var(--h-accent); font-weight: 700; }
.qa-option-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; font-size: 16px; color: var(--h-muted); }
.qa-option-icon .table-icon-emoji, .qa-option-icon .table-icon-image { transform: none; width: 18px; height: 18px; font-size: 15px; line-height: 18px; }

/* ---------- Glisser-déposer des sections --------------------------------- */

.section-grip {
    position: absolute;
    left: -21px;
    top: 14px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 30px;
    font-size: 17px;
    color: var(--h-muted);
    background: none;
    border: none;
    border-radius: 7px;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}
#standalone_table > .section-grip { top: 0; }
.table_div:hover > .section-grip, .section-grip:focus-visible { opacity: 0.7; }
.section-grip:hover { opacity: 1 !important; color: #fff; background: rgba(255, 255, 255, 0.1); }
.section-grip:active { cursor: grabbing; }
.section-grip i { pointer-events: none; }

/* Pendant le glisser : toutes les sections se replient sur leur en-tête */
#tasks-container.sections-dragging .table_div tbody tr:not(.project-line) { display: none !important; }
#tasks-container.sections-dragging #standalone_table tbody { display: none; }
#tasks-container.sections-dragging .table_div { margin-bottom: 8px; cursor: grabbing; }
#tasks-container.sections-dragging .row-tools { display: none; }
#tasks-container.sections-dragging .table_div.is-dragged {
    opacity: 0.55;
    background: rgba(122, 167, 255, 0.1);
    outline: 1px dashed rgba(122, 167, 255, 0.6);
    outline-offset: 2px;
    border-radius: 12px;
}
#tasks-container.sections-dragging #standalone_table::before { margin-bottom: 0; padding-bottom: 10px; }

.section-drag-ghost {
    position: fixed;
    left: -1000px;
    top: -1000px;
    padding: 9px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: #2a3550;
    border: 1px solid rgba(122, 167, 255, 0.6);
    border-radius: 10px;
    white-space: nowrap;
}

/* La barre d'ajout passe au-dessus de la feuille des tableaux (sinon son menu s'ouvre dessous) mais sous la barre d'outils collante */
.home-quick { position: relative; z-index: 20; }

/* ---------- Afficher / masquer des tableaux (affichage seulement) --------- */

#tasks-container .table_div.is-hidden-section { display: none; }

.hidden-wrap { position: relative; }
#hidden-tables-btn { position: relative; }
#hidden-tables-btn i { font-size: 17px; }
#hidden-tables-btn.has-hidden { color: #ffd98a; border-color: rgba(245, 185, 74, 0.5); }
.toolbar-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    color: #1b1300;
    background: #f5b94a;
    border-radius: 999px;
}
.toolbar-badge[hidden] { display: none; }

.hidden-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 60;
    width: 300px;
    max-height: min(440px, 70vh);
    overflow-y: auto;
    padding: 8px;
    background: rgba(23, 24, 28, 0.97);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 14px;
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.6);
    animation: uxMenuIn 0.12s var(--ux-ease);
    transform-origin: top right;
}
.hidden-menu[hidden] { display: none; }

.vis-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 8px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #7d8596;
}
.vis-all {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    font-family: inherit;
    color: var(--h-accent);
    background: none;
    border: none;
    cursor: pointer;
}
.vis-all:hover:not(:disabled) { text-decoration: underline; }
.vis-all:disabled { color: var(--h-faint); cursor: default; }

.vis-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    font-family: inherit;
    text-align: left;
    color: #e3e6ec;
    background: none;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: background-color 0.1s ease;
}
.vis-row:hover { background: rgba(255, 255, 255, 0.06); }
.vis-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.vis-row.is-off .vis-name { color: #7d8596; }

.vis-switch {
    position: relative;
    flex-shrink: 0;
    width: 30px;
    height: 18px;
    background: var(--h-accent);
    border-radius: 999px;
    transition: background-color 0.15s ease;
}
.vis-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 14px;
    width: 14px;
    height: 14px;
    background: #0b1220;
    border-radius: 50%;
    transition: left 0.15s ease, background-color 0.15s ease;
}
.vis-row.is-off .vis-switch { background: rgba(255, 255, 255, 0.16); }
.vis-row.is-off .vis-switch::after { left: 2px; background: #9aa1ad; }

.vis-note { margin: 8px 8px 4px; padding-top: 8px; font-size: 11.5px; line-height: 1.4; color: var(--h-faint); border-top: 1px solid rgba(255, 255, 255, 0.07); }

/* ---------- Répartition par statut (survol de « N tâches ») -------------- */

.home-stats .stat-total { cursor: help; transition: border-color 0.12s ease, background-color 0.12s ease; }
.home-stats .stat-total:hover, .home-stats .stat-total:focus-visible { border-color: rgba(122, 167, 255, 0.55); background: rgba(122, 167, 255, 0.12); }
.status-pop { position: fixed; z-index: 10060; min-width: 380px; padding: 12px 14px 10px; color: #e6e9ef; background: rgba(23, 24, 28, 0.97); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px; box-shadow: 0 22px 54px rgba(0, 0, 0, 0.6); pointer-events: none; animation: uxMenuIn 0.12s ease; }
.sp-title { margin-bottom: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #7d8596; }
.sp-row { display: grid; grid-template-columns: 138px minmax(0, 1fr) 30px 40px; align-items: center; gap: 10px; min-height: 28px; }
.sp-row .status-cell { display: inline-flex !important; align-items: center; gap: 8px; padding: 0 !important; font-size: 13px !important; font-weight: 500; white-space: nowrap; color: #d8dce4 !important; background: transparent !important; }
.sp-bar { height: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.09); border-radius: 99px; }
.sp-bar i { display: block; height: 100%; background: var(--tone, #60a5fa); border-radius: 99px; }
.sp-row:has(.status_not_started) .sp-bar i { background: #8b95a7; }
.sp-row:has(.status_in_progress) .sp-bar i { background: #60a5fa; }
.sp-row:has(.status_is_waiting) .sp-bar i { background: #facc15; }
.sp-row:has(.status_done) .sp-bar i { background: #34d399; }
.sp-row:has(.status_is_validation) .sp-bar i { background: #c084fc; }
.sp-row:has(.status_wait) .sp-bar i { background: #fb923c; }
.sp-row:has(.status_archived) .sp-bar i { background: #6b7280; }
.sp-n { text-align: right; font-variant-numeric: tabular-nums; }
.sp-pct { text-align: right; font-size: 11.5px; color: #7d8596; font-variant-numeric: tabular-nums; }
.sp-foot { margin-top: 8px; padding-top: 8px; font-size: 11.5px; color: #6b7280; border-top: 1px solid rgba(255, 255, 255, 0.07); }

/* ==========================================================================
   En-tête de l'accueil, version discrète
   Boutons « fantômes » (sans fond ni cadre au repos), un seul trait de séparation avec le contenu.
   Les couleurs de boutons personnalisées (menu_btn_*) ne s'appliquent plus ici : l'en-tête reste neutre.
   ========================================================================== */

.home .home-toolbar {
    margin: 0 -24px 0;
    padding: 8px 24px 8px;
    gap: 2px 4px;
    align-items: center;
    background: rgba(12, 13, 16, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* filtres : du texte, pas des boutons */
.home .home-toolbar .filter-button {
    height: 28px;
    gap: 5px;
    padding: 0 9px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--h-muted) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 8px;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none;
}
.home .home-toolbar .filter-button:hover { color: #fff !important; background: rgba(255, 255, 255, 0.07) !important; border-color: transparent !important; }
.home .home-toolbar .filter-button .filter-chevron { font-size: 14px; margin-left: 0; opacity: 0.4; }
.home .home-toolbar .filter-button.has-active-filter { color: #fff !important; background: rgba(122, 167, 255, 0.14) !important; }
.home .home-toolbar .filter-button.has-active-filter .filter-chevron { opacity: 0.7; }
.home .home-toolbar .filter-count { min-width: 16px; height: 16px; padding: 0 4px; font-size: 10.5px; line-height: 16px; background: var(--h-accent); color: #0b1220; }
.home .home-toolbar .filter-reset { color: #fca5a5 !important; background: transparent !important; border-color: transparent !important; }
.home .home-toolbar .filter-reset:hover { background: rgba(248, 113, 113, 0.14) !important; }

/* recherche : une loupe qui s'ouvre au clic */
.home .home-toolbar .toolbar-search {
    width: 132px;
    height: 28px;
    padding: 0 8px;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 8px;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    transition: width 0.18s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.home .home-toolbar .toolbar-search:hover { background: rgba(255, 255, 255, 0.06) !important; }
.home .home-toolbar .toolbar-search:focus-within { width: 230px; background: rgba(255, 255, 255, 0.07) !important; border-color: rgba(122, 167, 255, 0.55) !important; box-shadow: none; }
.home .home-toolbar .toolbar-search input { font-size: 12.5px; }
.home .home-toolbar .toolbar-search > i { font-size: 14px; }
.home .home-toolbar .toolbar-search-hint { opacity: 0.5; }

/* séparateur fin entre la recherche et les filtres */
.home .home-toolbar .toolbar-search + .relative { margin-left: 2px; }

/* actions à droite : icônes seules */
.home .home-toolbar .toolbar-btn {
    height: 28px;
    min-width: 28px;
    padding: 0 6px;
    color: var(--h-muted) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 8px;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
.home .home-toolbar .toolbar-btn:hover { color: #fff !important; background: rgba(255, 255, 255, 0.08) !important; }
.home .home-toolbar .toolbar-btn svg { width: 16px; height: 16px; }
.home .home-toolbar .toolbar-btn i { font-size: 15px; }
.home .home-toolbar #hidden-tables-btn.has-hidden { color: #ffd98a !important; }
.home .home-toolbar .toolbar-btn-primary { padding: 0 10px 0 8px; color: var(--h-text, #e6e9ef) !important; background: rgba(255, 255, 255, 0.07) !important; }
.home .home-toolbar .toolbar-btn-primary:hover { background: rgba(122, 167, 255, 0.22) !important; }
.home .home-toolbar .toolbar-btn-label { font-size: 12.5px; }
.home .home-toolbar .toolbar-badge { top: -3px; right: -3px; }

/* menus déroulants des icônes : on garde le style sombre commun */
.home .home-toolbar .toolbar-menu { margin-top: 6px; }



/* ==========================================================================
   Sous-menus de l'en-tête (Nouveau / Scripts / Policies) + en-tête un peu plus présent
   ========================================================================== */

/* barre : un peu plus de présence */
.home .home-toolbar { background: rgba(14, 15, 19, 0.72); border-bottom-color: rgba(255, 255, 255, 0.08); padding: 10px 24px; }
.home .home-toolbar .filter-button { color: #c3c9d4 !important; background: rgba(255, 255, 255, 0.045) !important; border-color: rgba(255, 255, 255, 0.07) !important; }
.home .home-toolbar .filter-button:hover { background: rgba(255, 255, 255, 0.1) !important; border-color: rgba(255, 255, 255, 0.14) !important; }
.home .home-toolbar .filter-button.has-active-filter { background: rgba(122, 167, 255, 0.18) !important; border-color: rgba(122, 167, 255, 0.45) !important; }
.home .home-toolbar .toolbar-search { background: rgba(255, 255, 255, 0.045) !important; border-color: rgba(255, 255, 255, 0.07) !important; }
.home .home-toolbar .toolbar-search:hover { background: rgba(255, 255, 255, 0.09) !important; }
.home .home-toolbar .toolbar-btn { color: #c3c9d4 !important; background: rgba(255, 255, 255, 0.045) !important; border-color: rgba(255, 255, 255, 0.07) !important; }
.home .home-toolbar .toolbar-btn:hover { background: rgba(255, 255, 255, 0.11) !important; border-color: rgba(255, 255, 255, 0.15) !important; }
.home .home-toolbar .toolbar-btn-primary { color: #0b1220 !important; background: var(--h-accent) !important; border-color: transparent !important; box-shadow: 0 6px 16px -8px rgba(122, 167, 255, 0.8); }
.home .home-toolbar .toolbar-btn-primary:hover { background: #9dbfff !important; }

/* panneau du sous-menu */
.home .home-toolbar .rounded_list.toolbar-menu {
    width: auto !important;
    min-width: 258px;
    margin-top: 8px;
    padding: 6px;
    background: rgba(24, 25, 30, 0.97) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    backdrop-filter: blur(18px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px;
    box-shadow: 0 24px 56px -12px rgba(0, 0, 0, 0.7);
}
.home .home-toolbar .group:hover > .rounded_list.toolbar-menu { animation: uxMenuIn 0.14s ease; }
.home .home-toolbar .rounded_list.toolbar-menu::before { top: -10px; height: 10px; }

/* lignes */
.home .home-toolbar .rounded_list.toolbar-menu a {
    display: flex !important;
    align-items: center;
    gap: 11px;
    padding: 8px 10px !important;
    font-size: 13px;
    font-weight: 500;
    color: #dfe3ea !important;
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-radius: 9px;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.home .home-toolbar .rounded_list.toolbar-menu a + a { margin-top: 2px; }
.home .home-toolbar .rounded_list.toolbar-menu a:hover { color: #fff !important; background: rgba(255, 255, 255, 0.08) !important; }
.home .home-toolbar .rounded_list.toolbar-menu a > span { flex: 1; min-width: 0; }
.home .home-toolbar .rounded_list.toolbar-menu a.space-x-2 > * + * { margin-left: 0; }

/* pastille d'icône */
.home .home-toolbar .rounded_list.toolbar-menu a > svg,
.home .home-toolbar .rounded_list.toolbar-menu a > i {
    flex: none;
    box-sizing: content-box;
    width: 16px !important;
    height: 16px !important;
    padding: 6px;
    color: #a9c5ff;
    background: rgba(122, 167, 255, 0.13);
    border-radius: 8px;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.home .home-toolbar .rounded_list.toolbar-menu a:hover > svg { background: rgba(122, 167, 255, 0.24); color: #fff; }

/* teintes par action */
.home .home-toolbar #run-all-scripts-btn > svg, .home .home-toolbar #run-all-policies-btn > svg { color: #86efac; background: rgba(52, 211, 153, 0.14); }
.home .home-toolbar #force-run-all-policies-btn > svg { color: #fcd34d; background: rgba(250, 204, 21, 0.13); }
.home .home-toolbar #run-all-scripts-btn:hover > svg, .home .home-toolbar #run-all-policies-btn:hover > svg { background: rgba(52, 211, 153, 0.26); }
.home .home-toolbar #force-run-all-policies-btn:hover > svg { background: rgba(250, 204, 21, 0.25); }

/* « Gérer… » : séparé des actions d'exécution */
.home .home-toolbar #manage-scripts-btn, .home .home-toolbar #manage-policies-btn { position: relative; margin-top: 7px !important; }
.home .home-toolbar #manage-scripts-btn::before, .home .home-toolbar #manage-policies-btn::before { content: ""; position: absolute; left: 8px; right: 8px; top: -4px; height: 1px; background: rgba(255, 255, 255, 0.08); }

/* menu « Nouveau » : plus simple, avec un « + » */
.home .home-toolbar #add-task-btn::before, .home .home-toolbar #add-project-btn::before {
    content: "\ea13"; /* ri-add-line */
    font-family: remixicon;
    flex: none;
    box-sizing: content-box;
    width: 16px; height: 16px; padding: 6px;
    font-size: 16px; line-height: 16px; text-align: center;
    color: #a9c5ff; background: rgba(122, 167, 255, 0.13); border-radius: 8px;
}
.home .home-toolbar #add-project-btn::before { color: #fcd34d; background: rgba(250, 204, 21, 0.13); }

/* icône « récurrente » à côté du nom (la prochaine occurrence est dans l'infobulle) */
.row-rec { display: inline-flex; align-items: center; margin-left: 6px; font-size: 13px; color: var(--h-faint); opacity: 0.8; cursor: help; }
.row-rec:hover { color: var(--h-accent, #7aa7ff); opacity: 1; }
