/* ============================================================
   Gestion et suivi de projets — feuille de style principale
   Adaptée du prototype HTML (référence graphique obligatoire).
   Palette bleu pétrole / ivoire / ambre — ne pas modifier.
   ============================================================ */

/* ===== RESET & TOKENS ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --petrol:        #1b3050;
    --petrol-mid:    #243e64;
    --petrol-light:  #2e4f7a;
    --ivory:         #f4efe5;
    --ivory-warm:    #faf7f1;
    --ivory-border:  #e3dcd0;
    --stone:         #8a857c;
    --stone-light:   #c5bfb5;
    --amber:         #b5651d;
    --amber-light:   #d4842e;
    --sage:          #5d7a61;
    --sage-light:    #7a9e7e;
    --brick:         #8b3a2a;
    --brick-light:   #a84535;
    --text:          #1b2d3f;
    --text-mid:      #4a5363;
    --text-muted:    #8a857c;
    --font-display:  'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
    --font-body:     'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono:     'JetBrains Mono', 'Courier New', ui-monospace, monospace;
    --radius-sm:     2px;
    --radius-md:     4px;
    --transition:    200ms cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { height: 100%; }

body {
    font-family: var(--font-body);
    background: var(--ivory);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.app-body { overflow: hidden; }

/* ===== LOGIN / PAGES PUBLIQUES ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--petrol);
    position: relative;
    padding: 1.5rem;
}

.login-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 60%, rgba(93, 122, 97, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, rgba(181, 101, 29, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.login-box {
    background: var(--ivory-warm);
    padding: 3.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    border: 1px solid rgba(255,255,255,0.06);
}

.login-institution {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--amber);
    margin-bottom: 1rem;
}

.login-box h1 {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 300;
    line-height: 0.98;
    color: var(--petrol);
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
}

.login-box .subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--ivory-border);
    line-height: 1.6;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-submit {
    width: 100%;
    justify-content: center;
    padding: 0.875rem;
    letter-spacing: 0.07em;
    font-size: 0.78rem;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.auth-links {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--ivory-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.auth-links a {
    color: var(--amber);
    text-decoration: none;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}
.auth-links a:hover { color: var(--amber-light); text-decoration: underline; }

/* ===== FORMULAIRES ===== */
.form-group { display: flex; flex-direction: column; }

.form-group label,
.filter-group label {
    margin-bottom: 0.45rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.72rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="url"],
select,
textarea {
    padding: 0.7rem 0.875rem;
    border: 1px solid var(--ivory-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-body);
    background: var(--ivory-warm);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(181, 101, 29, 0.09);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a857c' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

textarea { resize: vertical; min-height: 80px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-group.full { grid-column: 1 / -1; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
}

.checkbox-item input {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--petrol);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* ===== BOUTONS ===== */
button, .btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
}

.btn-primary { background: var(--petrol); color: rgba(255,255,255,0.9); }
.btn-primary:hover { background: var(--petrol-mid); }

.btn-secondary {
    background: transparent;
    color: var(--text-mid);
    border: 1px solid var(--ivory-border);
}
.btn-secondary:hover { border-color: var(--petrol); color: var(--petrol); }

.btn-sm { padding: 0.4rem 0.825rem; font-size: 0.8rem; }
.btn-xs { padding: 0.275rem 0.575rem; font-size: 0.72rem; }

.btn-danger { background: var(--brick); color: white; }
.btn-danger:hover { background: var(--brick-light); }

.btn-success { background: var(--sage); color: white; }
.btn-success:hover { background: var(--sage-light); }

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.3rem;
}
.btn-ghost:hover { background: var(--ivory-border); color: var(--text); }

button:disabled, .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ===== MESSAGES ===== */
.error-message {
    color: var(--brick);
    font-size: 0.82rem;
    margin-top: 0.4rem;
}

.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    border: 1px solid;
    border-left-width: 3px;
}

