/* ═══════════════════════════════════════════════════════════════════════════
   PLANNER — CSS (Light Theme)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #f4f6f9;
    --bg-lighter: #ffffff;
    --bg-card: #ffffff;
    --surface: #f6f8fa;
    --bg-subtle: #f6f8fa;
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #e6eaee;
    --border-strong: #b2bec3;
    --primary: #6c63ff;
    --primary-hover: #5a52e0;
    --primary-light: rgba(108, 99, 255, 0.08);
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #27ae60;
    --row-height: 38px;
    --category-width: 0px;
    --cat-row-height: 28px;
    --project-name-width: 170px;
    --header-height: 66px;

    /* ── Z-index layer stack (documented) ──
     * 1-5    : content (bars, segments, inline elements)
     * 10-20  : timeline columns, sub-headers
     * 30-60  : side panels, gantt header, category rows
     * 100    : sticky page header
     * 200    : modal backdrop + modals
     * 300    : overlay
     * 1000   : dropdowns, tooltips, toasts
     * 9999   : color picker (above everything)
     */
    --z-content:       1;
    --z-timeline:      10;
    --z-timeline-head: 20;
    --z-panel:         40;
    --z-gantt-header:  60;
    --z-header:        100;
    --z-modal:         200;
    --z-overlay:       300;
    --z-dropdown:      1000;
    --z-color-picker:  9999;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME
   ═══════════════════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
    --bg: #1a1d23;
    --bg-lighter: #22262e;
    --bg-card: #272b34;
    --surface: #2a2f38;
    --bg-subtle: #242831;
    --text: #e0e4ea;
    --text-muted: #9ba3ad;
    --border: #353a44;
    --border-strong: #4a5060;
    --primary: #7c74ff;
    --primary-hover: #9b94ff;
    --primary-light: rgba(124, 116, 255, 0.12);
    --danger: #ef5350;
    --danger-hover: #e53935;
    --success: #4caf50;
    color-scheme: dark;
}

/* Auto-apply dark theme when OS prefers dark and no explicit preference */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --bg: #1a1d23;
        --bg-lighter: #22262e;
        --bg-card: #272b34;
        --surface: #2a2f38;
        --bg-subtle: #242831;
        --text: #e0e4ea;
        --text-muted: #9ba3ad;
        --border: #353a44;
        --border-strong: #4a5060;
        --primary: #7c74ff;
        --primary-hover: #9b94ff;
        --primary-light: rgba(124, 116, 255, 0.12);
        --danger: #ef5350;
        --danger-hover: #e53935;
        --success: #4caf50;
        color-scheme: dark;
    }
}

/* ── Dark theme overrides for hardcoded colors ───────────────────────── */

[data-theme="dark"] .timeline-body {
    background: #1e2128;
}

[data-theme="dark"] .grid-stripe-weekend {
    background: rgba(255, 255, 255, 0.015);
}

[data-theme="dark"] .grid-line.grid-line-day {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .grid-line.grid-line-week {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .grid-line.grid-line-month {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .grid-line.grid-line-quarter {
    background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .grid-line.grid-line-year {
    background: rgba(255, 255, 255, 0.20);
}

[data-theme="dark"] .timeline-header-cell.weekend {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .bar-resize-handle {
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .bar-drag-indicator {
    background: rgba(240, 240, 240, 0.88);
    color: #1a1d23;
}

[data-theme="dark"] .jalon-text {
    background: rgba(30, 33, 40, 0.92);
}

[data-theme="dark"] .star-label {
    text-shadow: 0 0 3px var(--bg), 0 0 5px var(--bg);
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .btn-danger-ghost {
    color: #ef7070;
    border-color: rgba(239, 112, 112, 0.35);
}

[data-theme="dark"] .btn-danger-ghost:hover {
    background: rgba(239, 112, 112, 0.1);
    border-color: rgba(239, 112, 112, 0.55);
    color: #ff8a8a;
}

[data-theme="dark"] .readonly-badge {
    background: rgba(243, 156, 18, 0.15);
    color: #f0b94d;
    border-color: rgba(243, 156, 18, 0.40);
}

[data-theme="dark"] .collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .pn-resize-handle:hover,
[data-theme="dark"] .pn-resize-handle.resizing {
    background: rgba(124, 116, 255, 0.40);
}

/* Auth page dark overrides */
[data-theme="dark"] body.auth-page {
    background:
        radial-gradient(circle at 10% 15%, rgba(124, 116, 255, 0.15), transparent 34%),
        radial-gradient(circle at 90% 85%, rgba(76, 175, 80, 0.12), transparent 30%),
        linear-gradient(160deg, #1a1d23 0%, #1e2128 50%, #1a2030 100%);
}

/* Scrollbar dark */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Duplicate dark overrides for auto mode */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .timeline-body { background: #1e2128; }
    [data-theme="auto"] .grid-stripe-weekend { background: rgba(255, 255, 255, 0.015); }
    [data-theme="auto"] .grid-line.grid-line-day { background: rgba(255, 255, 255, 0.03); }
    [data-theme="auto"] .grid-line.grid-line-week { background: rgba(255, 255, 255, 0.06); }
    [data-theme="auto"] .grid-line.grid-line-month { background: rgba(255, 255, 255, 0.08); }
    [data-theme="auto"] .grid-line.grid-line-quarter { background: rgba(255, 255, 255, 0.12); }
    [data-theme="auto"] .grid-line.grid-line-year { background: rgba(255, 255, 255, 0.20); }
    [data-theme="auto"] .timeline-header-cell.weekend { background: rgba(255, 255, 255, 0.02); }
    [data-theme="auto"] .bar-resize-handle { background: rgba(0, 0, 0, 0.55); border-color: rgba(255, 255, 255, 0.35); }
    [data-theme="auto"] .bar-drag-indicator { background: rgba(240, 240, 240, 0.88); color: #1a1d23; }
    [data-theme="auto"] .jalon-text { background: rgba(30, 33, 40, 0.92); }
    [data-theme="auto"] .star-label { text-shadow: 0 0 3px var(--bg), 0 0 5px var(--bg); }
    [data-theme="auto"] .modal-overlay { background: rgba(0, 0, 0, 0.55); }
    [data-theme="auto"] .btn-danger-ghost { color: #ef7070; border-color: rgba(239, 112, 112, 0.35); }
    [data-theme="auto"] .btn-danger-ghost:hover { background: rgba(239, 112, 112, 0.1); border-color: rgba(239, 112, 112, 0.55); color: #ff8a8a; }
    [data-theme="auto"] .readonly-badge { background: rgba(243, 156, 18, 0.15); color: #f0b94d; border-color: rgba(243, 156, 18, 0.40); }
    [data-theme="auto"] .collapse-toggle:hover { background: rgba(255, 255, 255, 0.08); }
    [data-theme="auto"] .pn-resize-handle:hover,
    [data-theme="auto"] .pn-resize-handle.resizing { background: rgba(124, 116, 255, 0.40); }
    [data-theme="auto"] body.auth-page { background: radial-gradient(circle at 10% 15%, rgba(124, 116, 255, 0.15), transparent 34%), radial-gradient(circle at 90% 85%, rgba(76, 175, 80, 0.12), transparent 30%), linear-gradient(160deg, #1a1d23 0%, #1e2128 50%, #1a2030 100%); }
    [data-theme="auto"] ::-webkit-scrollbar-track { background: var(--bg); }
    [data-theme="auto"] ::-webkit-scrollbar-thumb { background: var(--border-strong); }
    [data-theme="auto"] ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Page planning : pas de scroll vertical, le scroll est dans .timeline-container */
body.planning-page {
    overflow: hidden;
    height: 100vh;
}

body.planning-page main {
    display: flex;
    flex-direction: column;
    /* hauteur = viewport - header (celle du sticky header est calculée par le navigateur) */
    height: calc(100vh - 52px);
    overflow: hidden;
}

/* ─── HEADER ──────────────────────────────────────────────────────────────── */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ─── AVATAR DROPDOWN ─────────────────────────────────────────────────────── */

.user-avatar-wrap {
    position: relative;
}

.user-avatar-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, box-shadow 0.15s;
    letter-spacing: 0.02em;
}

.user-avatar-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 0 3px rgba(74,144,217,0.22);
}

.user-avatar-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.13);
    min-width: 210px;
    z-index: var(--z-overlay);
    overflow: hidden;
}

.user-avatar-menu.open {
    display: block;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    text-align: left;
    transition: background 0.1s;
}

.user-menu-item:hover {
    background: var(--bg);
}

.user-menu-item-danger {
    color: var(--danger);
}

/* Séparateur dans le menu avatar */
.user-menu-sep {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* ─── LANG / THEME PICKER (modal préférences) ──────────────────────────────── */
/* Styles partagés : .lang-picker-wrap et .theme-picker-wrap restent sur
   les éléments pour les sélecteurs JS existants. */
.picker-wrap,
.lang-picker-wrap,
.theme-picker-wrap {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}
.picker-btn {
    flex: 1;
    padding: 12px 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.picker-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light, rgba(74,144,217,0.08));
}
.picker-btn.active {
    border-color: var(--primary);
    background: var(--primary-light, rgba(74,144,217,0.08));
    color: var(--primary);
    font-weight: 700;
}

/* ─── BUTTONS ─────────────────────────────────────────────────────────────── */

.btn {
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
}

/* Variante intermédiaire : fond teinté, texte primaire, sans le bleu plein */
.btn-soft {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid transparent;
}
.btn-soft:hover {
    background: rgba(108, 99, 255, 0.15);
    border-color: rgba(108, 99, 255, 0.25);
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: var(--danger-hover);
}

/* Variante discrète pour les boutons de suppression inline (listes, tableaux) */
.btn-danger-ghost {
    background: transparent;
    color: #b03a2e;
    border: 1px solid rgba(176, 58, 46, 0.35);
}
.btn-danger-ghost:hover {
    background: rgba(176, 58, 46, 0.08);
    border-color: rgba(176, 58, 46, 0.6);
    color: #922b21;
}

.btn-leave-task-disabled {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-leave-disabled-wrap {
    display: inline-block;
    cursor: not-allowed;
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.75rem;
}

/* ─── ZOOM CONTROLS ───────────────────────────────────────────────────────── */

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 24px;
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.zoom-controls label {
    color: var(--text-muted);
    font-weight: 500;
}

#zoom-slider {
    width: 180px;
    accent-color: var(--primary);
}

#zoom-level-label {
    color: var(--primary);
    font-weight: 600;
    min-width: 80px;
    font-size: 0.8rem;
}

.controls-sep {
    width: 1px;
    height: 18px;
    background: var(--border-strong);
    margin: 0 4px;
    flex-shrink: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.toggle-label input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
}

/* ─── BUTTON GROUP ────────────────────────────────────────────────────────── */

.btn-group {
    display: flex;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.btn-group-item {
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-muted);
    border: none;
    border-right: 1px solid var(--border-strong);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.5;
}

.btn-group-item:last-child {
    border-right: none;
}

.btn-group-item:hover:not(.active) {
    background: var(--border);
    color: var(--text);
}

.btn-group-item.active {
    background: var(--primary);
    color: #fff;
    cursor: default;
}

/* ─── MOBILE ZOOM / CONTROLS BAR ─────────────────────────────────────────── */
/* Masquée par défaut (desktop), affichée uniquement en mobile via media query */
.zoom-controls-mobile {
    display: none;
}

@media (max-width: 768px) {
    .zoom-controls-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 6px 10px;
        background: var(--bg-lighter);
        border-bottom: 1px solid var(--border);
        font-size: 0.78rem;
    }
}

.mobile-ctrl-group {
    display: flex;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    overflow: hidden;
}

.mobile-zoom-preset {
    padding: 6px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    border: none;
    border-right: 1px solid var(--border-strong);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.mobile-zoom-preset:last-child {
    border-right: none;
}
.mobile-zoom-preset.active {
    background: var(--primary);
    color: #fff;
}

.mobile-ctrl-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

#row-height-slider {
    width: 100px;
    accent-color: var(--primary);
}

#row-height-label {
    color: var(--primary);
    font-weight: 600;
    min-width: 38px;
    font-size: 0.8rem;
}

/* ─── PLANNING LABEL FILTERS BAR ─────────────────────────────────────────── */

.planning-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 5px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

/* ─── TIMELINE CONTAINER ──────────────────────────────────────────────────── */

.timeline-container {
    overflow-x: auto;
    overflow-y: auto;
    /* Avec body.planning-page main en flex, le container remplit l'espace restant */
    flex: 1;
    min-height: 0;
}

.timeline-wrapper {
    display: flex;
    /* max-content assure que le wrapper s'étend à la largeur totale du contenu
       (colonnes sticky + timeline), permettant le scroll horizontal.
       min-width: 100% garantit au moins la largeur du viewport. */
    width: max-content;
    min-width: 100%;
    position: relative;
}

/* ─── CATEGORY COLUMN ─────────────────────────────────────────────────────── */

/* Category column: hidden in row mode, visible in column mode */
.category-column {
    display: none;
}

body.cat-col {
    --category-width: 100px;
}

body.cat-col .category-column {
    position: sticky;
    left: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    min-width: var(--category-width);
    width: var(--category-width);
    background: var(--bg-lighter);
    border-right: 1px solid var(--border);
}

body.cat-col .project-names-column {
    left: var(--category-width);
}

.category-column .header-spacer {
    height: var(--header-height);
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
    /* tooltip hint is added in HTML via title attribute if needed */
}

.category-block {
    border-bottom: 3px solid var(--border); /* Avec 2 pixel comme sur les autres bordures, il manque 1px de hauteur */
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-block:hover {
    filter: brightness(0.97);
}

.category-block.collapsed {
    opacity: 0.8;
}

.category-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 6px 6px;
    width: 100%;
    height: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    hyphens: auto;
    gap: 4px;
}

.collapse-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 8px 6px;
    margin: -8px -2px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    flex-shrink: 0;
}

.collapse-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.collapse-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.collapse-icon {
    font-size: 0.75rem;
    user-select: none;
    line-height: 1;
    pointer-events: none;
}

/* collapsed state for project names column */
.pn-row.collapsed {
    font-style: italic;
    color: var(--text-muted);
}

/* collapsed row in timeline body */
.project-row.collapsed-row {
    cursor: pointer;
}
.project-row.collapsed-row:hover {
    background: var(--primary-light);
}

/* aggregated bar style */
.project-bar.aggregate-bar {
    opacity: 0.8;
    border: 1px dashed rgba(0,0,0,0.1);
}

/* ─── PROJECT NAMES COLUMN ────────────────────────────────────────────────── */

.project-names-column {
    position: sticky;
    left: var(--category-width);
    z-index: 55;
    min-width: var(--project-name-width);
    width: var(--project-name-width);
    background: var(--bg-lighter);
    border-right: 1px solid var(--border);
    /* Nécessaire pour que le handle de resize (position:absolute) dépasse sans être rogné */
    overflow: visible;
}

/* ─── COLONNE NOMS : REDIMENSIONNEMENT ───────────────────────────────────────── */

/* Handle de resize — bande verticale sur le bord droit de la colonne noms */
.pn-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    bottom: 0;
    cursor: col-resize;
    z-index: 1;
    background: transparent;
    transition: background 0.15s;
}

.pn-resize-handle:hover,
.pn-resize-handle.resizing {
    background: rgba(108, 99, 255, 0.35);
}

/* Mode user-sized : les noms de tâches passent à la ligne plutôt que d'être tronqués.
   La hauteur de la ligne est calculée par JS (_calcRowHeight) et appliquée inline.
   min-height garantit qu'une ligne ne descend jamais sous rowHeight même quand le texte
   est court (sinon height:auto + contenu 14px → ligne écrasée pendant le drag live). */
.pn-col-user-sized .pn-row {
    white-space: normal;
    min-height: var(--row-height);
}

.pn-col-user-sized .pn-row-name {
    white-space: normal;
    overflow: visible;
    overflow-wrap: break-word;
    word-break: break-word;
}

.pn-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--border);
}

.pn-category-group {
    border-bottom: 2px solid var(--border);
}

/* Category header row in the project names column */
.pn-category-header {
    height: var(--cat-row-height);
    display: flex;
    align-items: center;
    padding: 0 6px 0 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    gap: 4px;
    user-select: none;
    overflow: hidden;
}

.pn-category-header:hover {
    filter: brightness(0.96);
}

.pn-cat-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.pn-row {
    height: var(--row-height);
    display: flex;
    align-items: center;
    padding: 0 6px 0 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    gap: 2px;
}

.pn-row:hover {
    background: var(--primary-light);
}

.pn-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* ─── DRAG HANDLE (row reorder) ──────────────────────────────────────────── */

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0 2px;
    opacity: 0.35;
    user-select: none;
    flex-shrink: 0;
    transition: opacity 0.15s;
    line-height: 1;
}

.drag-handle:hover {
    opacity: 0.9;
}

/* En mode colonne, le handle est dans le flux flex normal (pas absolu) */
.category-block .cat-drag-handle {
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0;
}

.pn-row.row-dragging {
    opacity: 0.45;
    background: var(--primary-light);
}

.pn-row.drag-over-top {
    border-top: 2px solid var(--primary);
}

.pn-row.drag-over-bottom {
    border-bottom: 2px solid var(--primary);
}

.project-row.row-dragging {
    opacity: 0.45;
    background: var(--primary-light);
}

/* ─── BAR DRAG INDICATOR ─────────────────────────────────────────────────── */

.bar-drag-indicator {
    position: fixed;
    z-index: var(--z-color-picker);
    background: rgba(20, 20, 20, 0.82);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 5px;
    pointer-events: none;
    display: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.project-bar.bar-dragging {
    opacity: 0.82;
    z-index: 20;
    cursor: grabbing;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.project-bar.bar-resizing {
    opacity: 0.9;
    z-index: 20;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ─── TIMELINE AREA ───────────────────────────────────────────────────────── */

.timeline-area {
    flex: 1 0 auto;
    min-width: 600px;
}

.timeline-header {
    height: var(--header-height);
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    overflow: hidden;
}

.timeline-header.two-rows {
    flex-direction: column;
}

.header-row {
    display: flex;
    overflow: hidden;
    flex-shrink: 0;
}

.header-row-top {
    height: 20px;
    border-bottom: 1px solid var(--border);
}

.header-row-bottom {
    flex: 1;
}

.header-top-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-lighter);
    border-right: 1px solid var(--border);
    padding: 0 4px;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-header-cell {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    padding: 2px;
}

.timeline-header-cell .month-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.timeline-header-cell .day-label {
    font-size: 0.6rem;
}

.timeline-header-cell.weekend {
    background: rgba(0, 0, 0, 0.02);
}

.timeline-header-cell.today {
    background: rgba(108, 99, 255, 0.12);
    color: var(--primary);
    font-weight: 700;
}

/* ─── TIMELINE BODY ───────────────────────────────────────────────────────── */

.timeline-body {
    position: relative;
    background: #fbfcfd;
}

.category-group {
    border-bottom: 2px solid var(--border);
}

/* Category header row in the timeline body */
.category-header-row {
    height: var(--cat-row-height);
    position: relative;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.category-header-row:hover {
    filter: brightness(0.96);
}

.project-row {
    height: var(--row-height);
    position: relative;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.project-row:hover {
    background: var(--primary-light);
}

/* Grid lines — visual hierarchy: day < week < month < quarter < year */
.grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    margin-left: -1px; /* align with header border-right (drawn 1px inside cell) */
    pointer-events: none;
}

/* Weekend stripe */
.grid-stripe-weekend {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.010);
    pointer-events: none;
}

/* Jour : à peine perceptible */
.grid-line.grid-line-day {
    background: rgba(0, 0, 0, 0.025);
}

/* Lundi / semaine */
.grid-line.grid-line-week {
    background: rgba(0, 0, 0, 0.05);
}

/* Mois */
.grid-line.grid-line-month {
    background: rgba(0, 0, 0, 0.07);
}

/* Trimestre */
.grid-line.grid-line-quarter {
    background: rgba(0, 0, 0, 0.11);
}

/* Année */
.grid-line.grid-line-year {
    background: rgba(0, 0, 0, 0.18);
    width: 1px;
}

.grid-line.today-line {
    background: rgba(108, 99, 255, 0.45);
    width: 2px;
    z-index: 5;
}

/* ─── PROJECT BARS ────────────────────────────────────────────────────────── */

.project-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    z-index: 10;
    cursor: pointer;
    overflow: visible;
    transition: filter 0.15s;
}

.project-bar:hover {
    filter: brightness(1.08) saturate(1.2);
    z-index: 15;
}

/* Bar type — simple rounded rectangle */
.project-bar .bar-shape {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.project-bar.bar-type .bar-shape {
    border-radius: 4px;
}

.bar-resize-handle {
    position: absolute;
    top: -0px;
    width: 8px;
    height: 22px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: auto;
    cursor: ew-resize;
    transition: opacity 0.12s ease;
    z-index: 4;
}

.bar-resize-handle.start { left: -3px; }
.bar-resize-handle.end   { right: -3px; }

.project-bar:hover .bar-resize-handle,
.project-bar.bar-resizing .bar-resize-handle {
    opacity: 1;
}

/* Arrow type — bar with fixed-size arrow end */
.project-bar.arrow-type .bar-shape {
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
}

/* Chevron type — notch on left, point on right */
.project-bar.chevron-type .bar-shape {
    clip-path: polygon(0 0, 12px 50%, 0 100%, calc(100% - 12px) 100%, 100% 50%, calc(100% - 12px) 0);
}

/* Star type — milestone marker */
.project-bar.star-type {
    width: 22px !important;
    height: 22px;
    overflow: visible;
}

.project-bar.star-type svg {
    width: 100%;
    height: 100%;
    display: block;
}

.star-label {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 0 3px var(--bg-lighter), 0 0 5px var(--bg-lighter);
}

/* Bar label — centered text on bars */
.bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
    text-shadow: 0 0.5px 2px rgba(0,0,0,0.35);
    pointer-events: none;
    line-height: 22px;
    z-index: 2;
}

/* --- JALON MARKERS (on timeline) --- */

.jalons-hidden .jalon-marker { display: none; }

.jalon-marker {
    position: absolute;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 20;
    cursor: pointer;
    pointer-events: auto;
}

.jalon-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e74c3c;
    border: 1.5px solid white;
    flex-shrink: 0;
    box-shadow: 0 0 3px rgba(231, 76, 60, 0.4);
}

.jalon-text {
    font-size: 0.58rem;
    color: var(--text);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    pointer-events: none;
    border: 1px solid var(--border);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jalon-marker:hover .jalon-dot {
    transform: scale(1.4);
}

/* Jalon draggable (accès écriture) */
.jalon-marker.jalon-draggable {
    cursor: grab;
}

.jalon-marker.jalon-dragging {
    opacity: 0.75;
    cursor: grabbing;
    z-index: 50;
}

.jalon-marker.jalon-dragging .jalon-dot {
    transform: scale(1.3);
    box-shadow: 0 0 6px rgba(231, 76, 60, 0.7);
}

/* --- JALON TOOLTIP --- */

.jalon-tooltip {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    max-width: 260px;
    z-index: var(--z-dropdown);
    display: none;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.jalon-tooltip .jalon-date {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 3px;
    font-size: 0.7rem;
}

.jalon-tooltip .drag-delta {
    opacity: 0.72;
    font-size: 0.65rem;
    font-weight: 400;
    margin-left: 2px;
}

/* ─── INLINE PERIOD PANEL ─────────────────────────────────────────────────── */

.inline-period-panel {
    position: absolute;
    z-index: 30;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
    max-width: 300px;
}

.inline-panel-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem;
}

.inline-panel-repr-row {
    display: flex;
    gap: 4px;
}

/* Ligne suppression avec confirmation inline */
.inline-panel-delete-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inline-panel-confirm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.inline-panel-confirm-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--danger);
}

/* ─── TASK SIDE PANEL ─────────────────────────────────────────────────────── */

.task-side-panel {
    position: fixed;
    top: 0;
    /* Animation via right au lieu de transform pour éviter de créer un stacking
       context qui casse position:fixed du color-picker (.cp-panel) à l'intérieur. */
    right: -380px;
    width: 380px;
    height: 100vh;
    background: var(--bg-lighter);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0,0,0,0.10);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    transition: right 0.25s ease;
}

.task-side-panel.open {
    right: 0;
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.side-panel-header h2 {
    font-size: 1rem;
    margin: 0;
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.side-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .task-side-panel {
        width: 100%;
        right: -100%;
    }
}

/* ─── MODAL ───────────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    width: 560px;
    max-width: 95vw;
    max-height: 85vh;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    animation: modalIn 0.2s ease;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
}

.modal-small {
    width: 400px;
}

.modal-wide {
    width: 720px;
}

.modal-changelog {
    width: 680px;
}

.changelog-body h1 { font-size: 1.25rem; font-weight: 700; margin: 0 0 12px; }
.changelog-body h2 { font-size: 1.05rem; font-weight: 700; margin: 20px 0 6px; color: var(--primary); }
.changelog-body h3 { font-size: 0.95rem; font-weight: 600; margin: 14px 0 4px; }
.changelog-body p  { margin: 6px 0; line-height: 1.6; font-size: 0.9rem; color: var(--text); }
.changelog-body hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.changelog-body ul { margin: 6px 0 10px 18px; padding: 0; }
.changelog-body li { font-size: 0.9rem; line-height: 1.6; color: var(--text); margin-bottom: 2px; }
.changelog-body strong { font-weight: 600; }
.changelog-body code  { font-family: monospace; font-size: 0.85em;
                         background: var(--bg); padding: 1px 5px; border-radius: 4px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.modal-footer .spacer {
    flex: 1;
}

/* Barre de confirmation inline (modifications non sauvegardées) */
.dirty-confirm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 20px 0;
    font-size: 0.9em;
    flex-wrap: wrap;
}

.dirty-confirm-bar span {
    flex: 1;
    min-width: 0;
}

.dirty-confirm-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Spinner de chargement dans les modales */
@keyframes modal-spin {
    to { transform: rotate(360deg); }
}

.modal-spinner {
    width: 28px;
    height: 28px;
    margin: 8px auto 12px;
    border: 3px solid var(--border);
    border-top-color: var(--accent, #4A90D9);
    border-radius: 50%;
    animation: modal-spin 0.8s linear infinite;
}

/* ── Modal sticky notices zone (validation errors + warnings) ──────────────── */

.modal-notices {
    padding: 8px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-lighter);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Inline validation error banner */
.form-error {
    background: rgba(231, 76, 60, 0.10);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.35);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.82rem;
    line-height: 1.5;
}

/* Field highlight on errors */
.field-has-error input,
.field-has-error .cat-combo-input {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.18);
}
.field-has-error > label {
    color: var(--danger);
}

/* ─── FORMS ───────────────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.1);
}

.form-group input[type="color"] {
    width: 44px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    padding: 2px;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

.form-group textarea {
    resize: vertical;
    min-height: 50px;
}

/* ─── NEW CATEGORY INLINE FORM ────────────────────────────────────────────── */

#new-category-inline {
    background: var(--primary-light);
    border: 1px dashed var(--primary);
    border-radius: 8px;
    padding: 12px 14px 8px;
    margin-top: 10px;
    margin-bottom: 4px;
}

#new-category-inline .form-row {
    align-items: flex-end;
    gap: 12px;
}

#new-category-inline .form-group {
    margin-bottom: 0;
}

/* ─── REPRESENTATION PICKER ───────────────────────────────────────────────── */

.representation-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.repr-option {
    width: 85px;
    padding: 6px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    color: var(--text-muted);
}

.repr-option:hover {
    border-color: var(--primary);
    color: var(--text);
}

.repr-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.repr-option svg {
    width: 55px;
    height: 18px;
    margin-bottom: 3px;
}

.repr-option span {
    display: block;
    font-size: 0.65rem;
}

/* ─── FORM SECTIONS ───────────────────────────────────────────────────────── */

.form-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.form-section h3 {
    font-size: 0.85rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── RANGES LIST ─────────────────────────────────────────────────────────── */

.ranges-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.range-item {
    background: var(--bg);
    border-radius: 6px;
    padding: 8px;
}

/* Ligne 1 du range : label + bouton supprimer */
.range-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.range-dates-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.range-dates-row input[type="date"] {
    flex: 1;
    min-width: 0;
    padding: 5px 7px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.78rem;
    outline: none;
}

/* Espaceur invisible pour aligner le bord droit du champ date-fin avec le champ label */
.range-end-spacer {
    visibility: hidden;
    font-size: 0.82rem;
    padding: 2px 5px;
    flex-shrink: 0;
    user-select: none;
    pointer-events: none;
}

.range-dates-row input[type="date"]:focus,
.range-dates-row input[type="text"]:focus {
    border-color: var(--primary);
}

.range-label-input {
    flex: 1;
    min-width: 0;
    padding: 5px 7px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.78rem;
    outline: none;
}

.range-sep {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.range-repr-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.repr-option-mini {
    width: 65px;
    padding: 3px 4px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    color: var(--text-muted);
}

.repr-option-mini:hover {
    border-color: var(--primary);
    color: var(--text);
}

.repr-option-mini.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.repr-option-mini svg {
    width: 40px;
    height: 14px;
    display: block;
    margin: 0 auto 1px;
}

.repr-option-mini span {
    display: block;
    font-size: 0.58rem;
}

/* --- JALONS & COMMENTS LISTS --- */

.jalons-list, .comments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jalon-item, .comment-item {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    background: var(--bg);
    border-radius: 6px;
    padding: 7px;
}

/* Corps du commentaire : méta + textarea empilés */
.comment-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 3px;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.comment-author {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
}

.comment-item.readonly .comment-content-input {
    background: transparent;
    border-color: transparent;
    cursor: default;
    color: var(--text);
    resize: none;
}

.jalon-item input[type="date"] {
    width: 135px;
    padding: 5px 7px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.78rem;
}

.jalon-item input[type="text"],
.comment-item textarea {
    flex: 1;
    padding: 5px 7px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.78rem;
    outline: none;
}

.comment-item textarea {
    resize: vertical;
    min-height: 36px;
    font-family: inherit;
}

.range-label-row .btn-remove,
.range-dates-row .btn-remove,
.jalon-item .btn-remove,
.comment-item .btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.82rem;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0.45;
    line-height: 1;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}

.range-label-row .btn-remove:hover,
.range-dates-row .btn-remove:hover,
.jalon-item .btn-remove:hover,
.comment-item .btn-remove:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.1);
}

.comment-item .comment-date {
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding-top: 2px;
}

/* Mode affichage d'un commentaire existant */
.comment-content-text {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text);
    word-break: break-word;
}

/* Contenu markdown dans un commentaire (reset les marges par défaut) */
.comment-content-text > :first-child { margin-top: 0; }
.comment-content-text > :last-child  { margin-bottom: 0; }
.comment-content-text p { margin: 0 0 4px; }
.comment-content-text ul, .comment-content-text ol { padding-left: 16px; margin: 2px 0; }
.comment-content-text code { font-size: 0.75rem; background: var(--bg-lighter); padding: 1px 4px; border-radius: 3px; }

/* Boutons d'action (éditer, supprimer, confirmer, annuler) */
.comment-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.15s;
    line-height: 1;
}

.btn-icon:hover {
    opacity: 1;
}

/* Confirmation inline pour les commentaires */
.comment-actions .inline-panel-confirm {
    display: flex;
    gap: 3px;
}

/* ─── SIDE PANEL READ-ONLY MODE ──────────────────────────────────────────── */

/* En mode lecture seule, cacher couleur, catégorie, périodes et jalons */
.task-side-panel.sp-readonly #sp-color-group,
.task-side-panel.sp-readonly #sp-cat-group,
.task-side-panel.sp-readonly #sp-ranges-section,
.task-side-panel.sp-readonly #sp-jalons-section {
    display: none;
}

/* Nom de la tâche en lecture seule : apparence "texte" */
.task-side-panel.sp-readonly #sp-project-name {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
    cursor: default;
    font-weight: 600;
    padding-left: 0;
}

/* Bouton « + Commentaire » masqué en lecture seule */
.task-side-panel.sp-readonly #sp-btn-add-comment {
    display: none;
}

/* Champs personnalisés : toujours interactifs (valeurs personnelles par utilisateur) */
/* Pas de .sp-readonly ici : l'utilisateur peut toujours modifier ses propres champs */

/* Message « aucun commentaire » en lecture seule */
.sp-no-comment {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
    margin: 8px 0;
}

/* Confirmation inline dans le footer du side panel */
.sp-remove-confirm {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── COLOR PICKER WIDGET ─────────────────────────────────────────────────── */

.cp-wrapper {
    position: relative;
    display: inline-block;
}

.cp-swatch-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px solid var(--border-strong);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25);
}

.cp-swatch-btn:hover {
    border-color: var(--primary);
    transform: scale(1.08);
}

.cp-panel {
    display: none;
    position: fixed;
    z-index: var(--z-color-picker);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.15);
    padding: 10px;
}

.cp-panel.open {
    display: block;
}

.cp-grid {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.cp-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cp-cell {
    width: 18px;
    height: 18px;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s, border-color 0.1s;
    position: relative;
}

.cp-cell:hover {
    transform: scale(1.4);
    border-color: rgba(0,0,0,0.35);
    z-index: 2;
}

.cp-cell.cp-selected::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 2px;
    border: 2px solid rgba(255,255,255,0.85);
    pointer-events: none;
}

.cp-actions {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.cp-btn-native,
.cp-btn-eyedropper {
    flex: 1;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 0.72rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.cp-btn-native:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.cp-btn-eyedropper:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ─── SCROLLBAR ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Navigation compte aplatie pour le menu hamburger : cachée par défaut (desktop) */
.hamburger-account-nav {
    display: none;
}

/* ─── HAMBURGER MENU ──────────────────────────────────────────────────────── */

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text);
    line-height: 1;
    border-radius: 6px;
    transition: background 0.15s;
}
.hamburger-btn:hover {
    background: var(--primary-light);
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    :root {
        --project-name-width: 120px;
        --row-height: 38px;
    }

    /* ── Hamburger menu on mobile ── */
    .hamburger-btn {
        display: block;
        margin-left: auto;
    }

    .header-actions {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-lighter);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.10);
        padding: 10px 16px;
        flex-direction: column;
        gap: 8px;
        z-index: 100;
    }

    .header-actions.open {
        display: flex;
    }

    /* ── Hamburger : menu compte aplati (remplace le dropdown avatar) ── */

    /* Cacher le bouton avatar dans le hamburger — remplacé par la nav plate */
    .header-actions.open .user-avatar-wrap {
        display: none;
    }

    /* Cacher les boutons qui seraient des doublons (ex: Changelog/Docs sur home) */
    .header-actions.open [data-hamburger-dedup] {
        display: none;
    }

    /* Section plate avec les items du menu compte */
    .hamburger-account-nav {
        display: none; /* caché par défaut (desktop) */
    }
    .header-actions.open .hamburger-account-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        width: 100%;
    }

    .hamburger-sep {
        margin: 4px 0;
        border: none;
        border-top: 1px solid var(--border);
        width: 100%;
    }

    .hamburger-nav-item {
        display: flex;
        align-items: center;
        gap: 6px;
        background: none;
        border: none;
        text-align: left;
        padding: 9px 10px;
        border-radius: 6px;
        font-size: 0.92rem;
        cursor: pointer;
        color: var(--text);
        width: 100%;
        transition: background 0.15s;
    }
    .hamburger-nav-item:hover {
        background: var(--primary-light);
    }
    .hamburger-nav-item-danger {
        color: var(--danger);
    }
    .hamburger-nav-item-danger:hover {
        background: rgba(231, 76, 60, 0.08);
    }

    header {
        position: relative;
    }

    /* Force row mode on mobile — no room for a category column */
    body.cat-col {
        --category-width: 0px;
    }
    body.cat-col .category-column { display: none; }
    body.cat-col .project-names-column { left: 0; }

    /* ── App header ── */
    header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    header h1 {
        font-size: 1rem;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* ── Zoom / controls toolbar ── */
    .zoom-controls {
        display: none; /* Masqué sur mobile, remplacé par .zoom-controls-mobile */
    }

    /* ── Colonnes : forcé en mode lignes sur mobile ── */
    #cat-mode-group { display: none; }

    /* ── Timeline container — fills remaining viewport height ── */
    .timeline-container {
        flex: 1;
        min-height: 0;
    }

    /* ── Modal: bottom-sheet style on mobile ── */
    .modal-overlay {
        padding-top: 0;
        align-items: flex-end;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        margin-bottom: 0;
        /* Slide up animation on mobile */
        animation: modalInMobile 0.25s ease;
    }

    @keyframes modalInMobile {
        from { transform: translateY(40px); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    .modal-body {
        max-height: 72svh;
    }

    .modal-small {
        width: 100%;
    }

    /* ── Forms: stack columns vertically ── */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Range row: le label est déjà sur sa propre ligne, rien à overrider */
    .range-label-row {
        gap: 4px;
    }

    .range-label-input {
        flex: 1;
    }

    /* Jalon items: allow date + content to stack */
    .jalon-item {
        flex-wrap: wrap;
    }

    .jalon-item input[type="date"] {
        width: 100%;
    }

    /* Repr picker: allow wrapping */
    .range-repr-row {
        flex-wrap: wrap;
    }
}

/* ─── HEADER extensions ───────────────────────────────────────────────────── */

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.readonly-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(243, 156, 18, 0.12);
    color: #d68910;
    border: 1px solid rgba(243, 156, 18, 0.35);
    border-radius: 20px;
    padding: 3px 10px;
    line-height: 1;
    white-space: nowrap;
}

/* ─── AUTH PAGE ───────────────────────────────────────────────────────────── */

body.auth-page {
    position: relative;
    min-height: 100vh;
    padding: 84px 24px 28px;
    background:
        radial-gradient(circle at 10% 15%, rgba(108, 99, 255, 0.18), transparent 34%),
        radial-gradient(circle at 90% 85%, rgba(39, 174, 96, 0.16), transparent 30%),
        linear-gradient(160deg, #eef2f7 0%, #f8fbfd 50%, #eef8ff 100%);
}

.auth-topbar-lang {
    position: absolute;
    top: 18px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-lang-btn {
    min-width: 120px;
    padding: 8px 10px;
    font-size: 0.78rem;
}

.auth-shell {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: 28px;
    align-items: stretch;
}

.auth-showcase {
    border: 1px solid rgba(108, 99, 255, 0.18);
    border-radius: 20px;
    background: linear-gradient(165deg, rgba(38, 50, 56, 0.92), rgba(36, 53, 73, 0.9));
    color: #f3f7fa;
    box-shadow: 0 14px 42px rgba(18, 30, 44, 0.18);
    padding: 34px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-showcase-kicker {
    font-size: 0.78rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(224, 247, 250, 0.88);
}

.auth-showcase-title {
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    line-height: 1.18;
    letter-spacing: -0.02em;
    font-weight: 760;
}

.auth-showcase-lead {
    font-size: 1rem;
    color: rgba(231, 245, 250, 0.9);
    max-width: 60ch;
    line-height: 1.55;
}

.auth-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.auth-feature-card {
    border: 1px solid rgba(208, 233, 245, 0.2);
    border-radius: 14px;
    padding: 14px 12px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(1.5px);
}

.auth-feature-card h2 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 700;
}

.auth-feature-card p {
    font-size: 0.79rem;
    line-height: 1.45;
    color: rgba(231, 245, 250, 0.9);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 32px rgba(0,0,0,0.1);
    padding: 34px 30px 28px;
    width: 100%;
    text-align: center;
    align-self: center;
}

.auth-logo {
    font-size: 2.8rem;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 22px;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-error {
    background: rgba(231, 76, 60, 0.08);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.auth-success {
    background: rgba(39, 174, 96, 0.08);
    color: var(--success);
    border: 1px solid rgba(39, 174, 96, 0.25);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ─── Auth tabs ─── */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 8px 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.auth-tab:hover { color: var(--text); }

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ─── Small labels ─── */
.auth-optional {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.auth-domain {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--primary);
}

@media (max-width: 1040px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 560px;
    }

    .auth-showcase {
        padding: 24px;
    }

    .auth-feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body.auth-page {
        padding: 76px 14px 18px;
    }

    .auth-topbar-lang {
        top: 12px;
        right: 14px;
        left: 14px;
        justify-content: flex-end;
        gap: 6px;
    }

    .auth-lang-btn {
        min-width: 104px;
        padding: 8px;
        font-size: 0.74rem;
    }

    .auth-showcase {
        border-radius: 16px;
        padding: 20px;
        gap: 14px;
    }

    .auth-showcase-title {
        font-size: 1.42rem;
    }

    .auth-showcase-lead {
        font-size: 0.9rem;
    }

    .auth-card {
        padding: 24px 18px 20px;
    }
}

/* ─── Password strength ─── */
.password-strength {
    margin-top: 8px;
}

.pwd-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.pwd-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.25s, background 0.25s;
}

.pwd-rules {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pwd-rules li {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: 18px;
    position: relative;
    transition: color 0.2s;
}

.pwd-rules li::before {
    content: '✗';
    position: absolute;
    left: 0;
    color: var(--danger);
    font-size: 0.7rem;
    transition: color 0.2s;
}

.pwd-rules li.ok {
    color: var(--success);
}

.pwd-rules li.ok::before {
    content: '✓';
    color: var(--success);
}

/* ─── DASHBOARD ───────────────────────────────────────────────────────────── */

.dashboard-main {
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 24px;
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.dashboard-content {
    flex: 1;
    min-width: 0;
    max-width: 860px;
}

/* ─── NOTIFICATIONS PANEL ─────────────────────────────────────────────────── */

.notifications-panel {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
}

.notif-title {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    margin: 0;
}

.notif-filter-badge {
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--primary);
    margin-left: 4px;
    font-style: italic;
}

.notif-list {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.notif-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 24px 14px;
    text-align: center;
    margin: 0;
}

.notif-date-group {
    border-bottom: 1px solid var(--border);
}

.notif-date-group:last-child {
    border-bottom: none;
}

.notif-date-group-header {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 7px 14px 4px;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.notif-item {
    padding: 7px 14px 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.12s;
}

.notif-date-group:last-child .notif-item:last-child { border-bottom: none; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }

.notif-item-top {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
    min-width: 0;
}

.notif-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.notif-task-name {
    font-size: 0.73rem;
    color: var(--primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.notif-body {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-author-inline {
    font-weight: 700;
    color: var(--text);
}

@media (max-width: 960px) {
    .notifications-panel {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        max-width: 90vw;
        height: 100vh;
        z-index: 200;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
        border-radius: 0;
        border: none;
        border-left: 1px solid var(--border);
    }
    .notifications-panel.open {
        display: flex;
        flex-direction: column;
    }
    .notifications-panel.open .notif-list {
        max-height: unset;
        flex: 1;
    }
    .dashboard-content { max-width: unset; }

    /* ── Tasks page mobile ───────────────────────────────────────────────── */
    body.tasks-page {
        overflow: auto;
        height: auto;
    }
    body.tasks-page > main.tasks-page-main {
        overflow: visible;
        flex: none;
    }
    .tasks-page-layout {
        flex-direction: column;
    }
    /* Sidebar activité : masquée par défaut sur mobile, FAB pour l'ouvrir */
    body.tasks-page .tasks-activity-sidebar {
        display: none;
        width: 100%;
        border-left: none;
        border-top: none;
        max-height: 50vh;
    }
    /* Quand ouverte : panneau fixe en bas de l'écran (bottom sheet) */
    body.tasks-page .tasks-activity-sidebar.open {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 50vh;
        z-index: 200;
        border-top: 2px solid var(--border);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.18);
        background: var(--bg-card);
    }
    body.tasks-page .tasks-activity-sidebar .notif-close-btn {
        display: block;
    }
    .tasks-toolbar-actions {
        margin-left: 0;
        width: 100%;
    }
    .tasks-toolbar-bar {
        padding: 8px 12px;
    }
}

/* ── Notification panel mobile header (close button) ──────────────────── */
.notif-panel-header-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.notif-close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
}
.notif-close-btn:hover {
    color: var(--text);
}
@media (max-width: 960px) {
    .notif-close-btn { display: block; }
}

/* ── Floating action button for notifications ─────────────────────────── */
.notif-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    z-index: 100;
    transition: background 0.15s, transform 0.15s;
}
.notif-fab:hover {
    background: var(--primary-hover);
    transform: scale(1.08);
}
@media (max-width: 960px) {
    .notif-fab { display: flex; align-items: center; justify-content: center; }
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.dashboard-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ─── PLANNINGS LIST ──────────────────────────────────────────────────────── */

.plannings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.plannings-loading,
.plannings-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 40px 0;
    text-align: center;
}

/* ─── ILLUSTRATED EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}
.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-state-text {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0;
}

.planning-row {
    position: relative; /* nécessaire pour le positionnement absolu du handle */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px 14px 32px; /* extra padding-left pour laisser de la place au handle */
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

/* ─── Handle de drag pour le réordonnancement des plannings ──────────────── */
/* Positionné en absolu dans le padding gauche : ne prend aucune place dans  */
/* le flux flex, donc le nom du planning reste à sa position naturelle.       */
.planning-drag-handle {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.15rem;
    opacity: 0;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    user-select: none;
    transition: opacity 0.15s;
}

.planning-row:hover .planning-drag-handle {
    opacity: 0.45;
}

.planning-drag-handle:hover {
    opacity: 0.8 !important;
    background: var(--surface);
}

/* État pendant le drag */
.planning-row-dragging {
    opacity: 0.6;
    background: var(--primary-light) !important;
}

.planning-row-dragging .planning-drag-handle {
    cursor: grabbing;
    opacity: 1;
}

.planning-row:last-child {
    border-bottom: none;
}

.planning-row:hover {
    background: var(--primary-light);
}

.planning-row-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

/* Ligne 1 : nom de la vue + icône ⚡ (dynamique) */
.planning-row-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* Icône ⚡ inline, discrète, à côté du nom */
.planning-dynamic-icon {
    font-size: 0.8rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.75;
}

/* Ligne 2 : badge de rôle + "Partagé par ..." */
.planning-row-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.planning-row-name {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    cursor: pointer;
    color: var(--text);
    transition: color 0.15s;
}
.planning-row-name:hover {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.planning-row-owner {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.planning-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    /* Les boutons Planning et Liste sont toujours en fin de liste → margin-left: auto
       repoussera les boutons variables (Share, Criteria) à gauche et les boutons
       Planning/Liste resteront alignés sur toutes les lignes via `.planning-row-main-btns` */
}

/* Groupe variable gauche : Partage + Critères (présents seulement pour owner / dynamic) */
.planning-row-var-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Groupe fixe droit : Planning + Liste — toujours présents, toujours alignés */
.planning-row-main-btns {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: auto; /* Pousse vers la droite pour alignement vertical */
}

.planning-action-icon {
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.planning-action-text {
    display: inline;
}

/* Label court des boutons de la page home (visible uniquement en mobile) */
.btn-label-short {
    display: none;
}

@media (max-width: 640px) {

    /* ── Point 2 : lignes pleine largeur sur mobile (style liste Apple Mail) ── */
    .dashboard-main {
        padding: 0;
        margin: 16px auto;
    }

    /* Sur mobile les boutons n'affichent que leur icône → ils tiennent sur la même
       ligne que le titre h2 ; flex-wrap sur les actions gère l'éventuel dépassement */
    .dashboard-header {
        padding: 0 14px;
    }
    /* Les boutons d'action peuvent se wrapper si trop nombreux */
    .dashboard-header-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    /* Masque le texte des boutons (icônes seules), conserve le tooltip via title */
    .btn-label-text {
        display: none;
    }
    /* Label court affiché en mobile à la place du label complet */
    .btn-label-short {
        display: inline;
    }

    .tasks-toolbar {
        padding: 0 14px;
    }

    /* Listes plannings : bord-à-bord, sans arrondi ni ombre */
    .plannings-list {
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    /* Lignes tâches : bord-à-bord, séparées par un trait fin */
    .task-row {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-bottom: 0;
        border-bottom: 1px solid var(--border);
    }
    .task-row:first-child {
        border-top: 1px solid var(--border);
    }

    .planning-row {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .planning-row-name {
        max-width: 100%;
    }

    .planning-row-info {
        align-self: center;
        justify-content: center;
    }

    /* ── Mobile : masquer les boutons d'actions variables (partage, critères),
       mais garder les boutons de navigation principaux (Planning, Liste) ── */
    .planning-row-var-btns { display: none !important; }
    .task-row-actions      { display: none !important; }

    /* ── Fix z-index: les conteneurs overflow:hidden clippe le menu absolu ──
       !important nécessaire : la règle desktop .task-row { overflow: hidden }
       est déclarée APRÈS ce bloc dans la feuille ; la cascade la ferait gagner
       sans !important, même à l'intérieur d'une @media query.               */
    .plannings-list {
        overflow: visible !important;
    }
    .task-row {
        overflow: visible !important;
    }

    /* ── Colonne noms : trucature au lieu du retour à la ligne sur mobile ── */
    .pn-col-user-sized .pn-row-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ── Point 4 : creative mobile enhancements ── */

    /* 4a) Colored left accent border on task rows (uses inline --task-color) */
    .task-row {
        border-left: 3px solid var(--task-accent, var(--primary));
    }

    /* 4b) Bigger touch targets: taller rows on mobile */
    .planning-row {
        min-height: 52px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    .task-row-header {
        min-height: 48px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* 4c) Active press feedback on mobile rows */
    .planning-row:active {
        background: var(--primary-light);
        transition: background 0s;
    }
    .task-row-header:active {
        background: var(--primary-light);
        transition: background 0s;
    }

    /* 4d) Floating action button adjusted for edge-to-edge layout */
    .notif-fab {
        bottom: 20px;
        right: 16px;
    }

    /* 4e) Planning Gantt: scroll fade hint on the left edge */
    .timeline-container::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 24px;
        height: 100%;
        background: linear-gradient(to left, rgba(0,0,0,0.04), transparent);
        pointer-events: none;
        z-index: 2;
    }
}

/* ─── OVERFLOW MENU (menu secondaire ⋮) ──────────────────────────────────── */
/* Bouton ⋮ : toujours visible sur desktop et mobile */
.btn-overflow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.btn-overflow:hover,
.btn-overflow:active {
    background: var(--primary-light);
    color: var(--text);
}

/* Ligne parente avec menu ouvert : surélévée pour couvrir les lignes suivantes */
.planning-row.overflow-open,
.task-row.overflow-open {
    z-index: 10;
    position: relative;
    overflow: visible; /* lève le clip overflow:hidden pour que le dropdown sorte de la ligne */
}

/* Menu déroulant des actions, positionné sous le bouton ⋮ */
.overflow-menu {
    display: none;
    position: absolute;
    right: 8px;
    top: 100%;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.13);
    z-index: var(--z-dropdown);
    padding: 4px 0;
    animation: overflowIn 0.15s ease;
}

@keyframes overflowIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Menu positionné vers le haut quand il dépasserait la fenêtre en bas */
.overflow-menu-up {
    top: auto;
    bottom: 100%;
    animation: overflowInUp 0.15s ease;
}

@keyframes overflowInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.overflow-menu.open {
    display: flex;
    flex-direction: column;
}

.overflow-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 0.12s;
}
.overflow-item:hover,
.overflow-item:active {
    background: var(--primary-light);
}
.overflow-item-danger {
    color: var(--danger);
}
.overflow-item-danger:hover {
    background: rgba(231, 76, 60, 0.08);
}

/* Items masqués dans le menu ⋮ en mode desktop (les boutons directs existent déjà) */
@media (min-width: 641px) {
    .overflow-desktop-hide {
        display: none;
    }
}

/* Label court des boutons (mobile uniquement) : voir règle définie plus haut */

.role-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Dans la ligne de métadonnées sous le nom, les badges sont encore plus petits */
.planning-row-meta .role-badge {
    font-size: 0.62rem;
    padding: 1px 6px;
}

.role-owner {
    background: rgba(99, 110, 114, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.role-write {
    background: rgba(99, 110, 114, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.role-read {
    background: rgba(99, 110, 114, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ─── SHARES UI ───────────────────────────────────────────────────────────── */

.shares-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 32px;
}

.share-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
}

.share-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.share-email {
    font-size: 0.82rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-access-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
}

.share-write {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.share-read {
    background: rgba(99, 110, 114, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TASKS PAGE (page dédiée /tasks)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Corps de la page tasks : plein écran comme la page planning */
body.tasks-page {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

body.tasks-page > main.tasks-page-main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Layout principal : contenu (gauche) + sidebar activité (droite) */
.tasks-page-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Colonne principale scrollable */
.tasks-main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px 24px;
    min-width: 0;
}

/* ── Barre de contrôle pleine largeur — recherche, tri, groupement, champs.
   Style cohérent avec la barre de contrôle (.zoom-controls) de la page planning. ── */
.tasks-toolbar-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 24px;
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    /* Anti-autofill: les inputs hidden n'affectent pas le layout */
    position: relative;
}

.tasks-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

/* ── Sidebar activité récente ────────────────────────────────────────────── */
/* Scoped à min-width pour éviter le conflit de cascade avec la règle mobile
   (même spécificité — la règle plus tardive gagnait même dans le media query) */
@media (min-width: 961px) {
    body.tasks-page .tasks-activity-sidebar {
        width: 300px;
        flex-shrink: 0;
        border-left: 1px solid var(--border);
        background: var(--bg-card);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
}

.tasks-activity-sidebar .notif-panel-header-mobile {
    /* Réutilise le style du panneau home mais le rend toujours visible */
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.tasks-activity-sidebar .notif-title {
    border-bottom: none;
    padding: 0;
    flex: 1;
}

.tasks-activity-sidebar .notif-close-btn {
    display: none; /* masqué sur desktop, visible sur mobile */
}

.tasks-activity-sidebar .notif-list {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   TASKS SECTION (plannings page)
   ═══════════════════════════════════════════════════════════════════════════ */

.tasks-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

/* ─── Sort menu (bouton icône + dropdown) ───────────────── */
.sort-menu-wrap {
    position: relative;
    flex-shrink: 0;
}

.sort-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 190px;
    z-index: 200;
    overflow: hidden;
}

.sort-menu.open {
    display: block;
}

.sort-menu-item {
    display: block;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text);
    text-align: left;
    font-family: inherit;
    transition: background 0.1s;
}

.sort-menu-item:last-child {
    border-bottom: none;
}

.sort-menu-item:hover {
    background: var(--bg);
}

.sort-menu-item.active {
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-light);
}

/* ─── Search field with persistent icon + clear ─────────── */
.tasks-search-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 1 260px;
    min-width: 160px;
}

.tasks-search-icon {
    position: absolute;
    left: 9px;
    font-size: 0.8rem;
    pointer-events: none;
    user-select: none;
    line-height: 1;
    z-index: 1;
}

.tasks-search-clear {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    color: var(--text-muted);
    opacity: 0.7;
    transition: opacity 0.12s, color 0.12s;
}

.tasks-search-clear:hover {
    opacity: 1;
    color: var(--danger);
}

.tasks-search-input {
    width: 100%;
    padding: 6px 24px 6px 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.82rem;
}

.tasks-field-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.task-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    padding: 3px 8px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

/* Mode sombre : fond légèrement plus clair que le fond de page */
@media (prefers-color-scheme: dark) {
    .task-filter-chip { background: var(--surface); }
}
[data-theme="dark"] .task-filter-chip { background: var(--surface); }
[data-theme="light"] .task-filter-chip { background: #fff; }

/* ── Chips figés (filtres dynamiques automatiques) ── */
.dynamic-frozen-chip {
    cursor: default;
    opacity: 0.9;
    border-color: var(--primary, #4A90D9);
    background: color-mix(in srgb, var(--primary, #4A90D9) 8%, #fff 92%);
}
[data-theme="dark"] .dynamic-frozen-chip {
    background: color-mix(in srgb, var(--primary, #4A90D9) 15%, var(--surface) 85%);
}
@media (prefers-color-scheme: dark) {
    :not([data-theme="light"]) .dynamic-frozen-chip {
        background: color-mix(in srgb, var(--primary, #4A90D9) 15%, var(--surface) 85%);
    }
}
.dynamic-frozen-value {
    font-style: italic;
    color: var(--text-muted);
}
.dynamic-frozen-labels {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}
.dynamic-frozen-tag {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 10px;
    color: #fff;
    white-space: nowrap;
}
.dynamic-frozen-op {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 3px;
    padding: 1px 4px;
}
.dynamic-frozen-or {
    background: var(--warning-light, #fff3cd);
    color: var(--warning, #856404);
    border: 1px solid var(--warning, #ffc107);
}
.dynamic-frozen-and {
    background: var(--info-light, #cfe2ff);
    color: var(--info, #084298);
    border: 1px solid var(--info, #6ea8fe);
}

/* Icône ⚙️ décorative à l'intérieur du badge ⚡ Dynamique (non-interactive) */
.btn-gear-dynamic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 0 6px;
    margin: 0;
    font-size: 1.1em;
    line-height: 1;
    opacity: 0.8;
    vertical-align: middle;
    transition: opacity 0.15s;
    pointer-events: none; /* Le clic est géré par le badge parent */
}
/* Badge entier cliquable pour le propriétaire */
.dynamic-badge.clickable {
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s;
}
.dynamic-badge.clickable:hover {
    opacity: 0.85;
}
.dynamic-badge.clickable:hover .btn-gear-dynamic {
    opacity: 1;
}

.task-filter-chip input[type="checkbox"] { margin: 0; }

.bool-filter-chip,
.task-filter-label-chip {
    cursor: default;
}

.bool-filter-state {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 0.74rem;
    font-family: inherit;
    cursor: pointer;
}

.bool-filter-state:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-radius: 4px;
}

/* Noms de plannings dans la liste leave-preview */
.leave-task-plannings {
    font-size: 0.8em;
    color: var(--text-muted);
    font-style: italic;
}
.task-filter-label-chip .field-filter-label {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.74rem;
    width: 90px;
    color: var(--text);
}
.task-filter-label-chip .field-filter-label::placeholder { color: var(--text-muted); }

/* Input de filtre label dans la barre de planning */
.planning-filter-chip .field-filter-label,
.bool-filter-state {
    background: transparent;
}

.label-filter-combo-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.field-filter-label {
    padding-right: 20px;
}
.label-filter-clear {
    position: absolute;
    right: 1px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    color: var(--text-muted);
    opacity: 0.7;
    transition: opacity 0.12s, color 0.12s;
}
.label-filter-clear:hover {
    opacity: 1;
    color: var(--danger);
}
.label-filter-drop {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    z-index: var(--z-dropdown);
    background: var(--bg, #ffffff);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.28);
    max-height: 180px;
    overflow-y: auto;
    margin-top: 2px;
}
.label-filter-item,
.label-ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text);
    transition: background 0.1s;
}
.label-filter-item:hover,
.label-ac-item:hover { background: var(--surface); }
.label-filter-item.kb-focused,
.label-ac-item.kb-focused { background: var(--surface); outline: 2px solid var(--primary); outline-offset: -2px; }

.label-filter-more,
.label-ac-more {
    padding: 5px 10px;
    font-size: 0.76rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
    cursor: default;
    user-select: none;
}

.task-field-tag[data-field-id] { cursor: pointer; transition: opacity .15s; }
.task-field-tag[data-field-id]:hover { opacity: 0.75; }

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ─── Vue groupée ──────────────────────────────────────────────────────────── */
.task-group {
    margin-bottom: 6px;
}

.task-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    transition: background 0.15s;
    /* Colle directement au contenu du groupe */
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.task-group-header:hover {
    background: var(--primary-light, #eef4ff);
}

.task-group-header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.task-group-chevron {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.task-group-chevron.collapsed {
    transform: rotate(-90deg);
}

.task-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.task-group-count {
    flex-shrink: 0;
    background: var(--border);
    color: var(--text-muted);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Pastille couleur pour les champs label */
.task-group-label-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Indicateur oui/non pour les champs booléens */
.task-group-bool {
    font-weight: 700;
    font-size: 0.85rem;
}
.task-group-bool-yes { color: var(--success, #27ae60); }
.task-group-bool-no  { color: var(--danger,  #e74c3c); }
.task-group-unset    { color: var(--text-muted); }

.task-group-content {
    border: 1px solid var(--border);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    overflow: hidden;
    /* Annule le border-radius des tâches enfants pour un rendu continu */
}

/* Quand un menu overflow est ouvert dans le groupe, lever le clip pour que
   le dropdown ne soit pas tronqué par overflow:hidden */
.task-group-content:has(.task-row.overflow-open) {
    overflow: visible;
}

/* Les .task-row à l'intérieur d'un groupe : flush contre le contenu */
.task-group-content .task-row {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

/* Arrondir les coins bas du dernier task-row pour conserver le visuel quand
   overflow:hidden est levé (menu overflow ouvert sur la dernière tâche) */
.task-group-content .task-row:last-child {
    border-bottom: none;
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 7px;
}

/* Bouton group-by actif : couleur accentuée */
.btn-group-active {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: var(--primary-light, #eef4ff) !important;
}



.task-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    background: var(--surface);
    overflow: hidden;
    background: var(--bg-card);
}

.task-row-header {
    position: relative; /* ancrage pour le menu overflow mobile */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    gap: 12px;
}

.task-row-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
}

.task-main-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: min(340px, 56vw);
    flex: 0 1 auto;
}

.task-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-row-name {
    display: inline-block;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-row-name:hover { text-decoration: underline; }

.task-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Field badges (inline) */
.task-field-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 20px;
    white-space: nowrap;
}

.task-field-bool {
    background: rgba(39, 174, 96, 0.12);
    color: var(--success);
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.task-field-tag {
    color: #fff;
    border: none;
}

/* Task accordion (comments) */
.task-accordion {
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    background: var(--bg);
}

.task-comments-container {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.task-comment-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

/* Conteneur principal (méta + texte) empilés verticalement */
.task-comment-item .task-comment-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Actions (éditer / supprimer) à droite */
.task-comment-item .comment-actions {
    flex-shrink: 0;
}

.task-comment-item:last-child { border-bottom: none; }

.task-comment-text {
    font-size: 0.82rem;
    line-height: 1.45;
}

.task-comment-text > :first-child {
    margin-top: 0;
}

.task-comment-text > :last-child {
    margin-bottom: 0;
}

.task-comment-text p,
.task-comment-text ul,
.task-comment-text ol,
.task-comment-text pre,
.task-comment-text blockquote {
    margin: 6px 0;
}

.task-comment-text ul,
.task-comment-text ol {
    padding-left: 18px;
}

.task-new-comment {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.task-new-comment textarea {
    flex: 1;
    resize: vertical;
    min-height: 36px;
    font-size: 0.82rem;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}

/* Task accordion — plannings panel + mini timeline */
.task-info-panel {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.task-info-plannings {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.task-info-label {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.8rem;
}

.task-planning-chip {
    background: var(--bg-subtle, #f0f4f8);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1px 9px;
    font-size: 0.78rem;
    color: var(--text);
    text-decoration: none;
    display: inline-block;
}

/* Chip cliquable (lien vers un planning) */
a.task-planning-chip-link {
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
a.task-planning-chip-link:hover {
    background: var(--primary, #4A90D9);
    border-color: var(--primary, #4A90D9);
    color: #fff;
    text-decoration: none;
}

.task-mini-timeline-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.task-mini-timeline {
    position: relative;
    height: 14px;
    background: var(--bg-subtle, #f0f4f8);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.task-mini-range {
    position: absolute;
    top: 2px;
    height: 10px;
    border-radius: 3px;
    opacity: 0.82;
    min-width: 3px;
    cursor: default;
}

.task-mini-today {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--danger, #e53e3e);
    opacity: 0.6;
}

.task-mini-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.73rem;
    color: var(--text-muted);
    padding: 0 2px;
}

/* Edit task modal – custom fields (redesigned) */
.edit-task-fields {
    margin-top: 10px;
}

/* ── Section wrapper ─────────────────────────────────────────────────── */
.edit-fields-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 14px;
}

.edit-fields-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.edit-fields-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* ── Grille de tuiles de champs ──────────────────────────────────────── */
.edit-fields-tiles {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Tuile générique ─────────────────────────────────────────────────── */
.edit-field-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.82rem;
}

/* ── Tuile boolean : checkbox + nom + ✕ à droite sur une ligne ───────── */
.edit-field-tile-bool {
    display: flex;
    align-items: center;
    gap: 6px;
}

.edit-field-bool-row {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.edit-field-tile-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Tuile label : en-tête (nom + ✕) + token-input en dessous ─────────── */
.edit-field-tile-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.edit-field-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

/* Bouton de suppression d'un champ — harmonisé avec .btn-remove (ranges/jalons) */
.btn-field-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--danger);
    font-size: 0.82rem;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0.45;
    line-height: 1;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}

.btn-field-remove:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.1);
}

/* ── Token-input (style "destinataire email") ────────────────────────── */

/* Wrapper relatif pour le dropdown */
.field-token-wrap {
    position: relative;
}

/* La boîte qui contient chips + champ texte inline */
.field-token-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-token-box:focus-within {
    border-color: var(--primary, #4A90D9);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

/* Input invisible dans la boîte token */
.field-token-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.82rem;
    color: var(--text);
    min-width: 90px;
    flex: 1;
    padding: 2px 2px;
    line-height: 1.4;
}

.field-token-input::placeholder {
    color: var(--text-muted);
}

/* Chips de labels dans le token-input */
.edit-label-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px 2px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
    white-space: nowrap;
}

.btn-label-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.65rem;
    padding: 0 1px;
    line-height: 1;
    transition: color 0.12s;
}

.btn-label-remove:hover { color: #fff; }

/* Dropdown autocomplete labels */
.label-ac-drop {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--z-dropdown);
    background: var(--bg, #ffffff);
    background-color: var(--bg, #ffffff);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    max-height: 180px;
    overflow-y: auto;
    margin-top: 3px;
    isolation: isolate;
}

.label-ac-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.label-ac-new {
    color: var(--primary);
    font-style: italic;
}

/* ── Combobox ajout de champ (dans l'en-tête de section) ─────────────── */
.add-field-combo-wrap {
    position: relative;
    flex-shrink: 0;
}

.add-field-input {
    font-size: 0.78rem;
    padding: 4px 10px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    width: 160px;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.add-field-input:focus {
    outline: none;
    border-color: var(--primary, #4A90D9);
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.12);
}

.add-field-input::placeholder { color: var(--text-muted); }

.add-field-drop {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: var(--z-dropdown);
    background: var(--bg, #ffffff);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    max-height: 180px;
    overflow-y: auto;
    margin-top: 2px;
    min-width: 180px;
}

.add-field-drop-item {
    padding: 7px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text);
}

.add-field-drop-item:hover { background: var(--surface); }

/* Formulaire inline de création de nouveau champ (modal gestion champs) */
.edit-new-field-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.new-field-name-input {
    flex: 1;
    min-width: 80px;
    font-size: 0.82rem;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}

.new-field-type-select {
    font-size: 0.82rem;
    padding: 5px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

/* Add field selector */
.add-field-select {
    width: 100%;
    font-size: 0.82rem;
    padding: 5px 8px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
}

.add-field-select:focus {
    outline: none;
    border-color: var(--primary);
    color: var(--text);
}

/* Fields management modal */
.field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.field-type-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.field-tag-remove {
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
}

.field-tag-remove:hover { opacity: 1; }

/* Catalog modal */
.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.catalog-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
}

.catalog-item-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.catalog-item-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-item-add {
    flex-shrink: 0;
}

/* ─── Combobox catégorie ─────────────────────────────────────────────────────── */

.cat-combo {
    position: relative;
}

.cat-combo-input {
    width: 100%;
}

.cat-combo-drop {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    max-height: 200px;
    overflow-y: auto;
}

.cat-combo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: .88rem;
    color: var(--text);
}

.cat-combo-item:hover {
    background: var(--bg-subtle, #f6f8fa);
}

.cat-combo-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.08);
}

.cat-combo-new {
    color: var(--primary, #4A90D9);
    font-style: italic;
}

/* ─── Commentaires dans l'accordéon tâches (vue home) ────────────────────────── */

.task-comment-item .comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
}

.task-comment-item .comment-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: auto;
}

/* ─── Champs personnalisés — field-row restructuré ───────────────────────────── */

.field-row .field-row-name {
    flex: 1;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Attributs inline (par défaut / obligatoire) */
.field-attrs {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.field-attr-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.field-attr-label input[type="checkbox"] {
    margin: 0;
    width: 13px;
    height: 13px;
    cursor: pointer;
}

.field-new-attrs {
    display: flex;
    align-items: center;
}

/* ─── Texte d'aide dans les formulaires (form-hint) ─────────────────────────── */

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Avertissement inline (ex: tâche hors filtres dans un planning dynamique) */
.form-warn {
    background: rgba(243, 156, 18, 0.10);
    color: #9a6b00;
    border: 1px solid rgba(243, 156, 18, 0.35);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.82rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

/* Boutons de l'avertissement */
.form-warn-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Modal — Filtres dynamiques (planning dynamique) ────────────────────────── */

/* Conteneur de toutes les lignes de critères */
#dynamic-filters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
    max-height: 340px;
    overflow-y: auto;
}

/* Ligne de critère : champ | condition | labels | × */
.dynamic-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    align-items: start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
}

.dynamic-filter-row:hover {
    border-color: var(--border-strong);
}

/* Sélecteurs champ et opérateur : reprend le style .form-group select */
.dynamic-filter-field-sel,
.dynamic-filter-op-sel {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.dynamic-filter-field-sel:focus,
.dynamic-filter-op-sel:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.1);
}

/* Zone des labels (visible uniquement pour has_any_label / has_all_labels) */
.dynamic-filter-labels-wrap {
    grid-column: 1 / -2;     /* s'étire sur col 1 et col 2 seulement  */
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0 2px;
}

/* Ligne "labels" visible : prend toute la largeur sous champ+opérateur */
.dynamic-filter-row.has-labels {
    grid-template-columns: 1fr 1fr auto;
    grid-template-rows: auto auto;
}

.dynamic-filter-row.has-labels .dynamic-filter-labels-wrap {
    grid-column: 1 / 3;
    grid-row: 2;
}

.dynamic-filter-row.has-labels .dynamic-filter-del {
    grid-row: 1;
    grid-column: 3; /* Forcer la dernière colonne — sans ça, le placement
                       auto CSS Grid le met en col 1 avant fieldSel/opSel */
}

/* Chaque checkbox de label */
.dynamic-filter-label-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    font-size: 0.78rem;
}

.dynamic-filter-label-check input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Tag de label (pastille colorée) */
.dynamic-filter-label-check .tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    background: var(--border-strong);  /* fallback si pas de couleur */
}

/* Bouton supprimer la ligne */
.dynamic-filter-del {
    align-self: start;
    flex-shrink: 0;
    padding: 4px 8px !important;
    font-size: 1rem !important;
    line-height: 1;
}

/* ═════════════════════════════════════════════════════════════════════════════
   LANDING PAGE
   ═════════════════════════════════════════════════════════════════════════════ */

.landing-page {
    --landing-bg: #0f172a;
    --landing-surface: #1e293b;
    --landing-text: #e2e8f0;
    --landing-muted: #94a3b8;
    --landing-primary: #6366f1;
    --landing-primary-hover: #818cf8;
    --landing-accent: #06b6d4;
    margin: 0;
    padding: 0;
    background: var(--landing-bg);
    color: var(--landing-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow-x: hidden;
}

/* ── Top bar ─────────────────────────────────────────────────────────────────── */
.landing-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.landing-logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.landing-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lang-flag-btn {
    background: none;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
}
.lang-flag-btn.active, .lang-flag-btn:hover {
    opacity: 1;
    border-color: var(--landing-primary);
}
.flag-img {
    width: 24px;
    height: 16px;
    display: block;
    border-radius: 2px;
    object-fit: cover;
}
.btn-small {
    padding: 6px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}
.landing-page .btn-primary {
    background: var(--landing-primary);
    color: #fff;
    border: none;
}
.landing-page .btn-primary:hover {
    background: var(--landing-primary-hover);
}
.landing-page .btn-secondary {
    background: transparent;
    color: var(--landing-text);
    border: 1px solid rgba(255,255,255,0.18);
}
.landing-page .btn-secondary:hover {
    background: rgba(255,255,255,0.06);
}

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.landing-hero {
    text-align: center;
    padding: 80px 24px 60px;
    background: linear-gradient(180deg, rgba(99,102,241,0.08) 0%, transparent 60%);
}
.landing-hero-inner {
    max-width: 700px;
    margin: 0 auto;
}
.landing-kicker {
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--landing-accent);
    margin-bottom: 12px;
}
.landing-hero-title {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 20px;
    background: linear-gradient(135deg, #fff 40%, var(--landing-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.landing-hero-lead {
    font-size: 1.15rem;
    color: var(--landing-muted);
    line-height: 1.6;
    margin: 0 0 32px;
}
.landing-hero-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}
.landing-hero-actions .btn {
    padding: 12px 28px;
    font-size: 1rem;
    border-radius: 10px;
    font-weight: 600;
}

/* ── Features grid ───────────────────────────────────────────────────────────── */
.landing-features {
    padding: 60px 24px 80px;
    max-width: 1080px;
    margin: 0 auto;
}
.landing-section-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 48px;
}
.landing-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.landing-feature-card {
    background: var(--landing-surface);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 28px 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.landing-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(99,102,241,0.12);
}
.landing-feature-icon {
    font-size: 2rem;
    margin-bottom: 14px;
}
.landing-feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 10px;
}
.landing-feature-card p {
    font-size: 0.92rem;
    color: var(--landing-muted);
    line-height: 1.55;
    margin: 0;
}

/* ── CTA section ─────────────────────────────────────────────────────────────── */
.landing-cta {
    text-align: center;
    padding: 60px 24px 80px;
    background: linear-gradient(180deg, transparent, rgba(99,102,241,0.06));
}
.landing-cta h2 {
    font-size: 1.8rem;
    margin: 0 0 12px;
}
.landing-cta p {
    color: var(--landing-muted);
    font-size: 1.05rem;
    margin: 0 0 28px;
}
.landing-cta .btn {
    padding: 14px 36px;
    font-size: 1.05rem;
    border-radius: 10px;
    font-weight: 600;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.landing-footer {
    text-align: center;
    padding: 20px;
    color: var(--landing-muted);
    font-size: 0.82rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Auth modal on landing page ──────────────────────────────────────────────── */
.landing-page .modal-overlay {
    background: rgba(0,0,0,0.55);
}
.landing-page .modal {
    background: var(--landing-surface);
    color: var(--landing-text);
}
.landing-page .modal-header {
    border-bottom-color: rgba(255,255,255,0.08);
}
.landing-page .modal-close {
    color: var(--landing-muted);
}
.landing-page .auth-tabs {
    border-color: rgba(255,255,255,0.12);
}
.landing-page .auth-tab {
    color: var(--landing-muted);
}
.landing-page .auth-tab.active {
    color: #fff;
    border-bottom-color: var(--landing-primary);
}
.landing-page .form-group label {
    color: var(--landing-muted);
}
.landing-page .form-group input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: var(--landing-text);
}
.landing-page .form-group input:focus {
    border-color: var(--landing-primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.25);
}
.landing-page .auth-subtitle {
    color: var(--landing-muted);
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
    .landing-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .landing-hero-title {
        font-size: 2rem;
    }
}
@media (max-width: 560px) {
    .landing-features-grid {
        grid-template-columns: 1fr;
    }
    .landing-topbar {
        padding: 10px 16px;
    }
    .landing-hero {
        padding: 48px 16px 40px;
    }
    .landing-hero-title {
        font-size: 1.6rem;
    }
    .landing-hero-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* ─── Undo toast ──────────────────────────────────────────── */
.undo-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 10px 18px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    z-index: 9999;
    font-size: .9rem;
    animation: toast-in .25s ease;
}
.undo-toast.error-toast {
    background: var(--danger, #c0392b);
    color: #fff;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.btn-undo {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    font-weight: 600;
    cursor: pointer;
}

/* ─── STATS BAR (bandeau statistiques page home) ──────────────────────────── */

.home-stats-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 4px 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stats-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.stats-muted {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.stats-sep {
    color: var(--border-strong);
    font-size: 0.82rem;
    user-select: none;
}

/* Chip "hors vue" cliquable */
.stats-orphan-btn {
    background: none;
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.8rem;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.stats-orphan-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* Lien "Liste" stylisé comme un bouton secondaire */
.view-list-link {
    text-decoration: none;
}
.view-list-link:hover {
    text-decoration: none;
}

/* ─── MODAL TÂCHES ORPHELINES ─────────────────────────────────────────────── */

.orphan-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.orphan-task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    transition: background 0.12s;
}

.orphan-task-row:hover {
    background: var(--bg-lighter);
}

.orphan-task-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.orphan-task-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orphan-task-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Point de couleur de la tâche orpheline */
.task-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Picker de vue (sélecteur inline) */
.orphan-view-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.orphan-view-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem;
    background: var(--bg-card);
    color: var(--text);
}

/* Comptage de tâches correspondantes dans la modale critères dynamiques */
.dynamic-filters-match-count {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(108, 99, 255, 0.08);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 500;
}
