/* ── Variables ───────────────────────────────────────────────────────────────── */
:root {
  --primary:     #2563eb;
  --primary-d:   #1d4ed8;
  --success:     #16a34a;
  --danger:      #dc2626;
  --warning:     #d97706;
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 25px rgba(0,0,0,.12);
}

/* ── Reset & base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font: inherit; }

/* ── Navbar ──────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: #0f172a; color: #f8fafc;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.nav-brand {
  font-size: 1em; font-weight: 700; letter-spacing: -.3px;
  display: flex; align-items: center; gap: 8px;
  color: #f8fafc; white-space: nowrap;
}
.nav-links { list-style: none; display: flex; gap: 4px; margin-left: 16px; }
.nav-links a {
  display: block; padding: 6px 14px; border-radius: 6px;
  color: #cbd5e1; font-size: .9em; font-weight: 500; transition: background .15s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.12); color: #fff; text-decoration: none;
}
.nav-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── Container ───────────────────────────────────────────────────────────────── */
.container { max-width: 100%; padding: 16px 8px; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: .875em; font-weight: 600; cursor: pointer; transition: all .15s;
  text-decoration: none !important;
}
.btn-primary   { background: var(--primary);   color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-d); border-color: var(--primary-d); }
.btn-outline   { background: transparent; color: #cbd5e1; border-color: rgba(255,255,255,.25); }
.btn-outline:hover  { background: rgba(255,255,255,.1); }
.btn-soft      { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; }
.btn-soft:hover     { background: #dbeafe; }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover   { background: #b91c1c; }
.btn-sm        { padding: 5px 12px; font-size: .8em; }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover    { background: var(--bg); color: var(--text); }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 1em; font-weight: 700; color: var(--text); }
.card-body  { padding: 20px; }

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4em; font-weight: 800; color: var(--text); }
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Year nav ────────────────────────────────────────────────────────────────── */
.year-nav {
  display: flex; align-items: center; gap: 10px;
}
.year-nav .year-label {
  font-size: 1.1em; font-weight: 700; min-width: 60px; text-align: center;
}
.year-nav .btn-nav {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all .15s;
}
.year-nav .btn-nav:hover { background: var(--bg); border-color: var(--primary); }

/* ── Gantt chart ─────────────────────────────────────────────────────────────── */
.gantt-wrap { overflow-x: auto; scroll-behavior: smooth; }
.gantt      { min-width: max-content; }

/* En-tête collant (double ligne : mois + jours) */
.gantt-head      { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 2px solid var(--border); }
.gantt-head-row  { display: flex; align-items: stretch; }
.gantt-head-row + .gantt-head-row { border-top: 1px solid var(--border); }

.gantt-member-col {
  flex: 0 0 190px; min-width: 190px; padding: 8px 12px;
  font-size: .75em; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
  border-right: 2px solid var(--border);
  display: flex; align-items: center;
  position: sticky; left: 0; z-index: 12; background: var(--bg);
}
.small-caps { text-transform: uppercase; letter-spacing: .08em; }