.alert-success {
    background: rgba(93, 122, 97, 0.08);
    border-color: rgba(93, 122, 97, 0.35);
    border-left-color: var(--sage);
    color: var(--sage);
}

.alert-error {
    background: rgba(139, 58, 42, 0.06);
    border-color: rgba(139, 58, 42, 0.3);
    border-left-color: var(--brick);
    color: var(--brick);
}

.alert ul { margin-left: 1.1rem; }

/* ===== STRUCTURE GÉNÉRALE ===== */
.app-wrapper {
    display: flex;
    height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 252px;
    background: var(--petrol);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: fixed;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar-header {
    padding: 2rem 1.75rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--amber);
    margin-bottom: 0.6rem;
}

.sidebar-logo {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 300;
    color: rgba(255,255,255,0.9);
    letter-spacing: -0.01em;
    line-height: 1.05;
}

.user-card {
    margin: 1.25rem 1.75rem;
    padding: 0.875rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(181, 101, 29, 0.2);
    border: 1px solid rgba(181, 101, 29, 0.35);
    color: var(--amber);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    margin-bottom: 0.7rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.82);
}

.user-role {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.38);
    margin-top: 0.15rem;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.sidebar-section-label {
    padding: 0.75rem 1.75rem 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.57rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.22);
}

.sidebar-nav {
    flex: 1;
    padding: 0.35rem 0;
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.75rem;
    cursor: pointer;
    transition: all var(--transition);
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    color: rgba(255,255,255,0.45);
    font-size: 0.875rem;
    text-align: left;
    width: 100%;
    font-family: var(--font-body);
    text-decoration: none;
}

.nav-item:hover {
    color: rgba(255,255,255,0.82);
    background: rgba(255,255,255,0.04);
}

.nav-item.active {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.055);
    border-left-color: var(--amber);
}

.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item:hover svg, .nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.09);
    color: rgba(255,255,255,0.38);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    padding: 0.55rem 0.875rem;
    border-radius: var(--radius-sm);
    justify-content: center;
}
.logout-btn:hover {
    background: rgba(139, 58, 42, 0.2);
    border-color: rgba(139, 58, 42, 0.5);
    color: rgba(255,255,255,0.65);
}

/* ===== ZONE PRINCIPALE ===== */
.main-wrapper {
    margin-left: 252px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    background: var(--ivory-warm);
    border-bottom: 1px solid var(--ivory-border);
    padding: 0.875rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 54px;
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 300;
    color: var(--petrol);
    letter-spacing: -0.01em;
}

.topbar-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.sidebar-toggle { display: none; }

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
    background: var(--ivory);
}

.page-enter { animation: pageIn 0.22s ease-out; }

@keyframes pageIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ivory-border); }
::-webkit-scrollbar-thumb:hover { background: var(--stone-light); }

/* ===== EN-TÊTE DE PAGE ===== */
.observatory-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--ivory-border);
}

.observatory-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--amber);
    margin-bottom: 0.45rem;
}

.observatory-title {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 300;
    color: var(--petrol);
    line-height: 1.08;
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}

.observatory-meta {
    display: flex;
    gap: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.observatory-meta-item::after {
    content: ' · ';
    margin: 0 0.5rem;
    color: var(--stone-light);
}
.observatory-meta-item:last-child::after { content: ''; }

/* ===== MÉTRIQUES TABLEAU DE BORD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--ivory-border);
    border: 1px solid var(--ivory-border);
    margin-bottom: 2.5rem;
}

.metric-card {
    background: var(--ivory-warm);
    padding: 1.75rem;
    position: relative;
    transition: background var(--transition);
}
.metric-card:hover { background: #fcf9f4; }

.metric-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: var(--ivory-border);
}
.metric-card.warning::after { background: var(--amber); }
.metric-card.danger::after  { background: var(--brick); }
.metric-card.success::after { background: var(--sage); }

.metric-value {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 300;
    color: var(--petrol);
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.metric-value .metric-unit { font-size: 1.5rem; }

.metric-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-family: var(--font-mono);
}

/* ===== TITRES DE SECTION ===== */
.section-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--petrol);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--ivory-border);
    letter-spacing: -0.01em;
}

