:root {
  --paper: #F7F6F3;
  --surface: #FFFFFF;
  --ink: #1B2330;
  --ink-soft: #5A6473;
  --line: #E7E4DD;
  --line-soft: #F0EEE8;
  --accent: #EC5E4F;
  --accent-dark: #D44A3C;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27,35,48,.04), 0 4px 16px rgba(27,35,48,.05);

  --s-a_contacter: #8A93A3;
  --s-contacte: #3B82C4;
  --s-en_discussion: #E0A23B;
  --s-partenaire: #3FA66A;
  --s-refuse: #C25B5B;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.wordmark {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800; font-size: 20px; letter-spacing: -.02em;
  text-decoration: none; color: var(--ink); line-height: 1;
}
.wordmark span { color: var(--accent); margin-left: 5px; font-weight: 700; }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--ink-soft);
  padding: 7px 13px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.nav a:hover { background: var(--line-soft); color: var(--ink); }
.nav a.is-active { background: var(--ink); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.whoami { font-size: 13px; color: var(--ink-soft); font-weight: 600; }

/* ---------- main ---------- */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.page-head h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 0;
}
.page-head .sub { color: var(--ink-soft); font-size: 14px; }
.spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--accent); color: #fff; border: none;
  padding: 9px 16px; border-radius: 9px; font-weight: 700; font-size: 14px;
  font-family: inherit;
}
.btn:hover { background: var(--accent-dark); }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--ink-soft);
  padding: 7px 13px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-danger { color: var(--s-refuse); border-color: transparent; }
.btn-danger:hover { background: #fbecec; border-color: transparent; }

/* ---------- kanban ---------- */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.col {
  flex: 0 0 280px; background: var(--line-soft);
  border-radius: 12px; padding: 10px; min-height: 120px;
}
.col.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; }
.col-dot { width: 9px; height: 9px; border-radius: 50%; }
.col-title { font-weight: 700; font-size: 13px; }
.col-count { margin-left: auto; font-size: 12px; color: var(--ink-soft); background: var(--surface); padding: 1px 8px; border-radius: 20px; }

.card {
  display: block; background: var(--surface); border-radius: var(--radius);
  padding: 12px 13px; margin-bottom: 9px; box-shadow: var(--shadow);
  border-left: 3px solid var(--line); text-decoration: none; color: inherit; cursor: grab;
}
.card:hover { box-shadow: 0 2px 4px rgba(27,35,48,.06), 0 8px 22px rgba(27,35,48,.08); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .4; }
.card-name { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.card-meta { font-size: 12.5px; color: var(--ink-soft); }
.card-offer { font-size: 12.5px; color: var(--ink); margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line-soft); }
.card-owner { display: inline-block; margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--accent); }

/* stage left borders */
.card[data-stage="a_contacter"]   { border-left-color: var(--s-a_contacter); }
.card[data-stage="contacte"]      { border-left-color: var(--s-contacte); }
.card[data-stage="en_discussion"] { border-left-color: var(--s-en_discussion); }
.card[data-stage="partenaire"]    { border-left-color: var(--s-partenaire); }
.card[data-stage="refuse"]        { border-left-color: var(--s-refuse); }