/* Ligne des mois */
.gantt-months-row    { display: flex; flex-shrink: 0; }
.gantt-month-label {
  flex-shrink: 0; border-right: 1px solid var(--border); padding: 6px 4px;
  font-size: .75em; font-weight: 700; text-align: center;
  color: var(--text-muted); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-month-label.current { color: var(--primary); background: #eff6ff; }

/* Ligne des numéros de jours */
.gantt-days-hd-row { display: flex; flex-shrink: 0; }
.gantt-day-hd {
  width: var(--day-w, 22px); flex-shrink: 0;
  height: 24px; display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--text-muted);
  border-right: 1px solid rgba(226,232,240,.5);
}
.gantt-day-hd.we  { background: rgba(0,0,0,.03); }
.gantt-day-hd.hol { background: #FFF5F5; color: var(--danger); }
.gantt-day-hd.tod { background: #EBF8FF; color: var(--primary); font-weight: 700; }
.wk-num  { font-size: 8px; font-weight: 700; color: var(--primary);     line-height: 1; }
.day-num { font-size: 9px; font-weight: 400; color: var(--text-muted); line-height: 1; }
.gantt-day-hd.we  .day-num { color: #94a3b8; }
.gantt-day-hd.hol .day-num { color: var(--danger); font-weight: 600; }

/* Lignes membres */
.gantt-row {
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--border);
}
.gantt-row:last-child { border-bottom: none; }

.gantt-member {
  flex: 0 0 190px; min-width: 190px;
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  padding: 8px 10px; border-right: 2px solid var(--border);
  position: sticky; left: 0; z-index: 10; background: var(--surface);
}
.drag-handle {
  flex-shrink: 0; cursor: grab; color: var(--text-muted);
  font-size: 16px; opacity: 0.3; user-select: none;
  line-height: 1; transition: opacity .15s; padding: 2px 1px;
}
.drag-handle:hover { opacity: 0.75; }
body.row-reordering { cursor: grabbing !important; }
body.row-reordering .drag-handle { cursor: grabbing; }
.row-dragging { opacity: 0.3; }
#row-drop-line {
  position: fixed; height: 3px; background: var(--primary);
  z-index: 9999; pointer-events: none; left: 0; right: 0; display: none;
  border-radius: 2px;
}
.gantt-member-inner {
  display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0;
}
.gantt-member-name {
  font-weight: 700; font-size: .9em; display: flex; align-items: center; gap: 6px;
}
.gantt-member-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.gantt-member-btns { display: flex; gap: 4px; }
.gantt-member-btns button {
  font-size: .7em; padding: 2px 7px; border-radius: 4px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; color: var(--text-muted); transition: all .15s;
}
.gantt-member-btns button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.ical-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .7em; padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.ical-btn:hover { background: #0ea5e9; color: #fff; border-color: #0ea5e9; }

/* Popover iCal */
.ical-pop {
  position: absolute; z-index: 3000; width: 300px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.ical-pop-title { font-weight: 700; font-size: .9em; }
.ical-pop-row   { display: flex; gap: 6px; }
.ical-pop-url   {
  flex: 1; font-size: .72em; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); outline: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ical-pop-copy {
  flex-shrink: 0; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; color: var(--text-muted); transition: all .15s;
  display: flex; align-items: center;
}
.ical-pop-copy:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.ical-pop-hint  { font-size: .72em; color: var(--text-muted); }
.ical-pop-webcal {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8em; padding: 6px 10px; border-radius: 6px;
  background: #0ea5e9; color: #fff; text-decoration: none;
  font-weight: 600; transition: background .15s; justify-content: center;
}
.ical-pop-webcal:hover { background: #0284c7; text-decoration: none; }

/* Piste */
.gantt-track { flex: 1; position: relative; overflow: hidden; }

/* Fond cellules jour (grille visuelle + zones cliquables) */
.gantt-bg-cells {
  position: absolute; top: 0; left: 0; bottom: 0;
  display: flex; z-index: 0;
}
.gantt-day-cell {
  width: var(--day-w, 22px); flex-shrink: 0; height: 100%;
  border-right: 1px solid rgba(226,232,240,.45);
  cursor: crosshair; transition: background .1s;
}
.gantt-day-cell.we  { background: rgba(0,0,0,.03); }
.gantt-day-cell.hol { background: #FFF5F5; }
.gantt-day-cell.tod { background: #EBF8FF; }
.gantt-day-cell:not(.we):not(.hol):hover { background: rgba(37,99,235,.07); }

/* Barres */
.gantt-bar {
  position: absolute; border-radius: 4px;
  display: flex; flex-direction: column; justify-content: center;
  padding: 3px 7px;
  font-size: .72em; color: #fff;
  cursor: pointer; overflow: hidden;
  transition: filter .15s, transform .1s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); z-index: 2;
}
.gantt-bar:hover { filter: brightness(1.12); transform: scaleY(1.06); z-index: 5; }
.gantt-bar.project { min-height: 36px; }
.bar-name { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.bar-desc { display: block; font-style: italic; font-weight: 400; font-size: .78em; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; margin-top: 1px; }
.gantt-bar.absence {
  height: 18px;
  background: repeating-linear-gradient(
    45deg, rgba(0,0,0,.15) 0, rgba(0,0,0,.15) 3px, transparent 3px, transparent 8px
  ) !important;
  color: rgba(255,255,255,.9); font-size: .68em;
}

/* Status badges */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 99px; font-size: .75em; font-weight: 600;
}
.badge-planifie  { background: #eff6ff; color: #2563eb; }
.badge-en_cours  { background: #f0fdf4; color: #15803d; }
.badge-termine   { background: #f1f5f9; color: #475569; }
.badge-suspendu  { background: #fff7ed; color: #c2410c; }

/* ── Rapports list ───────────────────────────────────────────────────────────── */
.report-list { display: grid; gap: 12px; }
.report-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: box-shadow .15s;
}
.report-item:hover { box-shadow: var(--shadow-md); }
.report-date {
  flex: 0 0 120px; font-size: .8em; color: var(--text-muted);
}
.report-date strong { display: block; font-size: 1.1em; color: var(--text); }
.report-title { flex: 1; font-weight: 600; }
.report-meta  { font-size: .8em; color: var(--text-muted); }
.report-arrow { color: var(--text-muted); }

/* ── Recherche rapide ────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative; display: flex; align-items: center;
  margin-bottom: 12px; max-width: 420px;
}
.search-icon {
  position: absolute; left: 11px; width: 16px; height: 16px;
  color: var(--text-muted); pointer-events: none; flex-shrink: 0;
}
#project-search {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: .9em; background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
#project-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.search-count {
  position: absolute; right: 10px;
  font-size: .78em; color: var(--text-muted); pointer-events: none;
}
.gantt-bar.project.search-hidden  { opacity: .08; pointer-events: none; }
.gantt-bar.project.search-match   { outline: 2px solid rgba(255,255,255,.5); outline-offset: 1px; z-index: 6; }
.gantt-bar.project.search-current { outline: 3px solid #fff; outline-offset: 2px; z-index: 7;
  box-shadow: 0 0 0 5px rgba(37,99,235,.35), 0 4px 12px rgba(0,0,0,.3); }

/* ── Report detail ───────────────────────────────────────────────────────────── */
.rapport-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.rapport-meta {
  padding: 12px 20px; background: var(--bg);
  border-radius: var(--radius); font-size: .875em; color: var(--text-muted);
}
.rapport-meta strong { color: var(--text); }

.membre-section {
  margin-bottom: 20px; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.membre-section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--bg);
  font-weight: 700; border-bottom: 1px solid var(--border);
}
.membre-section-body { padding: 16px; display: grid; gap: 12px; }
.membre-field-label {
  font-size: .78em; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: 4px;
}
.membre-field-content {
  white-space: pre-wrap; font-size: .9em; line-height: 1.5;
  color: var(--text);
}
.membre-field-empty { color: var(--text-muted); font-style: italic; font-size: .9em; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .85em; font-weight: 600; color: var(--text-muted); }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type="text"], input[type="date"], input[type="email"],
select, textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 80px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; transition: all .15s;
  font-size: .875em;
}
.checkbox-item:hover { border-color: var(--primary); background: #eff6ff; }
.checkbox-item input[type="checkbox"] { accent-color: var(--primary); }
.user-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ── Form page layout ────────────────────────────────────────────────────────── */
.form-card { background: var(--surface); border: 1px solid var(--border);
             border-radius: var(--radius); box-shadow: var(--shadow); }
.form-card > .section {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.form-card > .section:last-child { border-bottom: none; }
.section-title {
  font-size: .85em; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: 14px;
}

/* ── Calendar (vue mensuelle) ────────────────────────────────────────────────── */
.cal-wrap   { overflow-x: auto; }
.cal-table  { min-width: 600px; }

.cal-head {
  display: flex; position: sticky; top: 56px; z-index: 20;
  background: var(--bg); border-bottom: 2px solid var(--border);
}
.cal-member-col {
  flex: 0 0 150px; padding: 8px 12px; border-right: 2px solid var(--border);
  font-size: .72em; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
  display: flex; align-items: flex-end;
}
.cal-days-header { display: flex; }
.cal-day-head {
  width: 36px; flex-shrink: 0; text-align: center;
  padding: 5px 2px; border-right: 1px solid var(--border);
}
.cal-day-head.weekend { background: #f8f9fb; }
.cal-dow { display: block; font-size: .65em; color: var(--text-muted); line-height: 1.2; }
.cal-dom {
  display: block; font-size: .78em; font-weight: 700; color: var(--text);
  line-height: 1.4;
}
.cal-dom.is-today {
  background: #ef4444; color: #fff; border-radius: 50%;
  width: 20px; height: 20px; line-height: 20px;
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
}

.cal-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.cal-row:last-child { border-bottom: none; }
.cal-row:hover { background: #f8faff; }

.cal-member {
  grid-column: 1;
  border-right: 2px solid var(--border);
  padding: 12px 12px;
  display: flex; flex-direction: column;
  justify-content: center; gap: 6px;
  min-height: 68px;
}
.cal-member-name {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: .9em;
}
.cal-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cal-member-btns { display: flex; gap: 4px; }
.cal-member-btns button {
  font-size: .7em; padding: 2px 7px; border-radius: 4px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; color: var(--text-muted); transition: all .15s;
}
.cal-member-btns button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.cal-track {
  grid-column: 2;
  position: relative; overflow: hidden;
  cursor: crosshair;
}

/* Background day cells */
.cal-bg-cell {
  position: absolute; top: 0; bottom: 0; width: 36px;
  border-right: 1px solid var(--border); z-index: 0;
  pointer-events: none;
}
.cal-bg-cell.weekend   { background: rgba(0,0,0,.018); }
.cal-bg-cell.today-cell { background: rgba(239,68,68,.06);
                           border-right-color: rgba(239,68,68,.25); }
.cal-bg-cell.selecting { background: rgba(37,99,235,.1) !important; }

/* Bars */
.cal-bar {
  position: absolute; height: 22px; border-radius: 4px;
  color: #fff; font-size: .72em; font-weight: 600;
  padding: 0 7px; display: flex; align-items: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: filter .12s, transform .1s;
}
.cal-bar:hover { filter: brightness(1.1); transform: scaleY(1.05); z-index: 5; }

.project-bar { /* handled by inline style */ }

.absence-bar {
  height: 18px; font-size: .68em;
  background-image: repeating-linear-gradient(
    45deg, rgba(0,0,0,.18) 0, rgba(0,0,0,.18) 3px, transparent 3px, transparent 8px
  ) !important;
}

/* ── Modals ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px; backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}
.modal-overlay[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; animation: slideUp .18s ease;
}
.modal-sm { max-width: 420px; }
@keyframes slideUp { from { transform: translateY(12px); opacity: .5 } to { transform: none; opacity: 1 } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1em; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--bg); cursor: pointer; font-size: 1em;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: background .15s;
}
.modal-close:hover { background: #fee2e2; color: var(--danger); }

form#form-projet, form#form-absence {
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding-top: 4px;
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px; border-radius: var(--radius); font-size: .875em;
  font-weight: 600; color: #fff; box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(8px); transition: all .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ── Legends ─────────────────────────────────────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8em; }
.legend-item { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.legend-box  { width: 14px; height: 10px; border-radius: 3px; }
.legend-absence {
  width: 14px; height: 10px; border-radius: 3px;
  background: repeating-linear-gradient(
    45deg, #94a3b8 0px, #94a3b8 3px, #cbd5e1 3px, #cbd5e1 8px
  );
}
/* Swatches couleur pour la légende jour */
.legend-swatch { display: inline-block; width: 14px; height: 10px; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); }
.legend-swatch.we  { background: rgba(0,0,0,.07); }
.legend-swatch.hol { background: #FFF5F5; border: 1px solid #fecaca; }
.legend-swatch.tod { background: #EBF8FF; border: 1px solid #bae6fd; }

/* ── Drag-to-select date range ───────────────────────────────────────────────── */
.gantt-track { user-select: none; }

.drag-hl {
  position: absolute; top: 3px; bottom: 3px;
  background: rgba(37,99,235,.14);
  border: 2px solid rgba(37,99,235,.4);
  border-radius: 5px; pointer-events: none; z-index: 4;
  transition: width .04s linear;
}

body.gantt-dragging          { cursor: col-resize !important; }
body.gantt-dragging *        { cursor: col-resize !important; user-select: none; }
body.gantt-dragging .gantt-bar { cursor: col-resize !important; }

/* ── Menu contextuel jour ────────────────────────────────────────────────────── */
.day-ctx-menu {
  position: fixed; z-index: 2000;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 4px; min-width: 210px;
  animation: fadeIn .1s ease;
}
.day-ctx-date {
  font-size: .75em; color: var(--text-muted); font-weight: 600;
  padding: 6px 10px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
  text-transform: capitalize;
}
.day-ctx-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; border: none; background: none;
  cursor: pointer; border-radius: 6px; font-size: .875em;
  color: var(--text); text-align: left; transition: background .1s;
}
.day-ctx-btn:hover { background: var(--bg); }
.day-ctx-btn span { font-size: 1em; }

/* ── Schedule-X container ────────────────────────────────────────────────────── */
#sx-calendar { --sx-color-primary: var(--primary); }
#sx-section  { }
.sx-section .card { border-radius: var(--radius); }

/* ── Misc ────────────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted); font-size: .95em;
}
.empty-state .icon { font-size: 2.5em; margin-bottom: 12px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Planning toolbar ────────────────────────────────────────────────────────── */
.page-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-label-tl { font-size: 1.05em; font-weight: 800; min-width: 140px; text-align: center; }
.toolbar-center { display: flex; align-items: center; gap: 6px; }
.year-chip { font-size: .9em; font-weight: 700; padding: 3px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; }
.toolbar-right  { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.toolbar-hint { font-size: .8em; color: var(--text-muted); }

/* ── vis.js Timeline overrides ───────────────────────────────────────────────── */
.vis-timeline { border: none !important; font-family: inherit !important; font-size: .875rem !important; }
.vis-time-axis .vis-text { font-size: .78em !important; color: var(--text-muted) !important; }
.vis-time-axis .vis-text.vis-major { font-weight: 700 !important; color: var(--text) !important; font-size: .82em !important; }
.vis-panel.vis-left { border-right: 2px solid var(--border) !important; }
.vis-label { background: var(--surface) !important; border-bottom: 1px solid var(--border) !important; }
.vis-label .vis-inner { padding: 0 !important; }
.vis-foreground .vis-group { border-bottom: 1px solid var(--border) !important; }
.vis-current-time { background: #ef4444 !important; width: 2px !important; }
.vis-panel.vis-bottom, .vis-panel.vis-top { border-color: var(--border) !important; }

/* ── FullCalendar overrides ───────────────────────────────────────────────── */
#fc-calendar { font-family: inherit; }

/* Entête des jours */
.fc .fc-col-header-cell-cushion { font-size: .75em; font-weight: 600; text-decoration: none; color: var(--text); }
.fc .fc-col-header-cell { border-color: var(--border); }

/* Lignes ressources */
.fc .fc-resource-timeline-divider { width: 3px; background: var(--border); }
.fc .fc-datagrid-cell-cushion { font-weight: 700; font-size: .88em; color: var(--text); }

/* Weekends et jours fériés */
.fc .fc-day-we  { background: rgba(0,0,0,.03); }
.fc .fc-day-ferie { background: rgba(239,68,68,.08); }

/* Événements */
.fc .fc-event { border-radius: 5px; font-size: .78em; font-weight: 600; cursor: pointer; }
.fc .fc-event:hover { filter: brightness(1.08); }
.fc .fc-event-main { padding: 2px 6px; }

/* Label ressource (nom + point couleur) */
.fc-res-label { display: flex; align-items: center; gap: 7px; }
.fc-res-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Bordures */
.fc .fc-scrollgrid { border-color: var(--border); }
.fc .fc-scrollgrid td, .fc .fc-scrollgrid th { border-color: var(--border); }
.fc .fc-timeline-slot-frame { border-color: var(--border); }

/* Hauteur ligne ressource */
.fc .fc-resource-timeline .fc-datagrid-cell { height: 46px; }
.fc .fc-timeline-lane { min-height: 46px; }

/* Groupes (noms à gauche) */
.grp-lbl { display: flex; align-items: center; gap: 7px; padding: 8px 14px; white-space: nowrap; }
.grp-dot  { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.grp-name { font-weight: 700; font-size: .9em; color: var(--text); }

/* Items */
.vis-item { border-radius: 5px !important; font-size: .78em !important; font-weight: 600 !important; }
.vis-item.vis-range { border-width: 2px !important; }
.vis-item .vis-item-content { padding: 2px 7px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; color: #fff; }
.vis-item.vis-absence .vis-item-content { color: #1e293b !important; }
.vis-item.vis-selected { filter: brightness(1.1) !important; box-shadow: 0 0 0 2px rgba(0,0,0,.3) !important; }
.vis-item:hover { filter: brightness(1.08) !important; }

/* Weekends et jours fériés */
.vis-item.vis-background.vis-we     { background: rgba(0,0,0,.035) !important; border: none !important; border-radius: 0 !important; }
.vis-item.vis-background.vis-ferie  { background: rgba(239,68,68,.10) !important; border: none !important; border-radius: 0 !important; }
/* S'assurer que les items range ont un border-radius, pas les backgrounds */
.vis-item.vis-range { border-radius: 5px !important; }
.vis-item.vis-background { border-radius: 0 !important; box-shadow: none !important; }

/* Tooltip */
.vis-tooltip { background: var(--text) !important; color: #f8fafc !important; border: none !important; border-radius: 6px !important; font-size: .82em !important; padding: 8px 12px !important; box-shadow: var(--shadow-lg) !important; line-height: 1.6 !important; }

/* ── Responsive mobile ───────────────────────────────────────────────────────── */

/* Burger button — caché sur desktop */
.nav-burger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; padding: 6px;
  background: transparent; border: none; cursor: pointer; margin-left: auto;
}
.nav-burger span {
  display: block; height: 2px; background: #f8fafc;
  border-radius: 2px; transition: transform .2s, opacity .2s;
}

@media (max-width: 768px) {

  /* ── Navbar ── */
  .navbar {
    flex-wrap: wrap; height: auto; padding: 0 12px;
    row-gap: 0;
  }
  .nav-brand { height: 52px; flex: 1; }
  .nav-brand-text { display: none; }
  .nav-burger { display: flex; }

  .nav-links, .nav-actions {
    display: none; width: 100%;
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .navbar.open .nav-links  { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; margin-left: 0; }
  .navbar.open .nav-actions { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 12px; }
  .navbar.open .nav-links a { padding: 10px 12px; }
  .navbar.open .nav-actions .btn { width: 100%; justify-content: center; }

  /* ── Container ── */
  .container { padding: 10px 8px; }

  /* ── Page header ── */
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
  .page-header-actions { flex-wrap: wrap; }

  /* ── Légende ── */
  .legend { flex-wrap: wrap; gap: 6px 12px; margin-bottom: 10px !important; }

  /* ── Recherche ── */
  .search-wrap { margin-bottom: 10px; }

  /* ── Gantt : colonne membre réduite ── */
  .gantt-member-col,
  .gantt-member { flex: 0 0 110px !important; min-width: 110px !important; }
  .gantt-member-btns { display: none; }
  .gantt-member-name { font-size: .8em; }
  .gantt-member-dot  { width: 8px; height: 8px; }
  .drag-handle { display: none; }

  /* ── Modales plein écran ── */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100% !important; width: 100% !important;
    max-height: 92dvh; border-radius: 16px 16px 0 0 !important;
  }
  form#form-projet, form#form-absence { padding: 14px; }

  /* ── Formulaires ── */
  .form-row { grid-template-columns: 1fr; }

  /* ── Cards ── */
  .card-body { padding: 12px; }

  /* ── Rapport ── */
  .rapport-header { flex-direction: column; gap: 8px; }
  .rapport-header > div:last-child { flex-wrap: wrap; }
  .membre-section-body,
  .membre-section-body[style] { grid-template-columns: 1fr !important; display: grid !important; }
  .membre-section-body [style*="grid-column"] { grid-column: auto !important; }

  /* ── Rapports list ── */
  .rapports-table { font-size: .85em; }
  .rapports-table th:nth-child(3),
  .rapports-table td:nth-child(3) { display: none; }

  /* ── Année nav ── */
  .year-nav .year-label { font-size: 1em; }
}

/* ── Print / PDF export ──────────────────────────────────────────────────────── */
@media print {
  .no-print, .navbar, .nav-actions, .page-header-actions,
  .search-wrap, .legend, .gantt-wrap { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .container { max-width: 100%; padding: 0; }

  .rapport-header { margin-bottom: 12px; }
  .rapport-header h1 { font-size: 16pt; }

  .rapport-meta {
    background: #f5f5f5; border: 1px solid #ddd;
    padding: 8px 14px; font-size: 9pt; margin-bottom: 14px;
  }

  .card { box-shadow: none; border: 1px solid #ddd; margin-bottom: 14px; break-inside: avoid; }
  .card-header { background: #f5f5f5; }

  .membre-section { break-inside: avoid; border: 1px solid #ccc; margin-bottom: 12px; }
  .membre-section-header { background: #f0f0f0; padding: 8px 14px; }

  .membre-field-label { color: #555; }
  .membre-field-content { font-size: 10pt; }

  a { color: #000; text-decoration: none; }

  @page {
    margin: 15mm 12mm;
    size: A4 portrait;
  }
}

/* ── Tooltip projet ───────────────────────────────────────────────────────────── */
#gantt-tip {
  position: fixed; z-index: 500; pointer-events: none;
  background: #1e293b; color: #f8fafc;
  border-radius: 8px; padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  max-width: 280px; min-width: 160px;
  font-size: .82em; line-height: 1.45;
  opacity: 0; transition: opacity .12s ease;
}
#gantt-tip.visible { opacity: 1; }
#gantt-tip .tip-name { font-weight: 700; font-size: 1em; margin-bottom: 3px; }
#gantt-tip .tip-desc { color: #94a3b8; font-style: italic; margin-bottom: 6px; }
#gantt-tip .tip-dates { font-size: .88em; color: #64748b; border-top: 1px solid #334155; padding-top: 6px; margin-top: 2px; }