.dashboard-section { margin-bottom: 2.5rem; }

.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* ===== GRAPHIQUES (barres fines) ===== */
.chart-container {
    background: var(--ivory-warm);
    padding: 1.5rem;
    border: 1px solid var(--ivory-border);
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.1rem;
}
.chart-row:last-child { margin-bottom: 0; }

.chart-label {
    min-width: 155px;
    font-size: 0.875rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-bar-wrapper {
    flex: 1;
    height: 3px;
    background: var(--ivory-border);
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    background: var(--petrol);
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.chart-value {
    min-width: 38px;
    text-align: right;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

.chart-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}

.badge-primary { background: rgba(27,48,80,0.07); color: var(--petrol); }
.badge-success { background: rgba(93,122,97,0.1);  color: var(--sage); }
.badge-warning { background: rgba(181,101,29,0.1); color: var(--amber); }
.badge-danger  { background: rgba(139,58,42,0.1);  color: var(--brick); }
.badge-muted   { background: rgba(138,133,124,0.12); color: var(--stone); }

/* Badge de priorité : p1 = basse (vert), p2 = moyenne (orange), p3 = haute/critique (rouge) */
.priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.priority-badge.p1 { background: var(--sage);  color: white; }
.priority-badge.p2 { background: var(--amber); color: white; }
.priority-badge.p3 { background: var(--brick); color: white; }

/* ===== CARTES DE TÂCHES ===== */
.task-section {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.task-section-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--petrol);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--ivory-border);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.task-section-title.late {
    color: var(--brick);
    border-bottom: 2px solid var(--brick);
}

.task-count-badge {
    background: var(--brick);
    color: white;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: auto;
    font-family: var(--font-mono);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.task-card {
    background: var(--ivory);
    padding: 0.875rem 1.125rem;
    border-left: 2px solid var(--ivory-border);
    transition: border-left-color var(--transition), transform var(--transition);
}
.task-card:hover {
    border-left-color: var(--amber);
    transform: translateX(2px);
}
.task-card.urgent {
    border-left-color: var(--brick);
    background: rgba(139,58,42,0.025);
}

.task-card-title {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.45rem;
    font-size: 0.875rem;
}

.task-card-meta {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    font-size: 0.72rem;
    color: var(--text-muted);
    align-items: center;
}

.task-card-project {
    background: var(--ivory-warm);
    padding: 0.15rem 0.45rem;
    color: var(--text-mid);
    font-weight: 500;
    border: 1px solid var(--ivory-border);
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

/* ===== ÉTAT VIDE ===== */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    opacity: 0.3;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: center;
}

.empty-state p { font-size: 0.95rem; }

.empty-state .empty-state-hint {
    font-size: 0.8rem;
    margin-top: 0.4rem;
    font-family: var(--font-mono);
}

/* ===== CALENDRIER ===== */
.calendar-wrapper {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 2rem;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.calendar-month {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--petrol);
    letter-spacing: -0.01em;
    text-transform: capitalize;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--ivory-border);
    border: 1px solid var(--ivory-border);
}

.calendar-day-header {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.75rem 0.5rem;
    background: var(--ivory);
}

.calendar-day {
    background: var(--ivory-warm);
    padding: 0.625rem;
    min-height: 85px;
    overflow-y: auto;
}

.calendar-day.other-month { background: var(--ivory); opacity: 0.55; }

.calendar-day.today {
    background: rgba(27,48,80,0.04);
    outline: 1px solid var(--petrol);
    outline-offset: -1px;
}

.calendar-date {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-mid);
    margin-bottom: 0.35rem;
}
.calendar-day.today .calendar-date { color: var(--petrol); }

.calendar-event {
    font-size: 0.64rem;
    padding: 0.22rem 0.4rem;
    margin-bottom: 0.2rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 2px solid;
}
.calendar-event.deadline {
    background: rgba(27,48,80,0.06);
    border-color: var(--petrol);
    color: var(--text-mid);
}
.calendar-event.late {
    background: rgba(139,58,42,0.07);
    border-color: var(--brick);
    color: var(--brick);
}
.calendar-event.urgent {
    background: rgba(181,101,29,0.07);
    border-color: var(--amber);
    color: var(--amber);
}

/* ===== FRISE / GANTT ===== */
.gantt-container {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 1.5rem;
    overflow-x: auto;
}

.gantt-legend {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 1.25rem;
    margin-bottom: 1.75rem;
    border-radius: var(--radius-md);
}

.gantt-legend-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--petrol);
    margin-bottom: 0.75rem;
}

.gantt-legend-items {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gantt-swatch {
    width: 20px;
    height: 8px;
    border-radius: 2px;
}
.gantt-swatch.project { background: var(--petrol); }
.gantt-swatch.task    { background: var(--amber); opacity: 0.6; }

/* ===== FILTRES PROJETS ===== */
.projects-toolbar { margin-bottom: 1.5rem; }

.projects-search {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.5rem;
}

.projects-search input {
    width: 100%;
    max-width: 480px;
    background: var(--ivory);
}

.projects-filters {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* ===== CARTE PROJET ===== */
.project-card {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
    margin-bottom: 1rem;
}

.project-card:hover {
    border-color: var(--petrol);
    box-shadow: 0 2px 8px rgba(27, 48, 80, 0.06);
}

.project-card-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    border-bottom: 1px solid var(--ivory-border);
    transition: background var(--transition);
}

.project-card.expanded .project-card-header {
    background: rgba(27, 48, 80, 0.02);
    border-bottom: 2px solid var(--petrol);
}

.project-card-header-left { flex: 1; }

.project-card-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--petrol);
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.project-card-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.project-card-members {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.project-card-member-badge {
    background: var(--ivory);
    border: 1px solid var(--ivory-border);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    color: var(--text-mid);
}

/* Responsable : même badge, liseré ambre discret */
.project-card-member-badge.responsible {
    border-color: rgba(181, 101, 29, 0.45);
    color: var(--amber);
}

/* ===== ÉPINGLAGE (favori personnel) ===== */
.pin-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--stone-light);
    transition: color var(--transition);
    border-radius: var(--radius-sm);
    padding: 0;
    flex-shrink: 0;
}

.pin-btn:hover {
    color: var(--amber);
    background: var(--ivory-border);
}

.pin-btn.pinned { color: var(--amber); }
.pin-btn svg { width: 16px; height: 16px; }

/* ===== BADGE « RÉALISÉ » (livrables, projets Chaire, mes projets) ===== */
.done-badge {
    cursor: pointer;
    border: 1px solid var(--ivory-border);
    background: var(--ivory);
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
    transition: all var(--transition);
}

.done-badge:hover {
    border-color: var(--sage);
    color: var(--sage);
}

.done-badge.is-done {
    background: color-mix(in srgb, var(--sage) 16%, transparent);
    border-color: var(--sage);
    color: var(--sage);
    font-weight: 600;
}

.project-card-progress-compact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}

.project-progress-bar {
    height: 4px;
    width: 120px;
    background: var(--ivory-border);
    border-radius: 2px;
    overflow: hidden;
}

.project-progress-fill {
    height: 100%;
    background: var(--petrol);
    transition: width 0.5s ease;
    border-radius: 2px;
}

.project-progress-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.project-card-expand-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
    border-radius: var(--radius-sm);
    padding: 0;
    flex-shrink: 0;
}

.project-card-expand-btn:hover {
    background: var(--ivory-border);
    color: var(--petrol);
}

.project-card-expand-btn svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition);
}

