/* ============================================================
   NOTEBOOK.CSS — Cahier de Réussite Intelligent
   Styles du nouveau module
   ============================================================ */

/* ============================================================
   NOTEBOOK.CSS — Cahier de Réussite Intelligent
   Styles du nouveau module. Les tokens --cahier-* sont des alias vers les tokens globaux
   définis dans reader.css (:root / [data-theme="light"]) afin
   que le Cahier respecte automatiquement le thème clair/sombre.
   ============================================================ */

:root {
    --cahier-bg: var(--bg-elevated);
    --cahier-border: var(--border);
    --cahier-text: var(--text-primary);
    --cahier-muted: var(--text-secondary);
    --cahier-muted-2: var(--text-muted);
    --cahier-accent: var(--accent);
    --cahier-accent-2: var(--accent-2);
    --cahier-radius: 8px;

    /* Surfaces adaptatives (claires en dark, sombres en light) */
    --surface-1: rgba(255,255,255,0.01);
    --surface-2: rgba(255,255,255,0.02);
    --surface-3: rgba(255,255,255,0.03);
    --surface-4: rgba(255,255,255,0.04);
    --surface-5: rgba(255,255,255,0.05);
    --surface-6: rgba(255,255,255,0.06);
    --surface-8: rgba(255,255,255,0.08);
    --surface-20: rgba(255,255,255,0.2);
}
[data-theme="light"] {
    --surface-1: rgba(20,16,8,0.02);
    --surface-2: rgba(20,16,8,0.03);
    --surface-3: rgba(20,16,8,0.04);
    --surface-4: rgba(20,16,8,0.05);
    --surface-5: rgba(20,16,8,0.06);
    --surface-6: rgba(20,16,8,0.08);
    --surface-8: rgba(20,16,8,0.1);
    --surface-20: rgba(20,16,8,0.18);
}

#cahierFullscreen {
    display: none;
    flex-direction: column;
    height: 100%;
    background: transparent;
    color: var(--cahier-text);
    font-family: 'Inter', sans-serif;
}

/* ---- Onglets ---- */
#cahierTabs {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--cahier-border);
    flex-wrap: nowrap;
    overflow: hidden;
}
#cahierTabs [data-cahier-tab] { flex-shrink: 0; }

#cahierTabs [data-cahier-tab] {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--surface-3);
    color: var(--cahier-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cahier-tabs-more {
    padding: 6px 14px; border-radius: 6px; border: 1px dashed var(--cahier-border);
    background: transparent; color: var(--cahier-muted-2); font-size: 0.7rem; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s ease;
}
.cahier-tabs-more:hover { background: var(--surface-3); color: var(--cahier-text); border-style: solid; }
.cahier-tabs-more.active { background: var(--accent-soft); color: var(--cahier-accent); border-color: rgba(var(--accent-rgb), 0.25); border-style: solid; }

#cahierTabs [data-cahier-tab]:hover {
    background: var(--surface-6);
    color: var(--cahier-text);
}

#cahierTabs [data-cahier-tab].active {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-2-rgb), 0.08));
    border-color: rgba(var(--accent-rgb), 0.3);
    color: var(--cahier-accent);
    font-weight: 600;
}

#cahierTabContent {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

.cahier-tab-pane { display: none; }
.cahier-tab-pane.active { display: block; }

/* ---- États vides / chargement ---- */
.cahier-empty, .cahier-loading {
    text-align: center;
    padding: 50px 20px;
    color: var(--cahier-muted-2);
}
.cahier-empty i, .cahier-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    opacity: 0.4;
}

/* ---- Boutons génériques ---- */
.cahier-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--cahier-border);
    background: var(--surface-3);
    color: var(--cahier-muted);
    font-size: 0.68rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cahier-btn:hover { background: var(--surface-6); color: var(--cahier-text); }
.cahier-btn.primary {
    background: var(--ink);
    color: var(--ink-text);
    font-weight: 600;
    border: none;
}
.cahier-btn.favorite-active { background: rgba(var(--favorite-rgb), 0.15); color: var(--favorite); border-color: rgba(var(--favorite-rgb), 0.35); }
.cahier-btn.small { padding: 4px 10px; font-size: 0.6rem; }

.icon-btn {
    background: none; border: none; color: var(--cahier-muted-2);
    cursor: pointer; padding: 4px 6px; border-radius: 6px; transition: all 0.2s ease;
}
.icon-btn:hover { color: var(--danger); background: rgba(217,115,106,0.1); }

.cahier-search {
    flex: 1;
    padding: 7px 12px;
    background: var(--surface-4);
    border: 1px solid var(--cahier-border);
    border-radius: 6px;
    color: var(--cahier-text);
    font-size: 0.7rem;
    outline: none;
}
.cahier-search:focus { border-color: rgba(var(--accent-rgb), 0.3); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.dash-card {
    background: var(--surface-3);
    border: 1px solid var(--cahier-border);
    border-radius: 6px;
    padding: 14px;
    text-align: center;
    transition: transform 0.2s ease;
}
.dash-card:hover { transform: translateY(-2px); }
.dash-icon { font-size: 1.4rem; margin-bottom: 4px; }
.dash-value { font-size: 1.3rem; font-weight: 700; color: var(--cahier-accent); }
.dash-label { font-size: 0.55rem; color: var(--cahier-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }

.dash-charts-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 12px; }
.dash-chart-card {
    background: var(--surface-2); border: 1px solid var(--cahier-border); border-radius: 12px;
    padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.dash-chart-title { font-size: 0.65rem; font-weight: 700; color: var(--cahier-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.dash-chart-canvas-wrap { position: relative; height: 160px; }
.dash-chart-canvas-wrap-donut { height: 140px; }
@media (max-width: 700px) {
    .dash-charts-row { grid-template-columns: 1fr; }
}

.dash-hint {
    background: var(--accent-soft);
    border-left: 3px solid var(--cahier-accent);
    padding: 12px 16px;
    border-radius: 0 10px 10px 0;
    font-size: 0.75rem;
    color: var(--cahier-muted);
    line-height: 1.6;
}

@media (max-width: 700px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Hero "Continuer / Aujourd'hui" ---- */
.dash-hero {
    display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 18px;
}
.dash-hero-main {
    background: linear-gradient(135deg, var(--accent-soft), transparent);
    border: 1px solid var(--cahier-border); border-radius: 8px; padding: 22px 24px;
    display: flex; flex-direction: column; gap: 10px; justify-content: center;
}
.dash-hero-eyebrow { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--cahier-accent); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.dash-hero-title { font-size: 1.15rem; font-weight: 700; color: var(--cahier-text); line-height: 1.3; }
.dash-hero-main .cahier-btn { align-self: flex-start; margin-top: 4px; }

.dash-hero-today {
    background: var(--surface-2); border: 1px solid var(--cahier-border); border-radius: 8px;
    padding: 18px 20px; display: flex; flex-direction: column; gap: 8px;
}
.dash-side-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--cahier-muted-2); font-weight: 700; margin-bottom: 4px; }
.dash-attention-item { font-size: 0.72rem; color: var(--cahier-text); display: flex; align-items: center; gap: 8px; }
.dash-attention-item i { color: var(--warning); width: 14px; }
.dash-attention-item.calm i { color: var(--success); }
.dash-side-link { margin-top: auto; align-self: flex-start; background: none; border: none; color: var(--cahier-accent); font-size: 0.65rem; cursor: pointer; padding: 0; }
.dash-side-link:hover { text-decoration: underline; }

/* ---- Sections génériques ---- */
.dash-section { margin-bottom: 18px; }

/* ============================================================
   RÉGULARITÉ — série de jours (streak) + heatmap de contribution
   ============================================================ */
.dash-streak-row { display: flex; gap: 28px; margin-bottom: 16px; flex-wrap: wrap; }
.dash-streak-stat { display: flex; flex-direction: column; gap: 2px; }
.dash-streak-num { font-size: 1.6rem; font-weight: 800; color: var(--cahier-text); line-height: 1; }
.dash-streak-label { font-size: 0.6rem; color: var(--cahier-muted); }
.dash-heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.dash-heatmap-months {
    display: grid; grid-auto-flow: column; grid-auto-columns: 12px; gap: 2px;
    font-size: 0.52rem; color: var(--cahier-muted-2); margin-bottom: 3px; margin-left: 2px;
}
.dash-heatmap-grid {
    display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; grid-auto-columns: 12px; gap: 2px;
}
.dash-heatmap-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }
.dash-heatmap-cell.empty { background: transparent; }
.dash-heatmap-cell.level-0 { background: var(--surface-3); }
.dash-heatmap-cell.level-1 { background: rgba(var(--accent-rgb), 0.25); }
.dash-heatmap-cell.level-2 { background: rgba(var(--accent-rgb), 0.45); }
.dash-heatmap-cell.level-3 { background: rgba(var(--accent-rgb), 0.7); }
.dash-heatmap-cell.level-4 { background: var(--cahier-accent); }

.dash-section-header { font-size: 0.68rem; font-weight: 700; color: var(--cahier-text); display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dash-section-header i { color: var(--cahier-accent); }
.dash-section-empty {
    text-align: center; padding: 30px 20px; color: var(--cahier-muted-2);
    background: var(--surface-2); border: 1px dashed var(--cahier-border); border-radius: 6px;
}
.dash-section-empty i { font-size: 1.6rem; opacity: 0.4; margin-bottom: 8px; display: block; }
.dash-section-empty p { font-size: 0.72rem; max-width: 420px; margin: 0 auto; line-height: 1.6; }

.dash-objectives-list { display: flex; flex-direction: column; gap: 10px; }
.dash-objective-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--surface-2); border: 1px solid var(--cahier-border); border-radius: 6px; cursor: pointer; transition: all 0.2s ease;
}
.dash-objective-row:hover { background: var(--surface-4); }
.dash-objective-title { font-size: 0.72rem; color: var(--cahier-text); flex: 0 0 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-objective-track { flex: 1; height: 5px; background: var(--surface-6); border-radius: 4px; overflow: hidden; }
.dash-objective-fill { height: 100%; background: linear-gradient(90deg, var(--cahier-accent), var(--accent-light)); border-radius: 4px; }
.dash-objective-pct { font-size: 0.65rem; color: var(--cahier-accent); font-weight: 700; min-width: 32px; text-align: right; }

@media (max-width: 700px) {
    .dash-hero { grid-template-columns: 1fr; }
}

/* ============================================================
   NOTES
   ============================================================ */
.notes-toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

.new-note-split { display: flex; position: relative; }
.new-note-main { border-radius: 6px 0 0 6px !important; border-right: 1px solid rgba(255,255,255,0.15) !important; }
.new-note-caret { border-radius: 0 6px 6px 0 !important; padding: 8px 10px !important; }
.new-note-menu {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; z-index: 20;
    background: var(--cahier-bg); border: 1px solid var(--cahier-border); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
}
.new-note-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.new-note-menu-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 7px; cursor: pointer;
    font-size: 0.72rem; color: var(--cahier-text); transition: background 0.12s ease;
}
.new-note-menu-item:hover { background: var(--surface-5); }
.new-note-menu-item i { width: 16px; text-align: center; color: var(--cahier-muted); }
.new-note-menu-hint { margin-left: auto; font-size: 0.55rem; color: var(--cahier-muted-2); }
.new-note-menu-sep { height: 1px; background: var(--cahier-border); margin: 5px 4px; }

.folders-row { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.folder-chip {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--cahier-border);
    background: var(--surface-2);
    color: var(--cahier-muted);
    font-size: 0.65rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}
.folder-chip:hover { background: var(--surface-6); }
.folder-chip.active { background: rgba(var(--accent-rgb), 0.14); border-color: rgba(var(--accent-rgb), 0.3); color: var(--cahier-accent); }

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.note-card {
    background: var(--surface-3);
    border: 1px solid var(--cahier-border);
    border-left: 3px solid var(--cahier-accent);
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}
.note-card:hover { background: var(--surface-6); transform: translateY(-2px); }
.note-card.is-favorite { background: rgba(var(--favorite-rgb), 0.07); border-color: rgba(var(--favorite-rgb), 0.25); }
.note-card.is-favorite:hover { background: rgba(var(--favorite-rgb), 0.12); }
.note-card-fav-ribbon {
    position: absolute; top: -1px; right: 10px; background: var(--favorite); color: #fff;
    font-size: 0.5rem; padding: 3px 7px; border-radius: 0 0 6px 6px; box-shadow: var(--shadow-sm);
}
.note-card-actions [data-action="fav-note"].active { color: var(--favorite); }

.note-card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.note-card-icon { font-size: 0.9rem; }
.note-card-title { flex: 1; font-size: 0.75rem; font-weight: 600; color: var(--cahier-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-card-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.2s ease; }
.note-card:hover .note-card-actions { opacity: 1; }
.note-card-actions button { background: none; border: none; color: var(--cahier-muted-2); cursor: pointer; font-size: 0.6rem; padding: 3px 5px; border-radius: 4px; }
.note-card-actions button:hover { background: var(--surface-8); color: var(--cahier-text); }
.note-card-actions button.active { color: var(--cahier-accent); }

.note-card-preview { font-size: 0.68rem; color: var(--cahier-muted); line-height: 1.5; margin-bottom: 8px; }
.note-card-footer { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 0.5rem; color: var(--cahier-muted-2); }
.note-badge {
    background: var(--surface-5);
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.5rem;
}
.note-badge.priority-high { color: var(--text-primary); font-weight: 700; }
.note-badge.priority-medium { color: var(--cahier-text); }
.note-badge.priority-low { color: var(--cahier-muted); }

/* ============================================================
   MODAL ÉDITEUR / LINK PICKER
   ============================================================ */
.cahier-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(14px);
    z-index: 250000;
    display: none;
    align-items: center;
    justify-content: center;
}
.cahier-modal-overlay.active { display: flex; }

.cahier-modal {
    background: var(--cahier-bg);
    border: 1px solid var(--cahier-border);
    border-radius: var(--cahier-radius);
    width: 560px;
    max-width: 94%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 0;
}
.cahier-modal.small { width: 420px; }

.cahier-modal-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--cahier-border);
}
.editor-title-input {
    flex: 1;
    background: none; border: none;
    color: var(--cahier-text);
    font-size: 0.95rem; font-weight: 700;
    outline: none;
}
.cahier-close-btn {
    background: var(--surface-4); border: none;
    color: var(--cahier-muted); width: 30px; height: 30px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.cahier-close-btn:hover { background: rgba(217,115,106,0.1); color: var(--danger); }

.editor-content-area {
    width: 100%;
    min-height: 160px;
    padding: 14px 16px;
    background: none;
    border: none;
    color: var(--cahier-text);
    font-size: 0.8rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.editor-passage {
    margin: 0 16px 10px 16px;
    padding: 10px 14px;
    background: rgba(var(--accent-rgb), 0.06);
    border-left: 3px solid var(--cahier-accent);
    border-radius: 0 8px 8px 0;
    font-size: 0.72rem;
    color: var(--cahier-muted);
    font-style: italic;
}

.editor-references { padding: 10px 16px; border-top: 1px solid var(--cahier-border); }
.ref-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.65rem; color: var(--cahier-muted); margin-bottom: 8px; }
.ref-header button { background: rgba(var(--accent-rgb), 0.1); border: 1px solid rgba(var(--accent-rgb), 0.2); color: var(--cahier-accent); border-radius: 8px; padding: 3px 10px; font-size: 0.6rem; cursor: pointer; }
.ref-list { display: flex; flex-direction: column; gap: 6px; }
.ref-item { display: flex; justify-content: space-between; align-items: center; background: var(--surface-3); padding: 6px 10px; border-radius: 8px; font-size: 0.65rem; color: var(--cahier-muted); cursor: pointer; transition: all 0.15s ease; }
.ref-item:hover { background: var(--surface-5); color: var(--cahier-text); }
.ref-item button { background: none; border: none; color: var(--cahier-muted-2); cursor: pointer; }
.ref-empty { font-size: 0.6rem; color: var(--cahier-muted-2); text-align: center; padding: 8px 0; }

.cahier-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 16px; border-top: 1px solid var(--cahier-border);
}

