:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1c2430;
  --muted: #6b7480;
  --accent: #2f6fed;
  --accent-ink: #1f53b8;
  --danger: #d33a2c;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

/* ── Barre supérieure ─────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .15);
}
h1 { font-size: 18px; margin: 0; font-weight: 650; }
.sub { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync { font-size: 12px; color: var(--muted); }

/* ── Boutons ──────────────────────────────────────── */
.btn {
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #eef1f5; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { color: var(--muted); }
.btn-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: #fdecea; }

/* ── Plateau kanban ───────────────────────────────── */
.board {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  align-items: flex-start;
  overflow-x: auto;
  min-height: calc(100vh - 62px);
}
.column {
  flex: 0 0 290px;
  background: #eef0f4;
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 110px);
}
.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 10px;
}
.col-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.col-count {
  font-size: 12px; color: var(--muted);
  background: rgba(0,0,0,.05); border-radius: 20px; padding: 1px 8px;
}
.col-body { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.col-body.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: 6px; }

/* ── Cartes ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 11px 12px;
  box-shadow: var(--shadow);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: box-shadow .15s, transform .1s;
}
.card:hover { box-shadow: 0 6px 18px rgba(16,24,40,.12); }
.card.dragging { opacity: .5; transform: rotate(1deg); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.card-name { font-weight: 650; font-size: 14.5px; }
.card-poste { font-size: 13px; color: var(--muted); }
.card-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.card:hover .card-actions { opacity: 1; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 15px; padding: 2px 5px; border-radius: 5px; line-height: 1;
}
.icon-btn:hover { background: #eef1f5; color: var(--text); }
.icon-btn.del:hover { color: var(--danger); background: #fdecea; }

.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
  font-size: 11px; padding: 2px 7px; border-radius: 20px;
  background: #eef1f5; color: #3b4654; white-space: nowrap;
}
.badge.acc { background: #e8f0fe; color: #1f53b8; }
.badge.mode { background: #f1e9fe; color: #6b3bb3; }
.badge.prio-h { background: #fdecea; color: #c0392b; }
.badge.prio-m { background: #fff4e0; color: #b26a00; }
.badge.prio-b { background: #eef1f5; color: #5a6570; }
.badge.res-ok { background: #e6f6ec; color: #1e7d43; }
.badge.res-ko { background: #fdecea; color: #c0392b; }

.card-dates { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 1px; }
.card-notes { font-size: 12px; color: #4a5563; white-space: pre-wrap; word-break: break-word; }
.card-link { font-size: 12px; color: var(--accent); text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* ── Modales ──────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 14px; padding: 22px;
  width: 100%; max-width: 420px; box-shadow: 0 24px 60px rgba(16,24,40,.28);
}
.modal-wide { max-width: 720px; }
.modal h2 { margin: 0 0 6px; font-size: 17px; }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: #3b4654; }
input, select, textarea {
  font: inherit; font-size: 14px; font-weight: 400;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,111,237,.15);
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid-dates { grid-template-columns: repeat(4, 1fr); }
.grid-dates input { min-width: 0; }
form > label { margin-bottom: 12px; }
textarea { resize: vertical; }

.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.spacer { flex: 1; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .grid, .grid-dates { grid-template-columns: 1fr; }
  .sub { display: none; }
}