.project-card.expanded .project-card-expand-btn svg { transform: rotate(180deg); }

.project-card-body {
    display: none;
    padding: 1.25rem 1.5rem;
    background: var(--ivory);
    border-top: 1px solid var(--ivory-border);
    animation: slideDown 0.22s ease-out;
}

.project-card.expanded .project-card-body { display: block; }

@keyframes slideDown {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.project-detail-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--ivory-border);
}

.project-detail-item { display: flex; flex-direction: column; }

.project-detail-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.project-detail-value {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

.project-detail-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--ivory-border);
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--ivory-border);
}

/* ===== BARRE DE PROGRESSION GÉNÉRIQUE ===== */
.progress-bar {
    height: 3px;
    background: var(--ivory-border);
    margin-bottom: 1.25rem;
}

.progress-fill {
    height: 100%;
    background: var(--petrol);
    transition: width 0.5s ease;
}

/* ===== SECTION REPLIABLE (Publication / financement) ===== */
details.collapsible-section {
    border: 1px solid var(--ivory-border);
    border-radius: var(--radius-sm);
    background: var(--ivory);
    margin-bottom: 1.25rem;
}

details.collapsible-section summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-mid);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    transition: color var(--transition);
}

details.collapsible-section summary::-webkit-details-marker { display: none; }

details.collapsible-section summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--stone-light);
    transition: transform var(--transition);
}

details.collapsible-section[open] summary::before { transform: rotate(180deg); }
details.collapsible-section summary:hover { color: var(--amber); }

details.collapsible-section .collapsible-body {
    padding: 1rem;
    border-top: 1px solid var(--ivory-border);
}

/* ===== MODALES ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(27, 48, 80, 0.58);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.18s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    max-width: 680px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--ivory-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--petrol);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    padding: 0;
}
.modal-close:hover { background: var(--ivory-border); color: var(--text); }

.modal-body { padding: 2rem; }

.modal-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--ivory-border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.625rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ===== RECHERCHE GLOBALE (topbar) ===== */
.topbar-search input {
    width: 200px;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    background: var(--ivory);
}

@media (max-width: 768px) {
    .topbar-search input { width: 120px; }
}

/* ===== PROJETS ÉPINGLÉS (tableau de bord) ===== */
.pinned-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.pinned-card {
    display: block;
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    text-decoration: none;
    transition: all var(--transition);
}

.pinned-card:hover {
    border-color: var(--petrol);
    box-shadow: 0 2px 8px rgba(27, 48, 80, 0.06);
}

.pinned-card-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--petrol);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

/* ===== FRISE DES ÉCHÉANCES ===== */
.timeline-header,
.timeline-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--ivory-border);
}

.timeline-header { border-bottom: 2px solid var(--ivory-border); }

.timeline-label-col {
    width: 260px;
    flex-shrink: 0;
    padding: 0.7rem 0.875rem;
    border-right: 1px solid var(--ivory-border);
    overflow: hidden;
}

.timeline-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-label.task {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-mid);
    padding-left: 0.875rem;
}

.timeline-sublabel {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.timeline-track {
    flex: 1;
    position: relative;
    display: flex;
    min-height: 42px;
}

.timeline-row.task-row { background: rgba(255,255,255,0.35); }
.timeline-row.task-row .timeline-track { min-height: 34px; }

.timeline-month {
    border-right: 1px solid var(--ivory-border);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-muted);
    text-align: center;
    padding-top: 0.5rem;
    text-transform: capitalize;
}

.timeline-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    background: var(--petrol);
}

.timeline-marker.project { width: 6px; }
.timeline-marker.task { width: 3px; background: var(--amber); opacity: 0.8; }
.timeline-marker.task.critical { background: var(--amber); opacity: 1; width: 4px; }
.timeline-marker.past { background: var(--brick) !important; opacity: 1; }

/* Date à droite de la marque, centrée verticalement (bascule à gauche près du bord droit) */
.timeline-date {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-mid);
    white-space: nowrap;
    pointer-events: none;
    background: rgba(250, 247, 241, 0.85);
    padding: 0 0.2rem;
}

.timeline-date.flip {
    margin-left: 0;
    transform: translate(calc(-100% - 8px), -50%);
}

/* ===== MINI-KANBAN (tâches de la fiche projet) ===== */
.kanban-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.kanban-col {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 0.875rem;
    border-radius: var(--radius-sm);
}

.kanban-col-title {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ivory-border);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-col .task-card { margin-bottom: 0.6rem; cursor: default; }
.kanban-col .task-card:last-child { margin-bottom: 0; }
.kanban-col .task-card.done .task-card-title {
    text-decoration: line-through;
    opacity: 0.6;
}

.kanban-empty {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--stone-light);
    text-align: center;
    padding: 1rem 0.5rem;
}

.task-status-select {
    padding: 0.2rem 1.5rem 0.2rem 0.4rem !important;
    font-size: 0.7rem !important;
    font-family: var(--font-mono) !important;
    background-color: var(--ivory) !important;
    background-position: right 0.25rem center !important;
}

/* ===== COMMENTAIRES DE TÂCHE ===== */
.comment {
    padding: 0.75rem 1rem;
    background: var(--ivory);
    border-left: 2px solid var(--ivory-border);
    margin-bottom: 0.6rem;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.comment-author { color: var(--text-mid); font-weight: 500; }

.comment-actions {
    margin-left: auto;
    display: flex;
    gap: 0.3rem;
}

.comment-body { font-size: 0.875rem; line-height: 1.55; color: var(--text); }
.comment-body p { margin-bottom: 0.35rem; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-body ul { margin: 0.25rem 0 0.35rem 1.1rem; }
.comment-body a { color: var(--amber); word-break: break-all; }

.comment-edit-form { display: none; margin-top: 0.5rem; }
.comment.editing .comment-edit-form { display: block; }
.comment.editing .comment-body { display: none; }

.format-hint {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--stone-light);
    margin-top: 0.35rem;
}

/* ===== RESPONSABLES EXTERNES (formulaire tâche) ===== */
.external-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}
.external-row input { flex: 1; }

@media (max-width: 900px) {
    .kanban-grid { grid-template-columns: 1fr; }
}

/* ===== TABLEAU (page Utilisateurs) ===== */
.data-table-wrapper {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    text-align: left;
    padding: 0.875rem 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--ivory-border);
    background: var(--ivory);
    font-weight: 500;
}

.data-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--ivory-border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fcf9f4; }

/* ===== PANNEAU MON COMPTE ===== */
.account-panel {
    background: var(--ivory-warm);
    border: 1px solid var(--ivory-border);
    padding: 1.75rem;
    margin-bottom: 2rem;
    max-width: 640px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar { width: 224px; }
    .main-wrapper { margin-left: 224px; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-columns { grid-template-columns: 1fr; }
    .filters-grid { grid-template-columns: repeat(2, 1fr); }
    .project-detail-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -252px;
        width: 252px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 101;
    }
    .sidebar.open { left: 0; }
    .main-wrapper { margin-left: 0; }
    .content-area { padding: 1.25rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0.875rem 1.25rem; }
    .topbar-title { font-size: 1.3rem; }
    .filters-grid { grid-template-columns: 1fr; }
    .sidebar-toggle {
        display: inline-flex;
        background: transparent;
        border: 1px solid var(--ivory-border);
        color: var(--text-mid);
        padding: 0.4rem 0.6rem;
    }
    .project-card-header { flex-direction: column; gap: 0.75rem; }
    .project-card-progress-compact { align-items: flex-start; width: 100%; }
    .project-progress-bar { width: 100%; }
    .project-detail-row { grid-template-columns: 1fr; }
    .project-actions { flex-wrap: wrap; }
    .login-box { padding: 2.25rem; }
}