/* ---------- forms ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(236,94,79,.12);
}
.field textarea { resize: vertical; min-height: 70px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

/* ---------- dialog ---------- */
dialog { border: none; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(27,35,48,.25); max-width: 520px; width: 92%; }
dialog::backdrop { background: rgba(27,35,48,.4); }
.dialog-inner { padding: 24px; }
.dialog-inner h2 { font-family: "Bricolage Grotesque", sans-serif; margin: 0 0 18px; font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- detail page ---------- */
.detail { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.panel h3 { font-family: "Bricolage Grotesque", sans-serif; margin: 0 0 16px; font-size: 16px; }
.back { color: var(--ink-soft); text-decoration: none; font-size: 13px; font-weight: 600; }
.back:hover { color: var(--ink); }
.activity { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.activity:last-child { border-bottom: none; }
.activity-meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 3px; }
.empty { color: var(--ink-soft); font-size: 14px; padding: 8px 0; }

/* ---------- tasks ---------- */
.tasks { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.task { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.task:last-child { border-bottom: none; }
.task.done .task-title { text-decoration: line-through; color: var(--ink-soft); }
.task-check { width: 20px; height: 20px; flex: 0 0 auto; cursor: pointer; accent-color: var(--accent); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14.5px; }
.task-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: var(--line-soft); color: var(--ink-soft); }
.badge.doing { background: #fdf2e1; color: var(--s-en_discussion); }
.pill-due { font-size: 12px; color: var(--ink-soft); }
.pill-due.late { color: var(--s-refuse); font-weight: 700; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--paper); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 34px; width: 360px; box-shadow: var(--shadow); }
.login-card .wordmark { font-size: 24px; display: block; margin-bottom: 6px; }
.login-card p { color: var(--ink-soft); font-size: 13px; margin: 0 0 22px; }
.login-error { background: #fbecec; color: var(--s-refuse); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; font-weight: 600; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- KPIs (bandeau pipeline + budget) ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi-val { display: block; font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 26px; letter-spacing: -.02em; }
.kpi-val.accent { color: var(--accent); }
.kpi-val small { font-size: 16px; font-weight: 700; }
.kpi-lbl { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; font-weight: 600; }
.kpi-lbl em { font-style: normal; font-weight: 600; color: var(--ink-soft); opacity: .8; }

/* ---------- tracking ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat-val { display: block; font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 24px; letter-spacing: -.02em; }
.stat-val.accent { color: var(--accent); }
.stat-lbl { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; font-weight: 600; }

.track-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; align-items: start; }
.dist-row { display: grid; grid-template-columns: 130px 1fr 34px; align-items: center; gap: 10px; margin-bottom: 10px; }
.dist-lbl { font-size: 13px; color: var(--ink-soft); }
.dist-bar { background: var(--line-soft); border-radius: 20px; height: 9px; overflow: hidden; }
.dist-bar span { display: block; height: 100%; background: var(--accent); border-radius: 20px; min-width: 2px; }
.dist-num { font-size: 13px; font-weight: 700; text-align: right; }
.track-foot { color: var(--ink-soft); font-size: 12px; margin-top: 18px; }

/* notice (à configurer / erreur) */
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; padding: 20px 22px; max-width: 640px; box-shadow: var(--shadow); }
.notice.error { border-left-color: var(--s-refuse); }
.notice h3 { font-family: "Bricolage Grotesque", sans-serif; margin: 0 0 8px; font-size: 17px; }
.notice p { margin: 0 0 8px; font-size: 14px; }
.notice .notice-sub { color: var(--ink-soft); font-size: 13px; }
.notice code { background: var(--line-soft); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ---------- budget ---------- */
.budget-table { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.budget-row {
  display: grid; grid-template-columns: 1.6fr 1fr 1.1fr .9fr 1.6fr auto;
  gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft);
}
.budget-row:last-child { border-bottom: none; }
.budget-row.is-head { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; background: var(--line-soft); }
.budget-row input, .budget-row select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink); }
.budget-row input:focus, .budget-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(236,94,79,.12); }
.budget-row .amt { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); }
.budget-row .amt input { text-align: right; }
.budget-actions { display: flex; gap: 6px; justify-content: flex-end; }
.budget-row .empty { grid-column: 1 / -1; }

@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .budget-row { grid-template-columns: 1fr 1fr; }
  .budget-row.is-head { display: none; }
}
@media (max-width: 640px) {
  .detail { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .dist-row { grid-template-columns: 110px 1fr 30px; }
}
/* ---------- progress (lancement) ---------- */
.progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.progress-num { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.progress-pct { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 20px; color: var(--accent); }
.progress { background: var(--line-soft); height: 10px; border-radius: 6px; overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .25s ease; }

/* ---------- checklist (lancement) ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.lc-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.lc-item:last-child { border-bottom: none; }
.lc-main { display: flex; align-items: center; gap: 11px; flex: 1; cursor: pointer; }
.lc-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.lc-label { font-size: 14.5px; }
.lc-item.done .lc-label { text-decoration: line-through; color: var(--ink-soft); }
.lc-owner { font-size: 11px; font-weight: 700; color: var(--accent); background: #fdeeec; padding: 3px 9px; border-radius: 20px; flex-shrink: 0; }
.lc-owner-both { color: var(--ink-soft); background: var(--line-soft); }
.lc-del { background: none; border: none; color: var(--ink-soft); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .5; }
.lc-del:hover { color: var(--s-refuse); opacity: 1; }
.lc-item form { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
