/* ===== Planning Chantier — style ===== */
:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --ok: #16a34a;
    --warn-bg: #fef2f2;
    --warn-line: #fecaca;
    --radius: 10px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Navbar --- */
.navbar {
    display: flex; align-items: center; justify-content: space-between;
    background: #111827; color: #f9fafb;
    padding: 0.6rem 1.2rem; flex-wrap: wrap; gap: 0.5rem;
}
.navbar .brand { color: #fff; font-weight: 700; font-size: 1.1rem; }
.navbar .brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav-links a { color: #d1d5db; }
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: #e5e7eb; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.badge-admin { font-style: normal; font-size: 0.7rem; background: #374151; border-radius: 4px; padding: 0 5px; }

/* --- Layout --- */
.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }
.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 2rem 0 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.8rem; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.hidden { display: none !important; }
.inline { display: inline; margin: 0; }

/* --- Cartes & tableaux --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table .actions { white-space: nowrap; text-align: right; }
.row-inactive { opacity: 0.55; }

/* --- Formulaires --- */
.form label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.7rem; }
.form input[type="text"], .form input[type="email"], .form input[type="password"],
.form input[type="date"], .form select, .form textarea {
    display: block; width: 100%; margin-top: 0.25rem; padding: 0.45rem 0.6rem;
    border: 1px solid var(--line); border-radius: 7px; font-size: 0.95rem; font-family: inherit;
    background: #fff; color: var(--ink);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.6rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 0.8rem; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.3rem; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.4rem; }
.checkbox-item { display: flex !important; align-items: center; gap: 0.4rem; font-weight: 400 !important; margin: 0 !important; }

/* --- Boutons --- */
.btn {
    display: inline-block; border: 1px solid transparent; border-radius: 7px;
    padding: 0.45rem 0.9rem; font-size: 0.9rem; cursor: pointer; font-family: inherit;
    background: #e5e7eb; color: var(--ink);
}
.btn:hover { text-decoration: none; filter: brightness(0.95); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.navbar .btn-ghost { color: #d1d5db; border-color: #374151; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.82rem; }
.btn-xs { padding: 0.1rem 0.45rem; font-size: 0.78rem; }
.btn-block { width: 100%; }
.select-xs { font-size: 0.75rem; padding: 0.1rem 0.2rem; border: 1px solid var(--line); border-radius: 5px; }

/* --- Badges --- */
.badge { display: inline-block; border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.75rem; font-weight: 600; background: #e5e7eb; }
.badge-en_preparation, .badge-a_faire { background: #e0e7ff; color: #3730a3; }
.badge-en_cours, .badge-en_cours { background: #dbeafe; color: #1e40af; }
.badge-suspendu, .badge-bloquee { background: #fef3c7; color: #92400e; }
.badge-termine, .badge-terminee { background: #dcfce7; color: #166534; }
.badge-conflict { background: var(--warn-line); color: var(--danger); }
.badge-delai { background: #ffedd5; color: #9a3412; }
.badge-conge { background: #f3f4f6; color: #4b5563; }
.bar-delai {
    background: repeating-linear-gradient(45deg, #fdba74, #fdba74 6px, #fed7aa 6px, #fed7aa 12px);
    border: 1px dashed #ea580c;
}
.bar-conge {
    background: repeating-linear-gradient(45deg, #d1d5db, #d1d5db 6px, #e5e7eb 6px, #e5e7eb 12px);
    border: 1px dashed #6b7280;
}

/* --- Flash & alertes --- */
.flash { border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 1rem; font-size: 0.92rem; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: var(--warn-bg); color: var(--danger); border: 1px solid var(--warn-line); }
.alert-box { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 0.8rem 1.2rem; margin-bottom: 1.2rem; }
.alert-box h2 { color: var(--danger); font-size: 1rem; }
.alert-box ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.ok-box { background: #dcfce7; border: 1px solid #bbf7d0; color: #166534; border-radius: var(--radius); padding: 0.6rem 1rem; margin-bottom: 1.2rem; }

/* --- Login --- */
.login-card { max-width: 380px; margin: 4rem auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.6rem 1.8rem; }
.login-card h1 { font-size: 1.3rem; }

/* --- Timeline du planning --- */
.timeline { display: flex; flex-direction: column; gap: 0.35rem; }
.timeline-ruler { position: relative; height: 1.1rem; margin-left: 240px; border-bottom: 1px solid var(--line); font-size: 0.7rem; color: var(--muted); }
.timeline-ruler span { position: absolute; transform: translateX(-50%); top: 0; }
.timeline-row { display: grid; grid-template-columns: 240px 1fr 150px; gap: 0.6rem; align-items: center; padding: 0.25rem 0; border-radius: 6px; }
.timeline-row:hover { background: #f9fafb; }
.row-conflict { background: #fff7f7; }
.timeline-label { display: flex; flex-direction: column; font-size: 0.85rem; }
.timeline-track { position: relative; height: 26px; background: #f3f4f6; border-radius: 6px; }
.bar { position: absolute; top: 4px; height: 18px; border-radius: 5px; min-width: 8px; }
.bar-a_faire { background: #c7d2fe; }
.bar-en_cours { background: #60a5fa; }
.bar-bloquee { background: #fbbf24; }
.bar-terminee { background: #86efac; }
.bar-conflict { background: #f87171 !important; box-shadow: 0 0 0 2px #dc2626; color: #fff; font-size: 0.75rem; text-align: center; line-height: 18px; }
.timeline-actions { display: flex; gap: 0.25rem; align-items: center; }
.timeline-conflict { margin: -0.2rem 0 0.4rem 240px; color: var(--danger); font-size: 0.8rem; }
.chip { display: inline-flex; align-items: center; gap: 0.2rem; border: 1px solid; border-radius: 999px; padding: 0 0.45rem; font-size: 0.72rem; margin: 0.1rem 0.15rem 0.1rem 0; }
.chip-x { border: none; background: none; cursor: pointer; color: inherit; font-size: 0.85rem; padding: 0; line-height: 1; }
.contraintes-list { margin: 0; padding-left: 1.2rem; }
.contraintes-list li { margin-bottom: 0.3rem; }
.contraintes-list .inactive { color: var(--muted); }

@media (max-width: 800px) {
    .timeline-ruler, .timeline-conflict { margin-left: 0; }
    .timeline-row { grid-template-columns: 1fr; }
}
