:root {
  --bg: #f6f5f1;
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e3e0d8;
  --card: #fffdf8;

  --actif: #2f6a44;
  --actif-bg: #e1efe4;
  --pause: #a07116;
  --pause-bg: #f5ead0;
  --idee: #5b4a8c;
  --idee-bg: #ebe6f6;
  --termine: #4d6d6c;
  --termine-bg: #dfe9e8;
  --abandonne: #8a8a8a;
  --abandonne-bg: #ebebeb;

  --danger: #b03030;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}

a { color: inherit; }

/* ---- LOGIN ---- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(380px, 100%);
  display: grid;
  gap: 0.9rem;
}
.login-card h1 { margin: 0; font-size: 1.4rem; }
.login-card .sub { margin: -0.4rem 0 0.4rem; color: var(--muted); font-size: 0.9rem; }
.login-card label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.login-card input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  background: #fff;
  font: inherit;
}
.login-card button {
  margin-top: 0.4rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.login-card button:hover { background: #000; }
.alert {
  background: #fde6e3;
  color: #8a1a1a;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
}

/* ---- HEADER ---- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.top h1 { margin: 0; font-size: 1.1rem; }
.top-left { display: flex; align-items: center; gap: 0.8rem; }
.top-right { display: flex; align-items: center; gap: 0.8rem; }
.link {
  background: none; border: none; padding: 0;
  font: inherit; color: var(--muted); cursor: pointer; text-decoration: none;
}
.link:hover { color: var(--ink); }
.inline { display: inline; margin: 0; }

.wip {
  background: var(--actif-bg);
  color: var(--actif);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.wip.wip-full { background: #f7d1cb; color: var(--danger); }

/* ---- QUICK ADD ---- */
.quick-add {
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.quick-add form {
  display: grid;
  grid-template-columns: 2fr 1.2fr auto auto;
  gap: 0.5rem;
}
.quick-add input, .quick-add select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font: inherit;
}
.quick-add button {
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.quick-add button:hover { background: #000; }
#warnings { margin-top: 0.6rem; }
.alert-wip {
  background: #fce8d8;
  color: #7a4111;
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}
.alert-wip button {
  border: none; background: transparent; cursor: pointer; font: inherit; color: inherit;
}

/* ---- BOARD ---- */
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 0.9rem;
  padding: 1.2rem 1.5rem 3rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .board { grid-template-columns: 1fr; }
  .quick-add form { grid-template-columns: 1fr 1fr; }
  .quick-add button { grid-column: span 2; }
}

.col {
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem;
  min-height: 160px;
}
.col-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.1rem 0.3rem 0.6rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.6rem;
}
.col-head h2 { margin: 0; font-size: 0.92rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.col-head .count {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--line);
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
}

.col-body { display: grid; gap: 0.55rem; }

/* Color stripes per column */
.col-actif    .col-head { border-bottom-color: var(--actif); }
.col-actif    .col-head h2 { color: var(--actif); }
.col-en_pause .col-head { border-bottom-color: var(--pause); }
.col-en_pause .col-head h2 { color: var(--pause); }
.col-idee     .col-head { border-bottom-color: var(--idee); }
.col-idee     .col-head h2 { color: var(--idee); }
.col-termine  .col-head { border-bottom-color: var(--termine); }
.col-termine  .col-head h2 { color: var(--termine); }
.col-abandonne .col-head { border-bottom-color: var(--abandonne); }
.col-abandonne .col-head h2 { color: var(--abandonne); }

/* ---- CARD ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--abandonne);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.35rem;
  position: relative;
}
.card.statut-actif    { border-left-color: var(--actif); }
.card.statut-en_pause { border-left-color: var(--pause); }
.card.statut-idee     { border-left-color: var(--idee); }
.card.statut-termine  { border-left-color: var(--termine); }
.card.statut-abandonne { border-left-color: var(--abandonne); opacity: 0.7; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.card h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
  outline: none;
}
.card h3:focus { background: #fff4c2; border-radius: 3px; }
.cat {
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.notes {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  white-space: pre-wrap;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.15rem;
}
.card-foot select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 0.18rem 0.35rem;
  font: inherit;
  font-size: 0.8rem;
}
.del {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.3rem;
}
.del:hover { color: var(--danger); }
.updated {
  position: absolute;
  top: 0.55rem;
  right: 0.75rem;
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}
.card:hover .updated { opacity: 0.8; }

/* ---- PAIR ---- */
.pair {
  max-width: 640px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.pair h2 { font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-top: 1.6rem; }
.pair .token {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  user-select: all;
  word-break: break-all;
}
.muted { color: var(--muted); font-size: 0.85rem; }
.ok { background: var(--actif-bg); color: var(--actif); padding: 0.55rem 0.75rem; border-radius: 6px; }
.pair ul, .pair ol { padding-left: 1.2rem; }
.pair code { background: var(--line); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.85rem; }