.link-picker-results { padding: 0 16px 16px 16px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.link-picker-item { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); cursor: pointer; font-size: 0.68rem; color: var(--cahier-muted); transition: all 0.2s ease; }
.link-picker-item:hover { background: rgba(var(--accent-rgb), 0.08); color: var(--cahier-text); }
#linkPickerSearch { margin: 12px 16px; width: calc(100% - 32px); }

/* ============================================================
   ANNOTATIONS
   ============================================================ */
.annotations-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.annotation-card {
    background: var(--surface-3);
    border: 1px solid var(--cahier-border);
    border-left: 3px solid var(--cahier-accent);
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}
.annotation-card:hover { background: var(--surface-5); }

/* Bouton de suppression flottant, réutilisé sur toute carte supprimable */
.card-delete-btn {
    position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 6px;
    background: var(--surface-4); border: 1px solid var(--cahier-border); color: var(--cahier-muted-2);
    cursor: pointer; font-size: 0.55rem; display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: all 0.15s ease; z-index: 2;
}
.annotation-card:hover .card-delete-btn, .comment-card:hover .card-delete-btn { opacity: 1; }
.card-delete-btn:hover { background: rgba(217,115,106,0.12); color: var(--danger); border-color: rgba(217,115,106,0.25); }
.annotation-passage { font-size: 0.72rem; color: var(--cahier-accent); font-style: italic; margin-bottom: 6px; line-height: 1.5; }
.annotation-note { font-size: 0.7rem; color: var(--cahier-text); margin-bottom: 8px; }
.annotation-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.55rem; color: var(--cahier-muted-2); margin-bottom: 8px; }
.annotation-meta .link-btn { background: none; border: none; color: var(--cahier-accent-2); cursor: pointer; font-size: 0.55rem; opacity: 0; transition: opacity 0.15s ease; }
.annotation-card:hover .annotation-meta .link-btn { opacity: 1; }
.annotation-transform-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.annotation-transform-actions button {
    background: rgba(var(--accent-2-rgb), 0.08);
    border: 1px solid rgba(var(--accent-2-rgb), 0.15);
    color: var(--cahier-accent-2);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.58rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.annotation-transform-actions button:hover { background: rgba(var(--accent-2-rgb), 0.18); }
.annotation-transformed { font-size: 0.6rem; color: var(--cahier-text); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* ============================================================
   COMMENTAIRES
   ============================================================ */
.comments-toolbar { margin-bottom: 10px; }
.comments-toolbar select {
    background: var(--surface-4); border: 1px solid var(--cahier-border);
    color: var(--cahier-text); border-radius: 8px; padding: 6px 12px; font-size: 0.65rem; outline: none;
}
.comments-toolbar select option { color: #191919; background: #ffffff; }
.comments-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.comment-card { background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 6px; padding: 12px; cursor: pointer; transition: all 0.15s ease; position: relative; }
.comment-card:hover { background: var(--surface-5); border-color: var(--border-strong); }
.comment-card-goto { font-size: 0.55rem; color: var(--cahier-muted-2); margin-top: 8px; opacity: 0; transition: opacity 0.15s ease; display: flex; align-items: center; gap: 4px; }
.comment-card:hover .comment-card-goto { opacity: 1; color: var(--cahier-accent); }
.comment-card-meta { display: flex; justify-content: space-between; font-size: 0.5rem; color: var(--cahier-muted-2); margin-bottom: 4px; }
.comment-card-law { font-size: 0.65rem; color: var(--cahier-accent); margin-bottom: 4px; }
.comment-card-text { font-size: 0.7rem; color: var(--cahier-text); line-height: 1.5; }

/* ============================================================
   OBJECTIFS / PROJETS
   ============================================================ */
.objectives-toolbar { margin-bottom: 10px; display: flex; gap: 8px; }
.objectives-grid, .projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }

.objective-card, .project-card {
    background: var(--surface-3);
    border: 1px solid var(--cahier-border);
    border-radius: 6px;
    padding: 14px;
}
.objective-card-header, .project-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.objective-title { font-size: 0.78rem; font-weight: 600; color: var(--cahier-text); }
.objective-desc { font-size: 0.68rem; color: var(--cahier-muted); margin-bottom: 10px; line-height: 1.5; }
.objective-progress-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.objective-progress-row input[type=range] { flex: 1; accent-color: var(--cahier-accent); }
.objective-progress-row span { font-size: 0.65rem; color: var(--cahier-accent); font-weight: 600; }
.objective-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { background: var(--surface-5); padding: 2px 10px; border-radius: 6px; font-size: 0.55rem; color: var(--cahier-muted); }
.badge.status-active { color: var(--cahier-text); font-weight: 600; }
.badge.status-done { color: var(--cahier-accent-2); }

.project-progress-track { width: 100%; height: 4px; background: var(--surface-6); border-radius: 4px; margin: 8px 0; overflow: hidden; }
.project-progress-fill { height: 100%; background: linear-gradient(90deg, var(--cahier-accent), var(--accent-light)); }

/* ============================================================
   TÂCHES
   ============================================================ */
.tasks-list { display: flex; flex-direction: column; gap: 6px; }
.task-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-3);
    border: 1px solid var(--cahier-border);
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s ease;
}
.task-row.done { opacity: 0.5; }
.task-row.done .task-row-title { text-decoration: line-through; }
.task-row input[type=checkbox] { accent-color: var(--cahier-accent); width: 16px; height: 16px; cursor: pointer; }
.task-row-body { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-row-title { font-size: 0.72rem; color: var(--cahier-text); }
.task-row-date { font-size: 0.55rem; color: var(--cahier-muted-2); }
.task-row-priority { font-size: 0.5rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-5); }
.task-row-priority.priority-high { color: var(--text-primary); font-weight: 700; }
.task-row-priority.priority-medium { color: var(--cahier-text); }
.task-row-priority.priority-low { color: var(--cahier-muted); }

/* ============================================================
   MENU DÉROULANT "PLANIFICATION" — regroupe Objectifs, Projets,
   Tâches, Agenda et Corbeille dans un seul menu élégant.
   ============================================================ */
.cahier-tabs-dropdown { position: relative; flex-shrink: 0; display: inline-flex;}
.cahier-tabs-dropdown-trigger {
    position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 7px;
    border: none; background: transparent; color: var(--text-secondary); font-size: 0.72rem; font-weight: 600;
    cursor: pointer; transition: all 0.18s ease; white-space: nowrap;  z-index: 501;
}

#cahierTabs {
    overflow: visible !important;
}
#cahierTabs > div,
#cahierTabs > button {
    overflow: visible !important;
}
.cahier-tabs-dropdown-trigger:hover { background: var(--bg-hover); color: var(--text-primary); }
.cahier-tabs-dropdown-trigger.active { background: var(--accent-soft); color: var(--text-primary); font-weight: 700; }
.cahier-tabs-dropdown-caret { font-size: 0.5rem; transition: transform 0.2s ease; opacity: 0.7; }
.cahier-tabs-dropdown.open .cahier-tabs-dropdown-caret { transform: rotate(180deg); }
.cahier-tabs-dropdown-menu {
    position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; z-index: 500;
    background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 8px; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(0.97);
    transition: all 0.18s cubic-bezier(0.16,1,0.3,1); pointer-events: none;
}
.cahier-tabs-dropdown.open .cahier-tabs-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto;}

.cahier-tabs-dropdown-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px;
    border: none; background: transparent; color: var(--text-secondary); font-size: 0.74rem; font-weight: 600;
    cursor: pointer; text-align: left; transition: all 0.15s ease;
}
.cahier-tabs-dropdown-menu button:hover { background: var(--bg-hover); color: var(--text-primary); }
.cahier-tabs-dropdown-menu button.active { background: var(--accent-soft); color: var(--text-primary); }
.cahier-tabs-dropdown-menu button i { width: 16px; text-align: center; opacity: 0.8; }
.cahier-tabs-dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ============================================================
   AGENDA — refonte complète : grille + panneau "À venir" +
   panneau de détail par jour + vrai modal de tâche.
   ============================================================ */
#tab-agenda { padding: 4px; }
.agenda-layout { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; position: relative; }
.agenda-main { min-width: 0; }
.agenda-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.agenda-nav { display: flex; align-items: center; gap: 10px; }
.agenda-today-btn {
    padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: transparent;
    color: var(--text-secondary); font-size: 0.68rem; font-weight: 700; cursor: pointer; transition: all 0.18s ease;
}
.agenda-today-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.agenda-nav-btn {
    width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--bg-hover);
    color: var(--text-secondary); cursor: pointer; transition: all 0.18s ease;
}
.agenda-nav-btn:hover { background: var(--accent-soft); color: var(--text-primary); }
.agenda-month-label { font-size: 0.92rem; font-weight: 800; color: var(--text-primary); min-width: 160px; letter-spacing: -0.3px; }
.agenda-stats-mini { display: flex; gap: 6px; margin-left: auto; }
.agenda-stat-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px;
    font-size: 0.62rem; font-weight: 700; background: var(--bg-hover); color: var(--text-secondary);
}
.agenda-stat-pill.done { color: #4caf50; }
.agenda-stat-pill.overdue { background: rgba(217,115,106,0.12); color: var(--danger); }

.agenda-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.agenda-weekday { text-align: center; font-size: 0.58rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding-bottom: 6px; }
.agenda-cell {
    min-height: 92px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-secondary);
    padding: 7px; cursor: pointer; transition: all 0.18s ease; display: flex; flex-direction: column;
}
.agenda-cell:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.agenda-cell.empty { background: transparent; border: none; cursor: default; }
.agenda-cell.is-weekend { background: var(--bg-hover); }
.agenda-cell.is-today { border: 1.5px solid var(--accent); background: var(--accent-soft); }
.agenda-cell-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.agenda-day-num { font-size: 0.72rem; font-weight: 700; color: var(--text-primary); }
.agenda-cell.is-today .agenda-day-num {
    background: var(--accent); color: var(--ink-text); width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 0.62rem;
}
.agenda-day-count { font-size: 0.5rem; font-weight: 700; color: var(--text-muted); background: var(--bg-hover); border-radius: 8px; padding: 1px 6px; }
.agenda-add-btn {
    margin-left: auto; width: 18px; height: 18px; border-radius: 5px; border: none; background: transparent;
    color: var(--text-muted); cursor: pointer; opacity: 0; transition: all 0.15s ease; font-size: 0.55rem;
}
.agenda-cell:hover .agenda-add-btn { opacity: 1; }
.agenda-add-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.agenda-cell-tasks { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.agenda-task-chip {
    display: flex; align-items: center; gap: 5px; font-size: 0.56rem; font-weight: 600; color: var(--text-secondary);
    background: var(--bg-hover); border-radius: 5px; padding: 3px 6px; cursor: pointer; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis; transition: all 0.15s ease;
}
.agenda-task-chip:hover { background: var(--accent-soft); color: var(--text-primary); }
.agenda-task-chip.done { opacity: 0.5; text-decoration: line-through; }
.agenda-task-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); }
.agenda-task-chip.priority-high .agenda-task-dot { background: var(--danger); }
.agenda-task-chip.priority-medium .agenda-task-dot { background: #e0b854; }
.agenda-task-chip.priority-low .agenda-task-dot { background: #4caf50; }
.agenda-more { font-size: 0.52rem; color: var(--text-muted); font-weight: 700; padding: 2px 6px; cursor: pointer; }
.agenda-more:hover { color: var(--text-primary); }

/* ---- Panneau latéral "À venir" ---- */
.agenda-sidebar { position: sticky; top: 0; }
.agenda-sidebar-section {
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.agenda-sidebar-title { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.agenda-upcoming-list { display: flex; flex-direction: column; gap: 4px; }
.agenda-upcoming-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 8px; cursor: pointer;
    transition: all 0.15s ease;
}
.agenda-upcoming-item:hover { background: var(--bg-hover); }
.agenda-upcoming-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); }
.agenda-upcoming-dot.priority-high { background: var(--danger); }
.agenda-upcoming-dot.priority-medium { background: #e0b854; }
.agenda-upcoming-dot.priority-low { background: #4caf50; }
.agenda-upcoming-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.agenda-upcoming-title { font-size: 0.68rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-upcoming-date { font-size: 0.55rem; color: var(--text-muted); text-transform: capitalize; }
.agenda-empty-hint { font-size: 0.62rem; color: var(--text-muted); text-align: center; padding: 16px 8px; line-height: 1.6; }

/* ---- Panneau de détail d'une journée — glisse depuis la droite ---- */
.agenda-day-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: 340px; background: var(--bg-elevated);
    border-left: 1px solid var(--border-strong); box-shadow: -10px 0 30px rgba(0,0,0,0.2); z-index: 450;
    transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.16,1,0.3,1); overflow-y: auto;
}
.agenda-day-panel.open { transform: translateX(0); }
.agenda-day-panel-inner { padding: 20px; }
.agenda-day-panel-header {
    display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; font-weight: 700;
    color: var(--text-primary); text-transform: capitalize; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.agenda-day-panel-header button { background: var(--bg-hover); border: none; width: 28px; height: 28px; border-radius: 50%; color: var(--text-secondary); cursor: pointer; }
.agenda-day-panel-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.agenda-day-panel-add { width: 100%; }

/* ---- Modal de tâche ---- */
.task-modal .fs-side-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.task-modal textarea.cahier-search { resize: vertical; font-family: inherit; margin-top: 8px; }

@media (max-width: 900px) {
    .agenda-layout { grid-template-columns: 1fr; }
    .agenda-sidebar { position: static; }
    .agenda-day-panel { width: 100%; }
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .notes-grid, .annotations-grid, .comments-grid, .objectives-grid, .projects-grid {
        grid-template-columns: 1fr;
    }
    .dash-grid { grid-template-columns: repeat(2, 1fr); }
    .cahier-modal { width: 96%; }
}

/* ============================================================
   ÉDITEUR DE NOTE PLEIN ÉCRAN — "bloc-notes ultra-moderne"
   ============================================================ */
.note-fs-overlay {
    position: fixed;
    inset: 0;
    z-index: 200000;
    background: var(--bg-primary);
    display: none;
    flex-direction: column;
}
.note-fs-overlay.active { display: flex; }

/* ---- Barre du haut — allégée, le titre vit désormais dans le corps de page ---- */
.note-fs-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--cahier-border);
    background: var(--cahier-bg);
    flex-shrink: 0;
}
.note-fs-icon-btn {
    width: 34px; height: 34px; border-radius: 6px;
    background: var(--surface-4); border: 1px solid var(--cahier-border);
    color: var(--cahier-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease; flex-shrink: 0; font-size: 0.75rem;
}
.note-fs-icon-btn:hover { background: var(--surface-8); color: var(--cahier-text); }
.note-fs-close:hover { color: var(--danger); background: rgba(217,115,106,0.1); }
.note-fs-font-controls {
    display: flex; align-items: center; gap: 2px; background: var(--surface-4);
    border: 1px solid var(--cahier-border); border-radius: 6px; padding: 2px; margin-left: auto;
}
.note-fs-font-controls button { width: 24px; height: 24px; border-radius: 4px; background: none; border: none; color: var(--cahier-muted); cursor: pointer; font-size: 0.6rem; }
.note-fs-font-controls button:hover { background: var(--surface-8); color: var(--cahier-text); }
.note-fs-font-controls span { font-size: 0.55rem; color: var(--cahier-muted-2); padding: 0 6px; min-width: 32px; text-align: center; }
.note-fs-status {
    font-size: 0.62rem; color: var(--cahier-muted-2); white-space: nowrap;
    display: flex; align-items: center; gap: 5px; padding: 4px 10px;
    background: var(--surface-3); border-radius: 6px; flex-shrink: 0;
}
.note-fs-status i { font-size: 0.6rem; color: var(--cahier-text); }

/* ---- Sélecteur d'icône ---- */
.note-fs-icon-picker {
    display: none; flex-wrap: wrap; gap: 6px; padding: 10px 18px;
    border-bottom: 1px solid var(--cahier-border); background: var(--surface-2);
}
.note-fs-icon-picker.visible { display: flex; }
.note-fs-icon-choice {
    font-size: 1.2rem; padding: 6px 10px; border-radius: 6px; cursor: pointer;
    transition: all 0.2s ease; border: 2px solid transparent;
}
.note-fs-icon-choice:hover { background: var(--surface-6); }
.note-fs-icon-choice.active { border-color: var(--cahier-accent); background: rgba(var(--accent-rgb), 0.1); }

/* ---- Barre d'outils de formatage ---- */
.note-fs-toolbar {
    display: flex; align-items: center; gap: 4px; padding: 8px 18px;
    border-bottom: 1px solid var(--cahier-border); background: var(--surface-1); flex-shrink: 0; flex-wrap: wrap;
}
.note-fs-toolbar button {
    width: 30px; height: 30px; border-radius: 8px; background: transparent; border: none;
    color: var(--cahier-muted); cursor: pointer; font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s ease;
}
.note-fs-toolbar button:hover { background: var(--surface-6); color: var(--cahier-text); }
.note-fs-toolbar button.media-insert-btn { color: var(--cahier-accent); }
.note-fs-toolbar button.media-insert-btn:hover { background: var(--accent-soft); }
.note-fs-toolbar-sep { width: 1px; height: 18px; background: var(--cahier-border); margin: 0 4px; }

/* ---- Sélecteurs police / taille ---- */
.fs-toolbar-select {
    height: 30px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--cahier-border);
    color: var(--cahier-text); font-size: 0.65rem; padding: 0 8px; cursor: pointer; outline: none;
}
.fs-font-family { max-width: 130px; }
.fs-font-size { width: 52px; }
.fs-toolbar-select option { color: #191919; background: #ffffff; }

/* ---- Boutons couleur (texte / fond) avec popover façon Word ---- */
.fs-color-btn-wrap { position: relative; }
.fs-color-btn-wrap button {
    width: 34px !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    padding-top: 2px;
}
.fs-color-indicator { width: 18px; height: 3px; border-radius: 1px; margin-top: 1px; }
.fs-color-popover {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--cahier-bg);
    border: 1px solid var(--cahier-border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px;
    display: none; width: 168px;
}
.fs-color-popover.open { display: block; }
.fs-color-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.fs-color-swatch { width: 24px; height: 24px; border-radius: 5px; cursor: pointer; border: 1px solid rgba(255,255,255,0.1); transition: transform 0.12s ease; }
.fs-color-swatch:hover { transform: scale(1.15); }
.fs-color-custom-row { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--cahier-border); }
.fs-color-custom-row input[type="color"] { width: 26px; height: 26px; border: none; border-radius: 5px; cursor: pointer; background: none; padding: 0; }
.fs-color-custom-row span { font-size: 0.58rem; color: var(--cahier-muted); }

/* ---- Menu de casse du texte ---- */
.fs-case-btn-wrap { position: relative; }
.fs-case-btn-wrap button { width: 40px !important; gap: 3px; }
.fs-case-caret { font-size: 0.5rem !important; }
.fs-case-popover {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--cahier-bg);
    border: 1px solid var(--cahier-border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px;
    display: none; width: 210px;
}
.fs-case-popover.open { display: block; }
.fs-case-option { padding: 8px 12px; border-radius: 7px; cursor: pointer; font-size: 0.7rem; color: var(--cahier-text); transition: background 0.12s ease; }
.fs-case-option:hover { background: var(--surface-5); }

.note-fs-wordcount { margin-left: auto; font-size: 0.6rem; color: var(--cahier-muted-2); padding: 0 6px; white-space: nowrap; }

/* ---- Corps : éditeur + sidebar ---- */
.note-fs-body { flex: 1; display: flex; min-height: 0; position: relative; }
.note-fs-main {
    flex: 1; overflow-y: auto; padding: 30px 40px 60px 40px;
    scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.2s ease;
}
.note-fs-main:hover { scrollbar-color: var(--cahier-border) transparent; }
.note-fs-main::-webkit-scrollbar { width: 5px; }
.note-fs-main::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.note-fs-main:hover::-webkit-scrollbar-thumb { background: var(--cahier-border); }

/* ---- En-tête de page façon Notion : icône + titre géants dans le corps ---- */
.note-fs-page { width: 90%; max-width: 1600px; margin: 0 auto 8px auto; }
.note-fs-page-icon {
    font-size: 3.2rem; line-height: 1; cursor: pointer; display: inline-block;
    padding: 4px 8px; margin-left: -8px; border-radius: 8px; transition: background 0.15s ease;
}
.note-fs-page-icon:hover { background: var(--surface-4); }
/* Demande explicite : aucune bordure/anneau de focus dans la page de note
   (l'anneau d'accessibilité global reste actif partout ailleurs dans l'app). */
.note-fs-overlay input:focus-visible,
.note-fs-overlay textarea:focus-visible,
.note-fs-overlay select:focus-visible,
.note-fs-overlay [contenteditable]:focus-visible,
.note-fs-overlay button:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.note-fs-page-title {
    display: block; width: 100%; background: none; border: none; outline: none;
    font-size: 2.4rem; font-weight: 800; color: var(--cahier-text); font-family: 'Inter', sans-serif;
    margin: 8px 0 6px 0; padding: 2px 0;
}
.note-fs-page-title::placeholder { color: var(--cahier-muted-2); }
.note-fs-page-meta { display: flex; align-items: center; gap: 8px; font-size: 0.65rem; color: var(--cahier-muted-2); margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--cahier-border); }

/* ---- Images insérées dans le corps ---- */
/* ============================================================
   MÉDIAS INSÉRÉS — redimensionnables, pivotables, alignables
   ============================================================ */
.note-media-wrap {
    display: inline-block; vertical-align: middle; max-width: 100%; position: relative; cursor: move;
    -webkit-user-drag: none; user-drag: none; user-select: none; -webkit-user-select: none;
    /* Isolation invisible — permet aux contrôles vidéo/audio de répondre au clic,
       et à la suppression au clavier (sélection + Retour arrière). Le déplacement/
       redimensionnement est désormais géré entièrement par nos poignées personnalisées.
       -webkit-user-drag / user-select : empêche le glisser-déposer NATIF du navigateur
       (qui existe par défaut sur toute image, même sans l'attribut draggable="false" du
       HTML — notamment pour les images insérées avant que cet attribut n'existe) d'entrer
       en conflit avec notre propre système de déplacement à la souris. */
}
/* Mode flottant : le média quitte le flux du texte dès le premier glisser-déposer,
   devient librement positionnable — comme une image "flottante" dans un vrai éditeur de documents. */
.note-media-wrap.floating { position: absolute; z-index: 5; max-width: none; }

.note-media-content {
    display: inline-block; max-width: 100%; overflow: visible;
    vertical-align: middle; min-width: 40px; min-height: 30px;
    /* Aucun cadre, aucune bordure décorative — le média s'affiche tel quel, sans "cage" visible */
}
.note-media-wrap.floating .note-media-content { max-width: none; }
.note-media-content img, .note-media-content video { max-width: 100%; width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.note-media-content video { pointer-events: auto; } /* les contrôles vidéo doivent rester cliquables */
.note-media-content audio { width: auto; min-width: 260px; }

/* Léger anneau uniquement quand le média est sélectionné (repère utile, disparaît sinon) */
.note-media-wrap.selected .note-media-content { outline: 2px solid rgba(var(--accent-rgb), 0.4); outline-offset: 3px; }

/* ---- Poignées de manipulation (8 points, façon éditeur de documents professionnel) ---- */
.media-handles { display: none; }
.note-media-wrap.selected .media-handles { display: block; }

/* Alignement rapide (bouton du toolbar flottant) */
.note-media-wrap.align-left { float: left; margin: 4px 16px 8px 0; }
.note-media-wrap.align-right { float: right; margin: 4px 0 8px 16px; }
.note-media-wrap.align-center { display: block; margin: 12px auto; float: none; }

/* Légende sous le média */
.note-media-caption {
    display: block; text-align: center; font-size: 0.7rem; font-style: italic; color: var(--cahier-muted);
    margin-top: 6px; outline: none; min-height: 1.2em;
}
.note-media-caption:empty::before { content: attr(data-placeholder); color: var(--cahier-muted-2); }

/* ---- Toolbar contextuel flottant (au-dessus du média sélectionné) ---- */
.media-floating-toolbar {
    position: fixed; transform: translateX(-50%); display: flex; align-items: center; gap: 2px;
    background: var(--cahier-bg); border: 1px solid var(--cahier-border); border-radius: 9px;
    box-shadow: var(--shadow-lg); padding: 4px; z-index: 100050; animation: mftIn 0.15s cubic-bezier(0.16,1,0.3,1);
}
@keyframes mftIn { from { opacity: 0; transform: translateX(-50%) translateY(4px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.media-floating-toolbar button {
    width: 30px; height: 30px; border-radius: 6px; background: none; border: none;
    color: var(--cahier-muted); cursor: pointer; font-size: 0.68rem; display: flex; align-items: center; justify-content: center;
    transition: all 0.12s ease;
}
.media-floating-toolbar button:hover { background: var(--surface-6); color: var(--cahier-text); }
.media-floating-toolbar button.mft-danger:hover { background: rgba(217,115,106,0.12); color: var(--danger); }
.mft-sep { width: 1px; height: 18px; background: var(--cahier-border); margin: 0 3px; }

.media-handle {
    position: absolute; width: 10px; height: 10px; background: var(--bg-elevated);
    border: 1.5px solid rgba(var(--accent-rgb), 0.9); border-radius: 2px; z-index: 2;
    box-shadow: var(--shadow-sm);
}
/* Zone de détection élargie invisible autour de chaque poignée visuelle (plus facile à attraper) */
.media-handle::before { content: ''; position: absolute; inset: -6px; }
.media-handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.media-handle-n  { top: -5px; left: 50%; margin-left: -5px; cursor: ns-resize; }
.media-handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.media-handle-w  { top: 50%; left: -5px; margin-top: -5px; cursor: ew-resize; }
.media-handle-e  { top: 50%; right: -5px; margin-top: -5px; cursor: ew-resize; }
.media-handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.media-handle-s  { bottom: -5px; left: 50%; margin-left: -5px; cursor: ns-resize; }
.media-handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* Pendant une manipulation active : empêche la sélection de texte parasite pendant le glisser */
body.media-manipulating { user-select: none !important; }
body.media-manipulating .note-fs-editor { cursor: inherit !important; }

/* ---- Guides d'alignement intelligents (centre / marges de la zone d'écriture, autres médias) ---- */
.media-align-guides { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.media-guide { position: absolute; background: var(--cahier-accent, #02A6BA); opacity: 0; transition: opacity 0.06s ease; }
.media-guide.guide-v { top: 0; bottom: 0; width: 1px; }
.media-guide.guide-h { left: 0; right: 0; height: 1px; }

/* ---- Modal d'insertion média ---- */
.media-modal { width: 380px; overflow: hidden; }
/* Chaque popup (image/vidéo/audio) est teinté par sa propre couleur d'accent (--media-accent,
   injectée en JS), pour ne jamais se ressembler d'un type de média à l'autre. */
.media-modal .cahier-modal-header {
    background: rgba(var(--media-accent-rgb), 0.10);
    border-bottom: 1px solid rgba(var(--media-accent-rgb), 0.25);
}
.media-modal .cahier-modal-header i { color: var(--media-accent); }
.media-modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.media-modal .media-option {
    display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 16px;
    background: rgba(var(--media-accent-rgb), 0.06);
    border: 1.5px dashed rgba(var(--media-accent-rgb), 0.4); border-radius: 10px;
    color: var(--cahier-muted); cursor: pointer; font-size: 0.72rem; text-align: center; transition: all 0.15s ease;
}
.media-modal .media-option i { font-size: 1.7rem; color: var(--media-accent); opacity: 0.9; }
.media-modal .media-option:hover { background: rgba(var(--media-accent-rgb), 0.12); border-color: var(--media-accent); color: var(--cahier-text); }
.media-or { display: flex; align-items: center; gap: 10px; color: var(--cahier-muted-2); font-size: 0.6rem; }
.media-or::before, .media-or::after { content: ''; flex: 1; height: 1px; background: var(--cahier-border); }
.media-url-row { display: flex; gap: 8px; }
.media-url-row .cahier-search { flex: 1; margin: 0; }
.media-modal .media-url-row .cahier-btn.primary { background: var(--media-accent); border-color: var(--media-accent); }

/* ---- Mentions inline "@note" ---- */
.note-mention {
    display: inline-flex; align-items: center; background: var(--accent-soft); color: var(--cahier-accent);
    padding: 1px 9px; border-radius: 10px; font-weight: 600; text-decoration: none; cursor: pointer;
    font-size: 0.92em; border: 1px solid rgba(var(--accent-rgb), 0.15); transition: all 0.15s ease;
}
.note-mention:hover { background: rgba(var(--accent-rgb), 0.18); }
.note-mention-popover {
    position: fixed; z-index: 999999; background: var(--cahier-bg); border: 1px solid var(--cahier-border);
    border-radius: 8px; box-shadow: var(--shadow-lg); min-width: 220px; max-width: 300px;
    padding: 4px; display: none;
}
.note-mention-popover.visible { display: block; }
.note-mention-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 0.72rem; color: var(--cahier-text); }
.note-mention-item:hover { background: var(--surface-6); }

/* ---- Mentions liées (rétro-liens) ---- */
.note-fs-backlinks { width: 90%; max-width: 1600px; margin: 40px auto 0 auto; padding-top: 20px; border-top: 1px solid var(--cahier-border); }
.fs-backlinks-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.fs-backlink-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-3); border-radius: 8px; cursor: pointer; font-size: 0.7rem; color: var(--cahier-muted); transition: all 0.15s ease; }
.fs-backlink-item:hover { background: var(--surface-5); color: var(--cahier-text); }
.fs-backlink-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Panneau "Autres notes" (façon liste de pages Notion) ---- */
.note-fs-othernotes {
    width: 0; flex-shrink: 0; overflow: hidden; border-right: 1px solid transparent;
    background: var(--cahier-bg); transition: width 0.28s cubic-bezier(0.16,1,0.3,1), border-color 0.28s ease;
}
.note-fs-othernotes.visible { width: 260px; border-right: 1px solid var(--cahier-border); }
.fs-othernotes-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 14px; width: 260px; }
.fs-othernotes-new {
    width: 24px; height: 24px; border-radius: 6px; background: var(--surface-4); border: 1px solid var(--cahier-border);
    color: var(--cahier-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; transition: all 0.15s ease;
}
.fs-othernotes-new:hover { background: var(--surface-8); color: var(--cahier-text); }
.fs-othernotes-list {
    padding: 0 8px 14px 8px; overflow-y: auto; width: 260px;
    scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.2s ease;
}
.fs-othernotes-list:hover { scrollbar-color: var(--cahier-border) transparent; }
.fs-othernotes-list::-webkit-scrollbar { width: 4px; }
.fs-othernotes-list::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.fs-othernotes-list:hover::-webkit-scrollbar-thumb { background: var(--cahier-border); }
.fs-othernote-item {
    display: flex; align-items: center; gap: 4px; padding: 2px; border-radius: 6px;
    transition: background 0.15s ease;
}
.fs-othernote-item:hover { background: var(--surface-4); }
.fs-othernote-open { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; font-size: 0.7rem; color: var(--cahier-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-othernote-icon { flex-shrink: 0; }
.fs-othernote-link {
    flex-shrink: 0; width: 24px; height: 24px; border-radius: 5px; background: none; border: none;
    color: var(--cahier-muted-2); cursor: pointer; opacity: 0; transition: all 0.15s ease;
}
.fs-othernote-item:hover .fs-othernote-link { opacity: 1; }
.fs-othernote-link:hover { background: var(--surface-8); color: var(--cahier-accent); }
.fs-othernote-delete {
    flex-shrink: 0; width: 24px; height: 24px; border-radius: 5px; background: none; border: none;
    color: var(--cahier-muted-2); cursor: pointer; opacity: 0; transition: all 0.15s ease;
}
.fs-othernote-item:hover .fs-othernote-delete { opacity: 1; }
.fs-othernote-delete:hover { background: rgba(217,115,106,0.12); color: var(--danger); }

.note-fs-main::-webkit-scrollbar { width: 6px; }
.note-fs-main::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), 0.2); border-radius: 3px; }

.note-fs-passage {
    width: 90%; max-width: 1600px; margin: 0 auto 24px auto; padding: 14px 20px;
    background: rgba(var(--accent-rgb), 0.06); border-left: 3px solid var(--cahier-accent);
    border-radius: 0 10px 10px 0; font-size: 0.85rem; color: var(--cahier-muted); font-style: italic; line-height: 1.6;
}

.note-fs-editor {
    width: 90%; max-width: 1600px; margin: 0 auto; min-height: 60vh;
    font-size: 1.05rem; line-height: 1.9; color: var(--cahier-text);
    outline: none; font-family: 'Inter', sans-serif;
}
.note-fs-editor:empty:before { content: attr(data-placeholder); color: var(--cahier-muted-2); pointer-events: none; }
.note-fs-editor h2 { font-size: 1.5rem; font-weight: 700; color: var(--cahier-accent); margin: 24px 0 12px 0; }
.note-fs-editor h3 { font-size: 1.2rem; font-weight: 700; color: var(--cahier-text); margin: 20px 0 10px 0; }
.note-fs-editor p { margin-bottom: 12px; }
.note-fs-editor ul, .note-fs-editor ol { margin: 8px 0 12px 24px; }
.note-fs-editor li { margin-bottom: 4px; }
.note-fs-editor blockquote {
    border-left: 3px solid var(--cahier-accent-2); padding: 4px 16px; margin: 16px 0;
    color: var(--cahier-muted); font-style: italic;
}
.note-fs-editor pre {
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 8px;
    padding: 14px 16px; margin: 14px 0; font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82em; overflow-x: auto; white-space: pre-wrap;
}
.note-fs-editor a { color: var(--cahier-accent); text-decoration: underline; }
.note-fs-table, .note-fs-editor table { border-collapse: collapse; margin: 16px 0; width: 100%; }
.note-fs-table td, .note-fs-editor table td { border: 1px solid var(--cahier-border); padding: 8px 12px; min-width: 60px; }
.note-fs-table td:hover, .note-fs-editor table td:hover { background: var(--surface-3); }
.note-fs-editor mark.find-match { background: rgba(255,215,0,0.35); border-radius: 2px; }
.note-fs-editor mark.find-match.active { background: rgba(255,140,0,0.6); }

/* ---- Barre Rechercher / Remplacer ---- */
.find-replace-bar {
    display: none; align-items: center; gap: 6px; width: 90%; max-width: 1600px; margin: 0 auto 14px auto;
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 8px; padding: 8px 10px;
    flex-wrap: wrap;
}
.find-replace-bar.visible { display: flex; }
.find-replace-bar input {
    background: var(--bg-primary); border: 1px solid var(--cahier-border); border-radius: 6px;
    padding: 6px 10px; font-size: 0.72rem; color: var(--cahier-text); outline: none; min-width: 140px; flex: 1;
}
.find-count { font-size: 0.6rem; color: var(--cahier-muted-2); white-space: nowrap; min-width: 60px; }
.find-replace-bar button { background: none; border: none; color: var(--cahier-muted); cursor: pointer; padding: 6px 8px; border-radius: 5px; }
.find-replace-bar button:hover { background: var(--surface-6); color: var(--cahier-text); }

/* ---- Sidebar de métadonnées ---- */
.note-fs-sidebar {
    width: 300px; flex-shrink: 0; overflow-y: auto; padding: 20px 18px 40px 18px;
    border-left: 1px solid var(--cahier-border); background: var(--surface-1);
    scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.2s ease;
}
.note-fs-sidebar:hover { scrollbar-color: var(--cahier-border) transparent; }
.note-fs-sidebar::-webkit-scrollbar { width: 4px; }
.note-fs-sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.note-fs-sidebar:hover::-webkit-scrollbar-thumb { background: var(--cahier-border); }

.fs-side-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--surface-4); }
.fs-side-section:last-child { border-bottom: none; }
.fs-side-label { font-size: 0.55rem; color: var(--cahier-muted-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; font-weight: 600; }

.note-fs-swatches { display: flex; gap: 7px; align-items: center; }
.note-fs-swatch {
    width: 13px; height: 13px; border-radius: 50%; cursor: pointer; border: 1.5px solid transparent;
    transition: all 0.15s ease; display: inline-block; flex-shrink: 0;
}
.note-fs-swatch:hover { transform: scale(1.25); }
.note-fs-swatch.active { border-color: var(--cahier-text); box-shadow: 0 0 0 2px var(--surface-20); transform: scale(1.15); }
.fs-side-hint { font-size: 0.55rem; color: var(--cahier-muted-2); margin-top: 6px; line-height: 1.5; }

.fs-side-select, .fs-side-input {
    width: 100%; padding: 8px 12px; margin-bottom: 8px;
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 6px;
    color: var(--cahier-text); font-size: 0.7rem; outline: none; font-family: 'Inter', sans-serif;
}
/* Le menu déroulant natif d'un <select> s'affiche souvent avec un fond
   clair du système, quel que soit le thème de la page — on force donc
   des couleurs lisibles sur les <option> elles-mêmes (indépendamment
   du thème), pour ne jamais avoir de texte clair sur fond clair. */
.fs-side-select option { color: #191919; background: #ffffff; }
.fs-side-select:focus, .fs-side-input:focus { border-color: rgba(var(--accent-rgb), 0.3); }
.fs-side-row { display: flex; gap: 8px; }
.fs-side-row .fs-side-select { margin-bottom: 8px; }

.fs-toggle-btn {
    flex: 1; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--cahier-border);
    background: var(--surface-2); color: var(--cahier-muted-2); font-size: 0.6rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s ease;
}
.fs-toggle-btn:hover { background: var(--surface-6); }
.fs-toggle-btn.active { color: var(--cahier-accent); background: rgba(var(--accent-rgb), 0.1); border-color: rgba(var(--accent-rgb), 0.3); }
#fsFavBtn.active { color: var(--cahier-text); background: var(--accent-soft); border-color: var(--border-strong); font-weight: 700; }

.fs-side-meta { font-size: 0.62rem; color: var(--cahier-muted); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.fs-side-dates .fs-side-meta { color: var(--cahier-muted-2); }

.fs-side-actions { display: flex; flex-direction: column; gap: 8px; }
.fs-side-actions .cahier-btn { width: 100%; justify-content: center; }
.cahier-btn.danger { color: var(--danger); border-color: rgba(217,115,106,0.25); }
.cahier-btn.danger:hover { background: rgba(239,68,68,0.08); }

/* ---- Panneau historique (glisse depuis la droite) ---- */
.note-fs-history-panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: 340px;
    background: var(--cahier-bg); backdrop-filter: blur(20px);
    border-left: 1px solid var(--cahier-border); box-shadow: -20px 0 60px rgba(0,0,0,0.5);
    transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex; flex-direction: column; z-index: 10;
}
.note-fs-history-panel.visible { transform: translateX(0); }
.fs-history-header {
    display: flex; align-items: center; justify-content: space-between; padding: 16px 18px;
    border-bottom: 1px solid var(--cahier-border); font-size: 0.7rem; color: var(--cahier-accent); font-weight: 600;
}
.fs-history-header button { background: none; border: none; color: var(--cahier-muted-2); cursor: pointer; }
.fs-history-list {
    flex: 1; overflow-y: auto; padding: 12px 18px;
    scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.2s ease;
}
.fs-history-list:hover { scrollbar-color: var(--cahier-border) transparent; }
.fs-history-list::-webkit-scrollbar { width: 4px; }
.fs-history-list::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.fs-history-list:hover::-webkit-scrollbar-thumb { background: var(--cahier-border); }
.fs-history-item { background: var(--surface-2); border: 1px solid var(--cahier-border); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; }
.fs-history-date { font-size: 0.55rem; color: var(--cahier-muted-2); margin-bottom: 4px; }
.fs-history-preview { font-size: 0.65rem; color: var(--cahier-muted); margin-bottom: 8px; line-height: 1.5; }

/* ============================================================
   BASE DE DONNÉES — vue tableau façon Notion
   ============================================================ */
.db-toolbar { display: flex; align-items: center; margin-bottom: 10px; }
.db-count { font-size: 0.65rem; color: var(--cahier-muted-2); }
.db-table-wrap { overflow-x: auto; border: 1px solid var(--cahier-border); border-radius: 8px; }
.db-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.db-table thead th {
    text-align: left; padding: 9px 14px; background: var(--surface-3); color: var(--cahier-muted);
    font-weight: 700; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.3px;
    cursor: pointer; user-select: none; white-space: nowrap; border-bottom: 1px solid var(--cahier-border);
    transition: color 0.15s ease;
}
.db-table thead th:hover { color: var(--cahier-text); }
.db-table thead th.sorted-asc, .db-table thead th.sorted-desc { color: var(--cahier-accent); }
.db-table tbody tr { cursor: pointer; transition: background 0.12s ease; border-bottom: 1px solid var(--cahier-border); }
.db-table tbody tr:last-child { border-bottom: none; }
.db-table tbody tr:hover { background: var(--surface-3); }
.db-table td { padding: 9px 14px; color: var(--cahier-text); white-space: nowrap; }
.db-cell-title { font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.db-cell-date { color: var(--cahier-muted-2); font-size: 0.62rem; }
.db-empty { color: var(--cahier-muted-2); }
.db-priority-dots { letter-spacing: 1px; color: var(--cahier-accent); font-size: 0.55rem; }
.db-status-badge { padding: 2px 9px; border-radius: 10px; font-size: 0.58rem; background: var(--surface-4); color: var(--cahier-muted); text-transform: capitalize; }
.db-status-badge.db-status-active { color: var(--cahier-text); background: var(--accent-soft); }
.db-status-badge.db-status-done { color: var(--success); }
.db-objective-chip { background: var(--accent-soft); color: var(--cahier-accent); padding: 2px 9px; border-radius: 10px; font-size: 0.6rem; }
.db-editable { cursor: pointer; transition: background 0.12s ease; position: relative; padding-right: 24px !important; }
.db-editable:hover { background: var(--surface-5); }
.db-edit-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 0.5rem; color: var(--cahier-muted-2); opacity: 0; transition: opacity 0.15s ease; }
.db-editable:hover .db-edit-icon { opacity: 1; }
.db-inline-input {
    width: 100%; padding: 3px 6px; background: var(--surface-4); border: 1px solid rgba(var(--accent-rgb), 0.35);
    border-radius: 5px; color: var(--cahier-text); font-size: 0.68rem; outline: none; font-family: 'Inter', sans-serif;
}
.db-inline-input option { color: #191919; background: #ffffff; }
.db-row-delete {
    width: 24px; height: 24px; border-radius: 6px; background: none; border: none;
    color: var(--cahier-muted-2); cursor: pointer; font-size: 0.55rem; opacity: 0; transition: all 0.15s ease;
}
.db-table tbody tr:hover .db-row-delete { opacity: 1; }
.db-row-delete:hover { background: rgba(217,115,106,0.12); color: var(--danger); }

/* ============================================================
   CORBEILLE
   ============================================================ */
.trash-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.trash-hint { font-size: 0.62rem; color: var(--cahier-muted-2); display: flex; align-items: center; gap: 6px; }
.trash-list { display: flex; flex-direction: column; gap: 8px; }
.trash-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--surface-2); border: 1px solid var(--cahier-border); border-radius: 8px;
}
.trash-item-icon { font-size: 1.1rem; flex-shrink: 0; opacity: 0.6; }
.trash-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trash-item-label { font-size: 0.72rem; color: var(--cahier-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-item-meta { font-size: 0.58rem; color: var(--cahier-muted-2); }
.trash-urgent { color: var(--danger); font-weight: 600; }
.trash-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .note-fs-sidebar { display: none; }
    .note-fs-main { padding: 20px; }
    .note-fs-history-panel { width: 100%; }
    .trash-item { flex-wrap: wrap; }
    .trash-item-actions { width: 100%; }
}
@media (max-width: 600px) {
    .note-fs-title { font-size: 1.05rem; }
    .note-fs-status span { display: none; }
    .note-fs-toolbar { overflow-x: auto; flex-wrap: nowrap; }
}

/* ============================================================
   ÉDITEUR TABLEUR
   ============================================================ */
.ss-grid-controls { display: flex; gap: 4px; }
.ss-grid-controls button {
    padding: 5px 10px; border-radius: 6px; background: var(--surface-4); border: 1px solid var(--cahier-border);
    color: var(--cahier-muted); cursor: pointer; font-size: 0.6rem; display: flex; align-items: center; gap: 4px;
}
.ss-grid-controls button:hover { background: var(--surface-8); color: var(--cahier-text); }
.ss-main { padding-bottom: 40px; }
.ss-formula-bar {
    display: flex; align-items: center; gap: 10px; width: 90%; max-width: 1600px; margin: 0 auto 14px auto;
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 8px; padding: 6px 10px;
}
.ss-cell-ref { font-size: 0.68rem; font-weight: 700; color: var(--cahier-accent); min-width: 32px; padding-right: 10px; border-right: 1px solid var(--cahier-border); }
.ss-formula-bar input { flex: 1; background: none; border: none; outline: none; color: var(--cahier-text); font-size: 0.72rem; font-family: 'Consolas', monospace; }
.ss-grid-wrap {
    width: 90%; max-width: 1600px; margin: 0 auto; overflow: auto; border: 1px solid var(--cahier-border); border-radius: 8px;
    scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.2s ease;
}
.ss-grid-wrap:hover { scrollbar-color: var(--cahier-border) transparent; }
.ss-grid-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.ss-grid-wrap::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.ss-grid-wrap:hover::-webkit-scrollbar-thumb { background: var(--cahier-border); }
.ss-table { border-collapse: collapse; width: 100%; }
.ss-table th {
    background: var(--surface-4); color: var(--cahier-muted); font-size: 0.6rem; font-weight: 700;
    padding: 6px 10px; border: 1px solid var(--cahier-border); position: sticky; top: 0; z-index: 1; min-width: 90px;
}
.ss-table th.ss-corner { position: sticky; left: 0; top: 0; z-index: 2; min-width: 40px; }
.ss-table tbody th { position: sticky; left: 0; z-index: 1; min-width: 40px; }
.ss-table td {
    padding: 6px 10px; border: 1px solid var(--cahier-border); font-size: 0.68rem; color: var(--cahier-text);
    cursor: cell; white-space: nowrap; min-width: 90px; background: var(--bg-primary);
}
.ss-table td:hover { background: var(--surface-3); }
.ss-table td.selected { outline: 2px solid var(--cahier-accent); outline-offset: -2px; background: var(--accent-soft); }
.ss-help { font-size: 0.62rem; color: var(--cahier-muted); line-height: 2; }
.ss-help code { background: var(--surface-4); padding: 1px 6px; border-radius: 4px; color: var(--cahier-accent); font-family: 'Consolas', monospace; }

/* ============================================================
   EXPLORATEUR DE DOSSIERS
   ============================================================ */
.explorer-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.explorer-tree { border: 1px solid var(--cahier-border); border-radius: 8px; padding: 6px; background: var(--surface-2); }
.explorer-folder-row {
    display: flex; align-items: center; gap: 8px; padding: 7px 8px;
    padding-left: calc(8px + var(--depth, 0) * 20px);
    border-radius: 6px; cursor: pointer; transition: background 0.12s ease;
}
.explorer-folder-row:hover { background: var(--surface-5); }
.explorer-folder-row:hover .explorer-folder-actions { opacity: 1; }
.explorer-chevron { font-size: 0.55rem; color: var(--cahier-muted-2); width: 10px; flex-shrink: 0; }
.explorer-folder-icon { font-size: 0.85rem; flex-shrink: 0; }
.explorer-folder-name { font-size: 0.72rem; color: var(--cahier-text); font-weight: 600; flex: 1; }
.explorer-folder-count { font-size: 0.55rem; color: var(--cahier-muted-2); background: var(--surface-6); padding: 1px 7px; border-radius: 8px; }
.explorer-folder-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s ease; }
.explorer-folder-actions button { width: 22px; height: 22px; border-radius: 5px; background: none; border: none; color: var(--cahier-muted-2); cursor: pointer; font-size: 0.55rem; }
.explorer-folder-actions button:hover { background: var(--surface-8); color: var(--cahier-accent); }
.explorer-file {
    display: flex; align-items: center; gap: 8px; padding: 7px 8px;
    padding-left: calc(8px + (var(--depth, 0) + 1) * 20px);
    border-radius: 6px; cursor: pointer; transition: background 0.12s ease;
}
.explorer-file:hover { background: var(--surface-5); }
.explorer-file-icon { font-size: 0.8rem; flex-shrink: 0; }
.explorer-file-name { font-size: 0.68rem; color: var(--cahier-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-file-pin { font-size: 0.5rem; color: var(--cahier-accent); }
.explorer-empty-folder { padding: 6px 8px; padding-left: calc(8px + (var(--depth, 0) + 1) * 20px); font-size: 0.6rem; color: var(--cahier-muted-2); font-style: italic; }

/* ============================================================
   MODAL DE SAISIE (remplace window.prompt)
   ============================================================ */
.prompt-modal { padding: 20px; }
.prompt-modal-message { font-size: 0.78rem; color: var(--cahier-text); font-weight: 600; margin-bottom: 12px; }
.prompt-modal-input {
    width: 100%; padding: 10px 14px; background: var(--surface-3); border: 1px solid var(--cahier-border);
    border-radius: 8px; color: var(--cahier-text); font-size: 0.78rem; outline: none; font-family: 'Inter', sans-serif;
    transition: border-color 0.15s ease;
}
.prompt-modal-input:focus { border-color: rgba(var(--accent-rgb), 0.35); }
.prompt-modal .cahier-modal-footer { padding: 16px 0 0 0; border-top: none; }

/* ============================================================
   TOAST AVEC ANNULATION (façon Gmail) — pour les suppressions
   ============================================================ */
.undo-toast {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(140%);
    background: var(--ink); color: var(--ink-text); padding: 11px 12px 11px 18px; border-radius: 10px;
    font-size: 0.72rem; display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow-lg); z-index: 700000; opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.3s ease;
}
.undo-toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.undo-toast #undoToastBtn {
    background: rgba(255,255,255,0.15); color: inherit; border: none; border-radius: 6px;
    padding: 6px 14px; font-size: 0.68rem; font-weight: 700; cursor: pointer; transition: background 0.15s ease;
    white-space: nowrap;
}
.undo-toast #undoToastBtn:hover { background: rgba(255,255,255,0.25); }


/* ============================================================
   Tâches (vue Liste + Kanban),
   Objectifs (anneau de progression), Projets (bannière + progrès).
   Utilise exclusivement les tokens déjà définis dans reader.css
   (--cahier-*, --surface-*, --accent-*, --danger, --favorite...)
   pour rester parfaitement cohérent avec le thème clair/sombre.
   ============================================================ */

/* ---- Cartes de statistiques réutilisables (Tâches / Objectifs) ---- */
.tasks-header, .objectives-header, .projects-header { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.tasks-stats-row, .objectives-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.objectives-stats-row { grid-template-columns: repeat(3, 1fr); }
.tasks-stat-card {
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 12px; padding: 14px 16px;
    display: flex; align-items: center; gap: 12px; transition: all 0.2s ease;
}
.tasks-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tasks-stat-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; flex-shrink: 0; }
.tasks-stat-icon.total { background: var(--accent-soft); color: var(--cahier-accent); }
.tasks-stat-icon.done { background: rgba(76,175,80,0.12); color: #4caf50; }
.tasks-stat-icon.overdue { background: rgba(217,115,106,0.12); color: var(--danger); }
.tasks-stat-icon.today { background: rgba(224,184,84,0.14); color: var(--favorite); }
.tasks-stat-value { font-size: 1.25rem; font-weight: 800; color: var(--cahier-text); line-height: 1; }
.tasks-stat-label { font-size: 0.58rem; color: var(--cahier-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }

/* ---- Barre d'outils Tâches ---- */
.tasks-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tasks-view-toggle { display: flex; gap: 2px; background: var(--surface-4); border-radius: 8px; padding: 3px; }
.tasks-view-btn { padding: 6px 12px; border-radius: 6px; border: none; background: none; color: var(--cahier-muted); font-size: 0.68rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s ease; }
.tasks-view-btn.active { background: var(--cahier-bg); color: var(--cahier-text); box-shadow: var(--shadow-sm); }
.tasks-filter-select { height: 32px; border-radius: 7px; background: var(--surface-3); border: 1px solid var(--cahier-border); color: var(--cahier-text); font-size: 0.66rem; padding: 0 10px; cursor: pointer; }
.tasks-search-input { flex: 1; min-width: 160px; }

/* ---- Vue Liste : sections groupées par statut, repliables ---- */
.tasks-list-groups { display: flex; flex-direction: column; gap: 16px; }
.tasks-group-header { display: flex; align-items: center; gap: 8px; padding: 6px 4px; cursor: pointer; user-select: none; }
.tasks-group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tasks-group-dot.status-todo { background: var(--cahier-muted-2); }
.tasks-group-dot.status-in_progress { background: #2196f3; }
.tasks-group-dot.status-blocked { background: var(--danger); }
.tasks-group-dot.status-done { background: #4caf50; }
.tasks-group-title { font-size: 0.72rem; font-weight: 700; color: var(--cahier-text); }
.tasks-group-count { font-size: 0.55rem; color: var(--cahier-muted-2); background: var(--surface-5); padding: 1px 8px; border-radius: 8px; }
.tasks-group-chevron { margin-left: auto; font-size: 0.55rem; color: var(--cahier-muted-2); transition: transform 0.2s ease; }
.tasks-group.collapsed .tasks-group-chevron { transform: rotate(-90deg); }
.tasks-group.collapsed .tasks-group-body { display: none; }
.tasks-group-body { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }

.task-card-row {
    display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; border-radius: 10px;
    background: var(--surface-3); border: 1px solid var(--cahier-border); cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
}
.task-card-row:hover { background: var(--surface-5); border-color: var(--border-strong); transform: translateX(2px); }
.task-card-row.done { opacity: 0.55; }
.task-card-row.done .task-card-title { text-decoration: line-through; }
.task-card-row.overdue { border-left: 3px solid var(--danger); }
.task-check {
    width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--border-strong); flex-shrink: 0; margin-top: 1px;
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s ease; background: var(--cahier-bg); color: #fff;
}
.task-check:hover { border-color: var(--cahier-accent); }
.task-check.checked { background: #4caf50; border-color: #4caf50; }
.task-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.task-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-priority-flag { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.task-priority-flag.priority-high { background: var(--danger); }
.task-priority-flag.priority-medium { background: #e0b854; }
.task-priority-flag.priority-low { background: #4caf50; }
.task-card-title { font-size: 0.76rem; font-weight: 600; color: var(--cahier-text); }
.task-card-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.56rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-5); color: var(--cahier-muted); }
.task-chip.due-overdue { background: rgba(217,115,106,0.12); color: var(--danger); }
.task-chip.due-today { background: rgba(224,184,84,0.14); color: var(--favorite); }
.task-chip.project-chip { background: rgba(33,150,243,0.1); color: #2196f3; }
.task-chip.tag-chip { background: var(--accent-soft); color: var(--cahier-accent); }
.task-subtask-progress { display: flex; align-items: center; gap: 5px; font-size: 0.55rem; color: var(--cahier-muted-2); }
.task-subtask-track { width: 44px; height: 4px; border-radius: 3px; background: var(--surface-6); overflow: hidden; }
.task-subtask-fill { height: 100%; background: var(--cahier-accent); border-radius: 3px; }
.task-card-actions-row { display: flex; gap: 4px; margin-left: auto; opacity: 0; transition: opacity 0.15s ease; }
.task-card-row:hover .task-card-actions-row { opacity: 1; }
.tasks-quick-add {
    display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1.5px dashed var(--cahier-border);
    color: var(--cahier-muted-2); font-size: 0.7rem; cursor: pointer; transition: all 0.15s ease; margin-top: 4px;
}
.tasks-quick-add:hover { border-color: var(--cahier-accent); color: var(--cahier-accent); background: var(--accent-soft); }

/* ---- Vue Tableau (Kanban) avec glisser-déposer ---- */
.tasks-board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.tasks-board-col { background: var(--surface-2); border: 1px solid var(--cahier-border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; transition: all 0.15s ease; }
.tasks-board-col.drag-over { background: var(--accent-soft); border-color: var(--cahier-accent); }
.tasks-board-col-header { display: flex; align-items: center; gap: 7px; padding: 4px 4px 8px 4px; }
.tasks-board-col-title { font-size: 0.68rem; font-weight: 700; color: var(--cahier-text); }
.tasks-board-col-count { margin-left: auto; font-size: 0.55rem; color: var(--cahier-muted-2); background: var(--surface-5); padding: 1px 7px; border-radius: 8px; }
.task-board-card {
    background: var(--cahier-bg); border: 1px solid var(--cahier-border); border-radius: 9px; padding: 10px 11px;
    cursor: grab; transition: all 0.15s ease; display: flex; flex-direction: column; gap: 6px;
}
.task-board-card:active { cursor: grabbing; }
.task-board-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.task-board-card.dragging { opacity: 0.4; }
.task-board-card-title { font-size: 0.7rem; font-weight: 600; color: var(--cahier-text); line-height: 1.4; }
.task-board-card-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---- Modal de tâche enrichi ---- */
.task-modal-rich { width: 520px; }
.tm-title-input { width: 100%; font-size: 1.05rem; font-weight: 700; border: none; background: none; color: var(--cahier-text); outline: none; padding: 14px 20px 4px 20px; font-family: 'Inter', sans-serif; }
.tm-desc-input { width: 100%; min-height: 60px; border: none; background: none; color: var(--cahier-muted); outline: none; padding: 0 20px 10px 20px; font-size: 0.75rem; resize: vertical; font-family: 'Inter', sans-serif; }
.tm-props { padding: 0 20px 6px 20px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--cahier-border); margin-top: 6px; padding-top: 12px; }
.tm-prop-row { display: flex; align-items: center; gap: 10px; }
.tm-prop-label { width: 90px; flex-shrink: 0; font-size: 0.62rem; color: var(--cahier-muted-2); display: flex; align-items: center; gap: 6px; }
.tm-prop-row select, .tm-prop-row input[type=date], .tm-prop-row input[type=time], .tm-prop-row input[type=text] {
    flex: 1; height: 30px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--cahier-border);
    color: var(--cahier-text); font-size: 0.68rem; padding: 0 9px; outline: none; font-family: 'Inter', sans-serif;
}
.tm-prop-row select option { color: #191919; background: #ffffff; }
.tm-status-pills { display: flex; gap: 5px; flex-wrap: wrap; }
.tm-status-pill { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--cahier-border); background: var(--surface-3); color: var(--cahier-muted); font-size: 0.6rem; font-weight: 700; cursor: pointer; transition: all 0.15s ease; }
.tm-status-pill.active.status-todo { background: var(--surface-6); color: var(--cahier-text); border-color: var(--border-strong); }
.tm-status-pill.active.status-in_progress { background: rgba(33,150,243,0.14); color: #2196f3; border-color: rgba(33,150,243,0.3); }
.tm-status-pill.active.status-blocked { background: rgba(217,115,106,0.14); color: var(--danger); border-color: rgba(217,115,106,0.3); }
.tm-status-pill.active.status-done { background: rgba(76,175,80,0.14); color: #4caf50; border-color: rgba(76,175,80,0.3); }

.tm-subtasks { padding: 12px 20px; border-top: 1px solid var(--cahier-border); }
.tm-subtasks-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tm-subtasks-title { font-size: 0.62rem; color: var(--cahier-muted-2); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.tm-subtasks-progress { font-size: 0.58rem; color: var(--cahier-muted-2); }
.tm-subtask-row { display: flex; align-items: center; gap: 8px; padding: 5px 2px; }
.tm-subtask-row input[type=text] { flex: 1; background: none; border: none; color: var(--cahier-text); font-size: 0.7rem; outline: none; font-family: 'Inter', sans-serif; }
.tm-subtask-row.done input[type=text] { text-decoration: line-through; color: var(--cahier-muted-2); }
.tm-subtask-del { background: none; border: none; color: var(--cahier-muted-2); cursor: pointer; opacity: 0; transition: opacity 0.15s ease; }
.tm-subtask-row:hover .tm-subtask-del { opacity: 1; }
.tm-subtask-add { display: flex; align-items: center; gap: 8px; padding: 5px 2px; color: var(--cahier-muted-2); font-size: 0.68rem; cursor: pointer; }
.tm-subtask-add:hover { color: var(--cahier-accent); }

/* ============================================================
   OBJECTIFS — anneau de progression, badges, filtres
   ============================================================ */
.objectives-toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.objective-card-v2 {
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 14px; padding: 18px;
    display: flex; gap: 16px; transition: all 0.2s ease;
}
.objective-card-v2:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.obj-ring-wrap { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.obj-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.obj-ring-track { fill: none; stroke: var(--surface-6); stroke-width: 6; }
.obj-ring-fill { fill: none; stroke: var(--cahier-accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.8s cubic-bezier(0.16,1,0.3,1); }
.obj-ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; color: var(--cahier-text); }
.obj-body-v2 { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.obj-title-row { display: flex; align-items: center; gap: 8px; }
.obj-title-v2 { font-size: 0.85rem; font-weight: 700; color: var(--cahier-text); flex: 1; }
.obj-desc-v2 { font-size: 0.68rem; color: var(--cahier-muted); line-height: 1.5; }
.obj-progress-slider { width: 100%; accent-color: var(--cahier-accent); }
.obj-meta-row-v2 { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.obj-deadline-badge { font-size: 0.55rem; font-weight: 700; padding: 2px 9px; border-radius: 8px; background: var(--surface-5); color: var(--cahier-muted); display: inline-flex; align-items: center; gap: 4px; }
.obj-deadline-badge.urgent { background: rgba(217,115,106,0.12); color: var(--danger); }
.obj-actions-v2 { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s ease; flex-shrink: 0; }
.objective-card-v2:hover .obj-actions-v2 { opacity: 1; }

/* ============================================================
   PROJETS — bannière colorée, progression réelle, tâches liées
   ============================================================ */
.project-card-v2 {
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 14px; overflow: hidden;
    transition: all 0.2s ease; display: flex; flex-direction: column;
}
.project-card-v2:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.proj-banner { height: 6px; background: linear-gradient(90deg, var(--cahier-accent), var(--accent-light)); }
.proj-body-v2 { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.proj-header-v2 { display: flex; align-items: center; gap: 8px; }
.proj-title-v2 { font-size: 0.85rem; font-weight: 700; color: var(--cahier-text); flex: 1; }
.proj-status-badge { font-size: 0.52rem; font-weight: 700; padding: 2px 9px; border-radius: 8px; text-transform: uppercase; }
.proj-status-badge.status-active { background: var(--accent-soft); color: var(--cahier-accent); }
.proj-status-badge.status-done { background: rgba(76,175,80,0.12); color: #4caf50; }
.proj-status-badge.status-paused { background: rgba(224,184,84,0.14); color: var(--favorite); }
.proj-desc-v2 { font-size: 0.68rem; color: var(--cahier-muted); line-height: 1.5; }
.proj-progress-row { display: flex; align-items: center; gap: 8px; }
.proj-progress-track-v2 { flex: 1; height: 6px; border-radius: 4px; background: var(--surface-6); overflow: hidden; }
.proj-progress-fill-v2 { height: 100%; background: linear-gradient(90deg, var(--cahier-accent), var(--accent-light)); border-radius: 4px; transition: width 0.6s ease; }
.proj-progress-pct { font-size: 0.6rem; font-weight: 700; color: var(--cahier-text); min-width: 30px; text-align: right; }
.proj-footer-v2 { display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--cahier-border); }
.proj-tasks-count { font-size: 0.6rem; color: var(--cahier-muted-2); display: flex; align-items: center; gap: 5px; }
.proj-actions-v2 { margin-left: auto; display: flex; gap: 4px; }

@media (max-width: 900px) {
    .tasks-stats-row, .objectives-stats-row { grid-template-columns: repeat(2, 1fr); }
    .tasks-board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

/* ============================================================
   PATCH 6c — À COLLER À LA TOUTE FIN de notebook.css
   Refonte visuelle premium de l'onglet Projets : héros animé,
   cartes glossy, page de détail plein écran multi-onglets,
   anneaux de progression, chronologie d'activité, confettis.
   Tous les tokens (--cahier-*, --surface-*, --accent-*...) sont
   déjà définis dans reader.css : cohérence totale garantie avec
   le thème clair/sombre.
   ============================================================ */

.pj-header { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.pj-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.08), rgba(var(--accent-2-rgb),0.04));
    border: 1px solid var(--cahier-border); border-radius: 18px; padding: 22px 26px; position: relative; overflow: hidden;
}
.pj-hero::before {
    content: ''; position: absolute; top: -40%; right: -10%; width: 280px; height: 280px; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb),0.12), transparent 70%); pointer-events: none;
}
.pj-hero-eyebrow { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; color: var(--cahier-accent); display: flex; align-items: center; gap: 6px; }
.pj-hero-title { font-size: 1.4rem; font-weight: 800; color: var(--cahier-text); margin: 6px 0 4px 0; letter-spacing: -0.5px; }
.pj-hero-sub { font-size: 0.72rem; color: var(--cahier-muted); max-width: 420px; line-height: 1.6; }
.pj-hero-ring { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.pj-hero-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pj-hero-ring-track { fill: none; stroke: var(--surface-6); stroke-width: 8; }
.pj-hero-ring-fill { fill: none; stroke: var(--cahier-accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.16,1,0.3,1); }
.pj-hero-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pj-hero-ring-pct { font-size: 1.35rem; font-weight: 800; color: var(--cahier-text); }
.pj-hero-ring-label { font-size: 0.48rem; color: var(--cahier-muted-2); text-align: center; max-width: 80px; line-height: 1.3; margin-top: 2px; }

.pj-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pj-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Grille de cartes ---- */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pj-card {
    background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 16px; overflow: hidden;
    cursor: pointer; transition: all 0.25s cubic-bezier(0.4,0,0.2,1); display: flex; flex-direction: column;
    animation: pjCardIn 0.4s cubic-bezier(0.16,1,0.3,1) backwards;
}
@keyframes pjCardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.pj-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.pj-card.pj-card-complete { box-shadow: 0 0 0 1.5px rgba(76,175,80,0.35); }
.pj-card-cover { position: relative; height: 92px; display: flex; align-items: center; padding: 14px 16px; }
.pj-card-icon { font-size: 2.1rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25)); }
.pj-pin-btn {
    position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.2); backdrop-filter: blur(6px); color: rgba(255,255,255,0.75); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 0.7rem; transition: all 0.2s ease;
}
.pj-pin-btn:hover { background: rgba(255,255,255,0.32); color: #fff; transform: scale(1.1); }
.pj-pin-btn.active { color: #ffd54f; background: rgba(0,0,0,0.25); }
.pj-complete-badge {
    position: absolute; bottom: 8px; right: 10px; font-size: 0.5rem; font-weight: 800; color: #fff;
    background: rgba(0,0,0,0.28); backdrop-filter: blur(6px); padding: 3px 9px; border-radius: 20px;
    display: flex; align-items: center; gap: 4px; text-transform: uppercase; letter-spacing: 0.3px;
}
.pj-card-body { padding: 14px 16px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.pj-card-top-row { display: flex; align-items: center; gap: 8px; }
.pj-card-title { font-size: 0.85rem; font-weight: 700; color: var(--cahier-text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-status-badge { font-size: 0.5rem; font-weight: 800; padding: 3px 9px; border-radius: 8px; text-transform: uppercase; letter-spacing: 0.3px; flex-shrink: 0; }
.pj-status-badge.status-active { background: var(--accent-soft); color: var(--cahier-accent); }
.pj-status-badge.status-done { background: rgba(76,175,80,0.14); color: #4caf50; }
.pj-status-badge.status-paused { background: rgba(224,184,84,0.16); color: var(--favorite); }
.pj-status-badge.status-archived { background: var(--surface-6); color: var(--cahier-muted-2); }
.pj-card-desc { font-size: 0.66rem; color: var(--cahier-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pj-card-progress-row { display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--cahier-border); }
.pj-mini-ring { width: 40px; height: 40px; flex-shrink: 0; transform: rotate(-90deg); }
.pj-mini-ring-track { fill: none; stroke: var(--surface-6); stroke-width: 5; }
.pj-mini-ring-fill { fill: none; stroke: var(--cahier-accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.pj-card-progress-info { display: flex; flex-direction: column; line-height: 1.1; }
.pj-card-progress-pct { font-size: 0.82rem; font-weight: 800; color: var(--cahier-text); }
.pj-card-progress-label { font-size: 0.48rem; color: var(--cahier-muted-2); }
.pj-card-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }
.pj-chip { font-size: 0.52rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-5); color: var(--cahier-muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pj-chip-warn { background: rgba(224,184,84,0.16); color: var(--favorite); }
.pj-chip-danger { background: rgba(217,115,106,0.14); color: var(--danger); }

/* ---- Vue liste ---- */
.pj-list { display: flex; flex-direction: column; gap: 6px; }
.pj-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface-3);
    border: 1px solid var(--cahier-border); cursor: pointer; transition: all 0.15s ease;
}
.pj-row:hover { background: var(--surface-5); border-color: var(--border-strong); transform: translateX(2px); }
.pj-row-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.pj-row-title { font-size: 0.74rem; font-weight: 700; color: var(--cahier-text); min-width: 140px; flex-shrink: 0; }
.pj-row-progress-track { flex: 1; height: 5px; border-radius: 4px; background: var(--surface-6); overflow: hidden; }
.pj-row-progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.pj-row-pct { font-size: 0.62rem; font-weight: 700; color: var(--cahier-text); width: 32px; text-align: right; }
.pj-row-tasks { font-size: 0.6rem; color: var(--cahier-muted-2); display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.pj-empty { text-align: center; padding: 60px 20px; }
.pj-empty-icon { font-size: 2.6rem; color: var(--cahier-accent); opacity: 0.35; margin-bottom: 12px; }
.pj-empty h3 { font-size: 0.95rem; color: var(--cahier-text); margin-bottom: 6px; }
.pj-empty p { font-size: 0.72rem; color: var(--cahier-muted-2); max-width: 340px; margin: 0 auto; line-height: 1.6; }

/* ---- Modal de création (icône + couleur) ---- */
.pj-create-icons, .pj-create-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.pj-icon-choice { font-size: 1.3rem; padding: 6px 9px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: all 0.15s ease; }
.pj-icon-choice:hover { background: var(--surface-6); }
.pj-icon-choice.active { border-color: var(--cahier-accent); background: var(--accent-soft); }
.pj-color-choice { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.15s ease; }
.pj-color-choice:hover { transform: scale(1.15); }
.pj-color-choice.active { border-color: var(--cahier-text); box-shadow: 0 0 0 2px var(--surface-4); }

/* ============================================================
   PAGE DE DÉTAIL DE PROJET — plein écran, multi-onglets
   ============================================================ */
.project-detail-overlay {
    position: fixed; inset: 0; z-index: 400000; background: var(--bg-primary); display: none;
    flex-direction: column; overflow-y: auto;
}
.project-detail-overlay.active { display: flex; animation: pdFadeIn 0.25s ease; }
@keyframes pdFadeIn { from { opacity: 0; } to { opacity: 1; } }

.pd-cover { position: relative; padding: 20px 32px 54px 32px; overflow: hidden; flex-shrink: 0; }
.pd-cover-particles {
    position: absolute; inset: 0;
    background-image: radial-gradient(circle at 15% 25%, rgba(255,255,255,0.14) 0, transparent 3%),
                       radial-gradient(circle at 80% 15%, rgba(255,255,255,0.1) 0, transparent 4%),
                       radial-gradient(circle at 60% 70%, rgba(255,255,255,0.08) 0, transparent 5%),
                       radial-gradient(circle at 30% 80%, rgba(255,255,255,0.1) 0, transparent 3%);
    pointer-events: none;
}
.pd-topbar { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.pd-back {
    background: rgba(255,255,255,0.16); backdrop-filter: blur(8px); border: none; color: #fff; padding: 8px 16px;
    border-radius: 8px; font-size: 0.68rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
    transition: all 0.2s ease;
}
.pd-back:hover { background: rgba(255,255,255,0.26); transform: translateX(-2px); }
.pd-cover-actions { display: flex; gap: 6px; }
.pd-cover-actions button {
    width: 34px; height: 34px; border-radius: 9px; border: none; background: rgba(255,255,255,0.16); backdrop-filter: blur(8px);
    color: #fff; cursor: pointer; font-size: 0.7rem; transition: all 0.2s ease;
}
.pd-cover-actions button:hover { background: rgba(255,255,255,0.28); transform: translateY(-1px); }
.pd-cover-actions button.active { color: #ffd54f; }
.pd-identity { display: flex; align-items: flex-end; gap: 16px; margin-top: 26px; position: relative; z-index: 1; }
.pd-icon { font-size: 3.4rem; cursor: pointer; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); transition: transform 0.2s ease; }
.pd-icon:hover { transform: scale(1.08) rotate(-4deg); }
.pd-identity-text { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.pd-title-input {
    background: none; border: none; outline: none; color: #fff; font-size: 1.8rem; font-weight: 800; font-family: 'Inter', sans-serif;
    letter-spacing: -0.6px; text-shadow: 0 2px 10px rgba(0,0,0,0.2); padding: 0; width: 100%;
}
.pd-title-input::placeholder { color: rgba(255,255,255,0.6); }
.pd-status-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-status-pill { padding: 4px 12px; border-radius: 20px; font-size: 0.58rem; font-weight: 700; cursor: pointer; background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.75); backdrop-filter: blur(6px); transition: all 0.15s ease; border: none; }
.pd-status-pill:hover { background: rgba(255,255,255,0.22); }
.pd-status-pill.active { background: rgba(255,255,255,0.94); color: #191919; }

.pd-recolor-popover, .pd-icon-popover {
    position: absolute; top: 60px; right: 32px; z-index: 5; background: var(--cahier-bg); border: 1px solid var(--cahier-border);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 10px; display: none; gap: 8px; flex-wrap: wrap; max-width: 220px;
}
.pd-recolor-popover.open, .pd-icon-popover.open { display: flex; }
.pd-icon-popover { left: 32px; right: auto; top: 110px; }

.pd-stats-band {
    display: flex; align-items: center; gap: 28px; padding: 18px 32px 14px 32px; margin-top: -32px; position: relative; z-index: 2;
    background: var(--bg-primary); border-radius: 20px 20px 0 0; flex-wrap: wrap;
}
.pd-big-ring { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.pd-big-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15)); }
.pd-big-ring-track { fill: none; stroke: var(--surface-6); stroke-width: 8; }
.pd-big-ring-fill { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.16,1,0.3,1); }
.pd-big-ring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; font-weight: 800; color: var(--cahier-text); }
.pd-stat-block { display: flex; flex-direction: column; gap: 2px; }
.pd-stat-val { font-size: 1.1rem; font-weight: 800; color: var(--cahier-text); }
.pd-stat-lbl { font-size: 0.55rem; color: var(--cahier-muted-2); text-transform: uppercase; letter-spacing: 0.4px; }
.pd-stat-block.pd-stat-danger .pd-stat-val { color: var(--danger); }

.pd-tabs { display: flex; gap: 4px; padding: 6px 32px; border-bottom: 1px solid var(--cahier-border); flex-wrap: wrap; }
.pd-tabs button {
    padding: 9px 16px; border-radius: 8px 8px 0 0; border: none; background: none; color: var(--cahier-muted);
    font-size: 0.72rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: all 0.15s ease;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pd-tabs button:hover { color: var(--cahier-text); background: var(--surface-3); }
.pd-tabs button.active { color: var(--cahier-accent); border-bottom-color: var(--cahier-accent); }
.pd-body { padding: 22px 32px 60px 32px; flex: 1; }

/* ---- Aperçu ---- */
.pd-overview-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.pd-panel { background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 14px; padding: 16px 18px; }
.pd-panel-wide { grid-column: 1 / -1; }
.pd-panel-title { font-size: 0.68rem; font-weight: 800; color: var(--cahier-text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.pd-panel-link { margin-left: auto; background: none; border: none; color: var(--cahier-accent); font-size: 0.6rem; font-weight: 700; cursor: pointer; }
.pd-desc-textarea { width: 100%; min-height: 110px; background: none; border: none; outline: none; color: var(--cahier-text); font-size: 0.75rem; line-height: 1.7; resize: vertical; font-family: 'Inter', sans-serif; }
.pd-date-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--cahier-border); font-size: 0.68rem; color: var(--cahier-muted); }
.pd-date-row:last-child { border-bottom: none; }
.pd-date-row input, .pd-date-row select { background: var(--surface-4); border: 1px solid var(--cahier-border); border-radius: 6px; color: var(--cahier-text); font-size: 0.66rem; padding: 5px 9px; outline: none; }
.pd-mini-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 0.7rem; color: var(--cahier-text); }
.pd-mini-check { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 0.5rem; color: #fff; flex-shrink: 0; }
.pd-mini-check.checked { background: #4caf50; border-color: #4caf50; }
.pd-mini-done { text-decoration: line-through; color: var(--cahier-muted-2); }
.pd-mini-date { margin-left: auto; font-size: 0.55rem; color: var(--cahier-muted-2); }
.pd-empty-hint { font-size: 0.66rem; color: var(--cahier-muted-2); font-style: italic; }

/* ---- Tâches (dans le détail projet) ---- */
.pd-tasks-toolbar { margin-bottom: 14px; }

/* ---- Jalons ---- */
.pd-milestones-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 0.66rem; color: var(--cahier-muted); }
.pd-milestones-track { flex: 1; height: 6px; border-radius: 4px; background: var(--surface-6); overflow: hidden; }
.pd-milestones-fill { height: 100%; background: linear-gradient(90deg,var(--cahier-accent),var(--accent-light)); border-radius: 4px; transition: width 0.6s ease; }
.pd-milestone-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--cahier-border); }
.pd-milestone-row.done input[type=text] { text-decoration: line-through; color: var(--cahier-muted-2); }
.pd-milestone-row input[type=text] { flex: 1; background: none; border: none; outline: none; color: var(--cahier-text); font-size: 0.74rem; font-family: 'Inter', sans-serif; }
.pd-milestone-row input[type=date] { background: var(--surface-4); border: 1px solid var(--cahier-border); border-radius: 6px; color: var(--cahier-text); font-size: 0.62rem; padding: 4px 8px; }

/* ---- Activité ---- */
.pd-activity-timeline { display: flex; flex-direction: column; gap: 2px; position: relative; padding-left: 6px; }
.pd-activity-timeline::before { content: ''; position: absolute; left: 17px; top: 6px; bottom: 6px; width: 2px; background: var(--cahier-border); }
.pd-activity-item { display: flex; align-items: flex-start; gap: 14px; padding: 9px 0; position: relative; }
.pd-activity-dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.55rem; flex-shrink: 0; z-index: 1; box-shadow: 0 0 0 4px var(--bg-primary); }
.pd-activity-text { display: flex; flex-direction: column; gap: 2px; font-size: 0.7rem; color: var(--cahier-text); }
.pd-activity-date { font-size: 0.55rem; color: var(--cahier-muted-2); }

/* ---- Confettis (célébration à 100%) ---- */
.pd-confetti-piece {
    position: fixed; top: -10px; width: 8px; height: 14px; z-index: 900000; pointer-events: none; border-radius: 2px;
    animation: pdConfettiFall 1.6s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}
@keyframes pdConfettiFall {
    0% { transform: translate(0,0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--tx,0), 100vh) rotate(540deg); opacity: 0; }
}

@media (max-width: 900px) {
    .pj-hero { flex-direction: column; align-items: flex-start; }
    .pj-stats-row { grid-template-columns: 1fr 1fr; }
    .pj-grid { grid-template-columns: 1fr; }
    .pd-overview-grid { grid-template-columns: 1fr; }
    .pd-stats-band { gap: 16px; }
    .pd-cover, .pd-body { padding-left: 18px; padding-right: 18px; }
    .pd-tabs { padding-left: 18px; padding-right: 18px; }
}

/* ============================================================
   PATCH 7c — À COLLER À LA TOUTE FIN de notebook.css
   Reproduction fidèle du langage visuel de Notion pour la base
   de données : en-tête de page, sélecteur de vues, barre d'outils
   (recherche/filtrer/trier/propriété), tableau éditable, pastilles
   à 9 couleurs, vues Kanban/Galerie/Liste, popovers flottants,
   barre d'actions groupées.
   ============================================================ */

/* ---- En-tête de page ---- */
.db-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.db-title-row { display: flex; align-items: center; gap: 10px; }
.db-icon-badge { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--cahier-accent); display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.db-page-title { font-size: 1.15rem; font-weight: 800; color: var(--cahier-text); letter-spacing: -0.3px; }
.db-count-badge { font-size: 0.6rem; font-weight: 700; color: var(--cahier-muted-2); background: var(--surface-5); padding: 2px 9px; border-radius: 10px; }
.db-view-toggle { display: flex; gap: 2px; background: var(--surface-4); border-radius: 9px; padding: 3px; }
.db-view-btn { padding: 7px 13px; border-radius: 7px; border: none; background: none; color: var(--cahier-muted); font-size: 0.68rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s ease; }
.db-view-btn.active { background: var(--cahier-bg); color: var(--cahier-text); box-shadow: var(--shadow-sm); }
.db-view-btn:hover:not(.active) { color: var(--cahier-text); }

/* ---- Barre d'outils ---- */
.db-toolbar-v2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--cahier-border); }
.db-search-wrap { display: flex; align-items: center; gap: 8px; background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 7px; padding: 6px 10px; min-width: 180px; }
.db-search-wrap i { color: var(--cahier-muted-2); font-size: 0.65rem; }
.db-search-wrap input { flex: 1; background: none; border: none; outline: none; color: var(--cahier-text); font-size: 0.7rem; font-family: 'Inter', sans-serif; }
.db-tool-btn {
    height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--cahier-border); background: var(--surface-3);
    color: var(--cahier-muted); font-size: 0.68rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: all 0.15s ease;
}
.db-tool-btn:hover { background: var(--surface-6); color: var(--cahier-text); }

/* ---- Tableau ---- */
.db-table-wrap-v2 { border: 1px solid var(--cahier-border); border-radius: 10px; overflow: auto; }
.db-table-v2 { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.db-table-v2 thead th {
    text-align: left; padding: 8px 14px; background: var(--surface-3); color: var(--cahier-muted-2);
    font-weight: 700; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
    border-bottom: 1px solid var(--cahier-border); border-right: 1px solid var(--cahier-border);
    cursor: pointer; user-select: none; transition: color 0.15s ease;
}
.db-table-v2 thead th i { opacity: 0.6; margin-right: 4px; }
.db-table-v2 thead th:hover { color: var(--cahier-text); }
.db-table-v2 thead th.sorted-asc, .db-table-v2 thead th.sorted-desc { color: var(--cahier-accent); }
.db-th-check { width: 34px; }
.db-th-add { width: 34px; text-align: center; }
.db-th-add button { background: none; border: none; color: var(--cahier-muted-2); cursor: pointer; font-size: 0.6rem; }
.db-th-add button:hover { color: var(--cahier-accent); }
.db-table-v2 tbody tr { cursor: pointer; transition: background 0.1s ease; border-bottom: 1px solid var(--cahier-border); }
.db-table-v2 tbody tr:hover { background: var(--surface-3); }
.db-table-v2 td { padding: 7px 14px; color: var(--cahier-text); white-space: nowrap; border-right: 1px solid var(--cahier-border); vertical-align: middle; }
.db-td-check { width: 34px; text-align: center; }
.db-row-check { width: 13px; height: 13px; cursor: pointer; accent-color: var(--cahier-accent); }
.db-cell-title-v2 { font-weight: 700; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.db-editable-v2 { cursor: pointer; transition: background 0.12s ease; }
.db-editable-v2:hover { background: var(--surface-5); }
.db-empty-cell { color: var(--cahier-muted-2); font-style: italic; font-size: 0.66rem; }
.db-add-row { display: flex; align-items: center; gap: 8px; padding: 9px 14px; color: var(--cahier-muted-2); font-size: 0.68rem; cursor: pointer; border-top: 1px solid var(--cahier-border); transition: all 0.15s ease; }
.db-add-row:hover { color: var(--cahier-accent); background: var(--accent-soft); }
.db-td-checkbox { text-align: center; }
.db-checkbox { display: inline-flex; width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--border-strong); align-items: center; justify-content: center; color: #fff; font-size: 0.5rem; }
.db-checkbox.checked { background: #4caf50; border-color: #4caf50; }
.db-date-pill { font-size: 0.62rem; color: var(--cahier-muted); background: var(--surface-5); padding: 2px 8px; border-radius: 5px; }
.db-url-link { color: var(--cahier-accent); text-decoration: underline; font-size: 0.68rem; }
.db-relation-chip { font-size: 0.62rem; color: var(--cahier-accent-2); background: rgba(var(--accent-2-rgb),0.1); padding: 2px 8px; border-radius: 5px; }

/* ---- Pastilles colorées façon Notion (9 couleurs) ---- */
.db-pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 4px; font-size: 0.64rem; font-weight: 600; margin: 1px 3px 1px 0; white-space: nowrap; }
.db-pill-gray { background: rgba(155,154,151,0.18); color: #9b9a97; }
.db-pill-brown { background: rgba(169,120,79,0.18); color: #a9784f; }
.db-pill-orange { background: rgba(217,115,13,0.16); color: #d9730d; }
.db-pill-yellow { background: rgba(203,145,47,0.18); color: #cb912f; }
.db-pill-green { background: rgba(76,175,80,0.16); color: #4caf50; }
.db-pill-blue { background: rgba(33,150,243,0.16); color: #2196f3; }
.db-pill-purple { background: rgba(156,39,176,0.16); color: #9c27b0; }
.db-pill-pink { background: rgba(233,30,99,0.14); color: #e91e63; }
.db-pill-red { background: rgba(229,57,53,0.16); color: #e53935; }
.db-pill-removable { gap: 5px; cursor: default; }
.db-pill-removable i { cursor: pointer; opacity: 0.6; }
.db-pill-removable i:hover { opacity: 1; }

/* ---- Popovers flottants (filtrer / trier / cellule / propriété) ---- */
.db-filter-popover, .db-sort-popover {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 400; min-width: 280px;
    background: var(--cahier-bg); border: 1px solid var(--cahier-border); border-radius: 10px; box-shadow: var(--shadow-lg);
    padding: 12px; display: none;
}
.db-filter-popover.open, .db-sort-popover.open { display: block; }
.db-filter-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.db-filter-row select, .db-filter-row input { height: 28px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--cahier-border); color: var(--cahier-text); font-size: 0.64rem; padding: 0 7px; outline: none; }
.db-filter-row select { flex-shrink: 0; }
.db-filter-row input { flex: 1; min-width: 0; }
.db-filter-row button { background: none; border: none; color: var(--cahier-muted-2); cursor: pointer; font-size: 0.6rem; flex-shrink: 0; }
.db-filter-row button:hover { color: var(--danger); }
.db-filter-empty { font-size: 0.64rem; color: var(--cahier-muted-2); text-align: center; padding: 6px 0; }
.db-filter-add { width: 100%; padding: 7px; border-radius: 7px; border: 1px dashed var(--cahier-border); background: none; color: var(--cahier-muted); font-size: 0.64rem; cursor: pointer; }
.db-filter-add:hover { border-color: var(--cahier-accent); color: var(--cahier-accent); }
.db-sort-popover select { width: 100%; height: 30px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--cahier-border); color: var(--cahier-text); font-size: 0.66rem; padding: 0 8px; outline: none; margin-bottom: 8px; }
.db-sort-dir-toggle { display: flex; gap: 6px; }
.db-sort-dir-toggle button { flex: 1; padding: 7px; border-radius: 6px; border: 1px solid var(--cahier-border); background: var(--surface-3); color: var(--cahier-muted); font-size: 0.62rem; font-weight: 600; cursor: pointer; }
.db-sort-dir-toggle button.active { background: var(--accent-soft); color: var(--cahier-accent); border-color: rgba(var(--accent-rgb),0.3); }

.db-cell-editor-popover {
    position: fixed; z-index: 500000; background: var(--cahier-bg); border: 1px solid var(--cahier-border);
    border-radius: 9px; box-shadow: var(--shadow-lg); padding: 8px; min-width: 200px; max-width: 260px;
}
.db-editor-input { width: 100%; height: 30px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--cahier-border); color: var(--cahier-text); font-size: 0.7rem; padding: 0 9px; outline: none; font-family: 'Inter', sans-serif; margin-bottom: 6px; }
.db-editor-option { padding: 7px 9px; border-radius: 6px; cursor: pointer; transition: background 0.12s ease; }
.db-editor-option:hover { background: var(--surface-5); }
.db-editor-clear { font-size: 0.62rem; color: var(--cahier-muted-2); border-top: 1px solid var(--cahier-border); margin-top: 4px; padding-top: 8px; }
.db-editor-tags { display: flex; flex-wrap: wrap; gap: 2px; }

.db-addprop-flyout {
    position: fixed; z-index: 500000; background: var(--cahier-bg); border: 1px solid var(--cahier-border);
    border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px; width: 230px;
}
.db-proptype-list { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; }
.db-proptype-option { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 0.68rem; color: var(--cahier-text); }
.db-proptype-option i { width: 14px; text-align: center; color: var(--cahier-muted-2); }
.db-proptype-option:hover { background: var(--surface-5); }
.db-proptype-option.active { background: var(--accent-soft); color: var(--cahier-accent); }
.db-proptype-option.active i { color: var(--cahier-accent); }

/* ---- Vue Kanban ---- */
.db-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.db-board-col { background: var(--surface-2); border: 1px solid var(--cahier-border); border-radius: 12px; padding: 10px; min-width: 240px; flex-shrink: 0; }
.db-board-col-header { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px 4px; }
.db-board-col-count { margin-left: auto; font-size: 0.55rem; color: var(--cahier-muted-2); background: var(--surface-5); padding: 1px 7px; border-radius: 8px; }
.db-board-col-body { display: flex; flex-direction: column; gap: 6px; }
.db-board-card { background: var(--cahier-bg); border: 1px solid var(--cahier-border); border-radius: 8px; padding: 9px 11px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.15s ease; }
.db-board-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.db-board-card-title { font-size: 0.7rem; font-weight: 600; color: var(--cahier-text); }

/* ---- Vue Galerie ---- */
.db-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.db-gallery-card { background: var(--surface-3); border: 1px solid var(--cahier-border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: all 0.18s ease; }
.db-gallery-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.db-gallery-cover { height: 70px; background: var(--surface-5); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.db-gallery-body { padding: 10px 12px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.db-gallery-title { font-size: 0.72rem; font-weight: 700; color: var(--cahier-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-gallery-props { display: flex; flex-wrap: wrap; gap: 3px; }

/* ---- Vue Liste ---- */
.db-simplelist { display: flex; flex-direction: column; }
.db-simplelist-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--cahier-border); cursor: pointer; transition: background 0.12s ease; }
.db-simplelist-row:hover { background: var(--surface-3); }
.db-simplelist-title { font-size: 0.72rem; font-weight: 600; color: var(--cahier-text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-simplelist-date { font-size: 0.6rem; color: var(--cahier-muted-2); flex-shrink: 0; }

/* ---- Barre d'actions groupées ---- */
.db-bulk-bar {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 600000;
    background: var(--ink); color: var(--ink-text); padding: 10px 14px 10px 18px; border-radius: 10px;
    display: flex; align-items: center; gap: 14px; font-size: 0.7rem; font-weight: 600; box-shadow: var(--shadow-lg);
    animation: dbBulkIn 0.2s cubic-bezier(0.16,1,0.3,1);
}
@keyframes dbBulkIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.db-bulk-bar button { background: rgba(255,255,255,0.15); border: none; color: inherit; border-radius: 7px; padding: 6px 12px; font-size: 0.66rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.db-bulk-bar button:hover { background: rgba(255,255,255,0.26); }

@media (max-width: 900px) {
    .db-toolbar-v2 { flex-direction: column; align-items: stretch; }
    .db-gallery { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   EN-TÊTES DE TABLEUR — bouton "⋮" au survol + popup façon Excel
   ============================================================ */
.ss-table th.ss-head { position: relative; cursor: grab; }
.ss-table th.ss-head:active { cursor: grabbing; }
.ss-head-menu-btn {
    position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 4px;
    background: none; border: none; color: var(--cahier-muted-2); font-size: 0.5rem; cursor: pointer;
    opacity: 0; transition: opacity 0.15s ease, background 0.15s ease; display: flex; align-items: center; justify-content: center;
}
.ss-table th.ss-head:hover .ss-head-menu-btn { opacity: 1; }
.ss-head-menu-btn:hover { background: var(--surface-8); color: var(--cahier-text); }
.ss-head-dragging { opacity: 0.4; }
.ss-head-dropzone { box-shadow: inset 0 0 0 2px var(--cahier-accent); }
.ss-head-popover {
    position: fixed; z-index: 500000; background: var(--cahier-bg); border: 1px solid var(--cahier-border);
    border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px;
    animation: mftIn 0.15s cubic-bezier(0.16,1,0.3,1);
}
.ss-head-popover button {
    width: 100%; text-align: left; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    border-radius: 7px; border: none; background: none; color: var(--danger); font-size: 0.7rem; cursor: pointer;
}
.ss-head-popover button:hover { background: rgba(217,115,106,0.1); }
.ss-head-popover-hint { padding: 8px 10px 4px 10px; font-size: 0.58rem; color: var(--cahier-muted-2); border-top: 1px solid var(--cahier-border); margin-top: 4px; display: flex; align-items: center; gap: 6px; }

/* ============================================================
   GLISSÉ D'IMAGE EN COURS — retour visuel (ombre + légère
   transparence) pendant que l'image suit la souris en position
   "fixed", au-dessus de tout le reste de l'interface.
   ============================================================ */
.note-media-wrap.media-dragging-live {
    box-shadow: 0 14px 34px rgba(0,0,0,0.4);
    opacity: 0.94;
    transition: none !important;
    cursor: grabbing;
}
/* ============================================================
   ONGLET "MES LIVRES" — mis en valeur (badge "Nouveau" + accent
   coloré) pour qu'il saute aux yeux dès l'ouverture du Cahier.
   ============================================================ */
#cahierTabs [data-cahier-tab="books"] {
    position: relative;
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.16), rgba(var(--accent-2-rgb),0.10));
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    color: var(--cahier-text);
    font-weight: 700;
}
#cahierTabs [data-cahier-tab="books"]:hover {
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.24), rgba(var(--accent-2-rgb),0.16));
}
#cahierTabs [data-cahier-tab="books"]::after {
    content: 'Nouveau';
    position: absolute;
    top: -8px;
    right: -6px;
    background: var(--danger);
    color: #fff;
    font-size: 0.42rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
    letter-spacing: 0.3px;
    box-shadow: 0 0 0 2px var(--cahier-bg);
    animation: cahierBooksBadgeIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes cahierBooksBadgeIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }