/* ══════════════════════════════════════════════
   STACK RANK · Celestial Light Theme
   ══════════════════════════════════════════════ */

:root {
  --bg:           #f7f6ff;
  --bg2:          #eeedfb;
  --surface:      rgba(255,255,255,0.75);
  --surface-2:    rgba(255,255,255,0.95);
  --border:       rgba(90,80,180,0.12);
  --border-focus: rgba(90,80,180,0.45);
  --text:         #1c1b3a;
  --muted:        #6b6a8e;
  --muted2:       #a09fc4;
  --accent:       #5b4de8;
  --accent-soft:  rgba(91,77,232,0.1);
  --accent-glow:  rgba(91,77,232,0.15);
  --accent2:      #0ea5e9;
  --drag-border:  #5b4de8;
  --drag-bg:      rgba(91,77,232,0.06);
  --tag-bg:       rgba(91,77,232,0.1);
  --tag-txt:      #4338ca;
  --delete-bg:    rgba(239,68,68,0.08);
  --delete-txt:   #dc2626;
  --shadow-sm:    0 1px 3px rgba(30,20,80,0.06), 0 1px 2px rgba(30,20,80,0.04);
  --shadow-md:    0 4px 16px rgba(30,20,80,0.08), 0 2px 4px rgba(30,20,80,0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Star field (ink dots on light bg) ───────── */
.stars {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

#stars-1 {
  background:
    radial-gradient(ellipse at 15% 40%, rgba(91,77,232,0.04) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 70%, rgba(14,165,233,0.04) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Ccircle cx='45'  cy='87'  r='1'   fill='%235b4de8' opacity='0.25'/%3E%3Ccircle cx='120' cy='210' r='0.7' fill='%235b4de8' opacity='0.18'/%3E%3Ccircle cx='200' cy='35'  r='1.2' fill='%230ea5e9' opacity='0.22'/%3E%3Ccircle cx='290' cy='155' r='0.8' fill='%235b4de8' opacity='0.2'/%3E%3Ccircle cx='380' cy='300' r='1'   fill='%235b4de8' opacity='0.22'/%3E%3Ccircle cx='460' cy='80'  r='0.7' fill='%230ea5e9' opacity='0.18'/%3E%3Ccircle cx='530' cy='420' r='0.9' fill='%235b4de8' opacity='0.2'/%3E%3Ccircle cx='80'  cy='380' r='0.8' fill='%235b4de8' opacity='0.22'/%3E%3Ccircle cx='310' cy='480' r='0.7' fill='%230ea5e9' opacity='0.18'/%3E%3Ccircle cx='170' cy='520' r='1'   fill='%235b4de8' opacity='0.2'/%3E%3Ccircle cx='430' cy='200' r='0.8' fill='%235b4de8' opacity='0.22'/%3E%3Ccircle cx='560' cy='560' r='0.6' fill='%230ea5e9' opacity='0.15'/%3E%3Ccircle cx='25'  cy='540' r='0.9' fill='%235b4de8' opacity='0.2'/%3E%3Ccircle cx='350' cy='50'  r='0.7' fill='%235b4de8' opacity='0.22'/%3E%3Ccircle cx='490' cy='330' r='0.8' fill='%230ea5e9' opacity='0.18'/%3E%3Ccircle cx='140' cy='310' r='0.6' fill='%235b4de8' opacity='0.2'/%3E%3Ccircle cx='245' cy='400' r='0.9' fill='%235b4de8' opacity='0.16'/%3E%3Ccircle cx='580' cy='150' r='0.8' fill='%230ea5e9' opacity='0.2'/%3E%3Cline x1='45' y1='87' x2='200' y2='35' stroke='%235b4de8' stroke-width='0.3' opacity='0.08'/%3E%3Cline x1='200' y1='35' x2='350' y2='50' stroke='%235b4de8' stroke-width='0.3' opacity='0.08'/%3E%3Cline x1='290' y1='155' x2='430' y2='200' stroke='%235b4de8' stroke-width='0.3' opacity='0.07'/%3E%3Cline x1='80' y1='380' x2='170' y2='520' stroke='%235b4de8' stroke-width='0.3' opacity='0.07'/%3E%3Cline x1='380' y1='300' x2='490' y2='330' stroke='%230ea5e9' stroke-width='0.3' opacity='0.07'/%3E%3C/svg%3E") repeat;
  animation: drift1 140s linear infinite;
}

#stars-2 {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='800'%3E%3Ccircle cx='60'  cy='130' r='0.6' fill='%235b4de8' opacity='0.18'/%3E%3Ccircle cx='190' cy='60'  r='0.8' fill='%230ea5e9' opacity='0.14'/%3E%3Ccircle cx='330' cy='220' r='0.6' fill='%235b4de8' opacity='0.16'/%3E%3Ccircle cx='500' cy='100' r='0.7' fill='%235b4de8' opacity='0.16'/%3E%3Ccircle cx='650' cy='280' r='0.6' fill='%230ea5e9' opacity='0.14'/%3E%3Ccircle cx='720' cy='450' r='0.8' fill='%235b4de8' opacity='0.16'/%3E%3Ccircle cx='100' cy='450' r='0.6' fill='%235b4de8' opacity='0.14'/%3E%3Ccircle cx='420' cy='530' r='0.7' fill='%230ea5e9' opacity='0.16'/%3E%3Ccircle cx='270' cy='670' r='0.6' fill='%235b4de8' opacity='0.14'/%3E%3Ccircle cx='580' cy='620' r='0.7' fill='%235b4de8' opacity='0.16'/%3E%3Ccircle cx='760' cy='700' r='0.6' fill='%230ea5e9' opacity='0.12'/%3E%3Ccircle cx='40'  cy='730' r='0.7' fill='%235b4de8' opacity='0.14'/%3E%3Ccircle cx='680' cy='50'  r='0.6' fill='%235b4de8' opacity='0.16'/%3E%3Ccircle cx='350' cy='380' r='0.8' fill='%230ea5e9' opacity='0.14'/%3E%3Cline x1='60' y1='130' x2='190' y2='60' stroke='%235b4de8' stroke-width='0.4' opacity='0.07'/%3E%3Cline x1='500' y1='100' x2='650' y2='280' stroke='%235b4de8' stroke-width='0.4' opacity='0.06'/%3E%3Cline x1='420' y1='530' x2='580' y2='620' stroke='%230ea5e9' stroke-width='0.4' opacity='0.06'/%3E%3C/svg%3E") repeat;
  animation: drift2 200s linear infinite;
}

#stars-3 {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Ccircle cx='30'  cy='70'  r='1.4' fill='%235b4de8' opacity='0.1'/%3E%3Ccircle cx='150' cy='30'  r='1.2' fill='%230ea5e9' opacity='0.1'/%3E%3Ccircle cx='280' cy='160' r='1.3' fill='%235b4de8' opacity='0.08'/%3E%3Ccircle cx='370' cy='280' r='1.2' fill='%230ea5e9' opacity='0.1'/%3E%3Ccircle cx='80'  cy='320' r='1.4' fill='%235b4de8' opacity='0.08'/%3E%3Ccircle cx='210' cy='370' r='1.2' fill='%235b4de8' opacity='0.1'/%3E%3Ccircle cx='330' cy='60'  r='1.3' fill='%230ea5e9' opacity='0.08'/%3E%3C/svg%3E") repeat;
  animation: drift3 260s linear infinite;
}

@keyframes drift1 { from { transform: translateY(0); } to { transform: translateY(-600px); } }
@keyframes drift2 { from { transform: translateY(0); } to { transform: translateY(-800px); } }
@keyframes drift3 { from { transform: translateY(0); } to { transform: translateY(-400px); } }

.hidden { display: none !important; }

/* ── Login Screen ─────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}

.login-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(91,77,232,0.15);
  border-radius: 20px;
  padding: 52px 48px;
  text-align: center;
  max-width: 400px; width: 90%;
  box-shadow: 0 8px 40px rgba(91,77,232,0.1), 0 2px 8px rgba(30,20,80,0.06);
  backdrop-filter: blur(20px);
}

.login-logo {
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 16px;
  animation: pulse-star 3s ease-in-out infinite;
}

@keyframes pulse-star {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 6px rgba(91,77,232,0.4)); }
  50%       { opacity: 0.8; filter: drop-shadow(0 0 16px rgba(91,77,232,0.7)); }
}

.login-title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px; font-weight: 400;
  color: var(--text); margin-bottom: 6px;
}

.login-sub {
  font-size: 13px; color: var(--muted);
  margin-bottom: 36px;
}

.btn-google {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid rgba(91,77,232,0.25);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 500;
  padding: 12px 24px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.btn-google:hover {
  background: var(--accent-soft);
  border-color: rgba(91,77,232,0.4);
  box-shadow: 0 4px 16px rgba(91,77,232,0.12);
}

.login-error {
  margin-top: 20px;
  font-size: 13px;
  color: #dc2626;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  padding: 10px 16px;
}

.dev-mode-notice {
  font-size: 11px; color: var(--muted);
  margin-bottom: 14px;
  padding: 6px 12px;
  background: rgba(91,77,232,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.dev-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.dev-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background: #fff;
  border: 1px solid rgba(91,77,232,0.2);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 16px;
  outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dev-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,77,232,0.08);
}
.dev-input::placeholder { color: var(--muted2); }

/* ── App layout ───────────────────────────────────── */
#app {
  position: relative; z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 32px 100px;
}

/* ── Header ───────────────────────────────────────── */
header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 32px; font-weight: 400;
  letter-spacing: -0.5px;
  color: var(--text);
  white-space: nowrap;
}
.header-left p { color: var(--muted); font-size: 12px; margin-top: 3px; }

.header-user {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

.header-actions {
  display: flex; align-items: center; gap: 6px;
}

.filter-wrap {
  display: flex; align-items: center; gap: 8px;
}
.filter-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted2);
}
.dri-filter {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  padding: 4px 28px 4px 12px;
  cursor: pointer; outline: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a09fc4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}
.dri-filter:focus { border-color: var(--accent); }
.dri-filter option { background: #fff; color: var(--text); }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px; color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  object-fit: cover; background: var(--accent-soft);
}
.role-badge {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 20px;
}
.role-badge.admin  { background: rgba(91,77,232,0.12); color: var(--accent); }
.role-badge.dri    { background: rgba(14,165,233,0.1); color: #0369a1; }
.role-badge.codir  { background: rgba(0,0,0,0.05); color: var(--muted); }
.role-badge.editor { background: rgba(14,165,233,0.1); color: #0369a1; }
.role-badge.viewer { background: rgba(0,0,0,0.05); color: var(--muted); }

.btn-action {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 500;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn-action:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(91,77,232,0.3);
  box-shadow: 0 2px 8px rgba(91,77,232,0.1);
}
.btn-action.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(91,77,232,0.3);
}
.btn-logout { padding: 5px 8px; }

/* ── TMA Banner ───────────────────────────────────── */
.tma-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  background: rgba(91,77,232,0.05);
  border: 1px solid rgba(91,77,232,0.15);
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.tma-badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
  background: rgba(91,77,232,0.1); padding: 2px 9px; border-radius: 20px;
  white-space: nowrap;
}
.tma-text { font-size: 14px; font-weight: 500; color: var(--text); }
.tma-dri {
  margin-left: auto;
  font-size: 11px; font-weight: 500;
  padding: 2px 10px; border-radius: 20px;
  background: rgba(91,77,232,0.1); color: var(--accent); white-space: nowrap;
}
.tma-editable { outline: none; cursor: text; border-radius: 4px; transition: box-shadow 0.15s; }
.tma-editable:focus { box-shadow: 0 0 0 2px rgba(91,77,232,0.25); }

/* ── Section ──────────────────────────────────────── */
.section-header { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; }
.section-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted2);
}

/* ── Stack items ──────────────────────────────────── */
#stack-list { margin-bottom: 10px; }

.item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 0 14px;
  padding: 13px 6px 13px 10px;
  border-bottom: 1px solid var(--border);
  align-items: start;
  cursor: grab;
  border-radius: 8px;
  transition: background 0.15s, box-shadow 0.15s;
  position: relative;
}
.item:first-child { border-top: 1px solid var(--border); }
.item:hover { background: rgba(255,255,255,0.7); box-shadow: var(--shadow-sm); }
.item.dragging  { opacity: 0.35; cursor: grabbing; }
.item.drag-over {
  background: var(--drag-bg);
  border-color: transparent;
  box-shadow: 0 -2px 0 var(--drag-border), var(--shadow-sm);
}
.item.filtered-out { display: none; }

.item-num {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--accent);
  padding-top: 1px; line-height: 1.3;
  user-select: none;
}

.item-body { min-width: 0; }

.item-title-row { display: flex; align-items: center; gap: 10px; }

.item-title {
  flex: 1; min-width: 0;
  font-weight: 500; font-size: 15px;
  outline: none; border: none;
  background: transparent;
  color: var(--text); cursor: text;
  font-family: 'DM Sans', sans-serif;
  padding: 0;
}
.item-tags {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
}
.item-title:focus { border-bottom: 1.5px solid var(--accent); }
.item-title[readonly] { cursor: default; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 2px 10px; border-radius: 20px;
  background: var(--tag-bg); color: var(--tag-txt);
  white-space: nowrap;
}
.dri-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px; font-weight: 500;
  padding: 2px 24px 2px 10px;
  border-radius: 20px;
  background: var(--tag-bg); color: var(--tag-txt);
  border: 1px solid transparent;
  outline: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%234338ca' stroke-width='1.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}
.dri-select:focus { border-color: var(--border-focus); }
.dri-select option { background: #fff; color: var(--text); }
.dri-select.empty { opacity: 0.5; }

.item-note {
  margin-top: 3px; font-size: 13px; color: var(--muted);
  outline: none; min-height: 18px; line-height: 1.5;
}
.item-note[contenteditable="true"] { cursor: text; }
.item-note[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: var(--muted2); font-style: italic;
}
.item-note[contenteditable="true"]:focus { border-bottom: 1px dashed rgba(91,77,232,0.2); }

.item-actions {
  display: flex; align-items: flex-start; gap: 4px; padding-top: 3px;
  opacity: 0; transition: opacity 0.15s;
}
.item:hover .item-actions { opacity: 1; }

.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--muted2); padding: 4px 6px; border-radius: 6px;
  font-size: 13px; line-height: 1;
  transition: background 0.1s, color 0.1s;
}
.btn-icon:hover { background: var(--delete-bg); color: var(--delete-txt); }
/* ── Insert gap (hover entre les cards) ───────────── */
.insert-gap {
  height: 16px;
  display: flex; align-items: center; justify-content: center;
  position: relative; margin: -2px 0; cursor: default;
}
.insert-gap-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--accent); border-radius: 2px;
  opacity: 0; transition: opacity 0.15s;
}
.insert-gap-btn {
  position: absolute;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: 2px solid var(--bg);
  font-size: 16px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity 0.15s, transform 0.1s;
  display: flex; align-items: center; justify-content: center;
  z-index: 10; padding: 0;
}
.insert-gap:hover .insert-gap-line,
.insert-gap:hover .insert-gap-btn { opacity: 1; }
.insert-gap-btn:hover { transform: scale(1.15); }

/* ── Add button ───────────────────────────────────── */
.add-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px; color: var(--muted);
  font-size: 13px; cursor: pointer;
  border-radius: 8px; border: none; background: none;
  font-family: 'DM Sans', sans-serif;
  width: 100%; text-align: left; margin-bottom: 40px;
  transition: background 0.15s, color 0.15s;
}
.add-btn:hover { background: var(--accent-soft); color: var(--accent); }
.add-btn .plus { font-size: 18px; font-weight: 300; line-height: 1; }

/* ── Footer ───────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  display: flex; justify-content: center;
  margin-top: 32px;
}
.footer-changelog-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; color: var(--muted2);
  padding: 6px 12px; border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.footer-changelog-btn:hover { color: var(--accent); background: var(--accent-soft); }


/* ── Backlog ──────────────────────────────────────── */
#backlog-list { margin-bottom: 10px; }

.bl-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  padding: 12px 6px 12px 2px;
  border-bottom: 1px solid var(--border);
  align-items: start; border-radius: 8px;
  transition: background 0.15s, box-shadow 0.15s; cursor: grab;
}
.bl-item:first-child { border-top: 1px solid var(--border); }
.bl-item:hover { background: rgba(255,255,255,0.7); box-shadow: var(--shadow-sm); }
.bl-item.dragging { opacity: 0.35; }
.bl-item.drag-over { background: var(--drag-bg); box-shadow: 0 -2px 0 var(--drag-border); }

.bl-type {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px;
  display: inline-block; cursor: pointer; user-select: none;
}
.bl-type.build { background: #e0f2fe; color: #0369a1; }
.bl-type.buy   { background: #ede9fe; color: #5b4de8; }
.bl-type.readonly { cursor: default; }

.bl-scope {
  font-size: 11px; color: var(--muted); display: block; margin-top: 3px;
  outline: none; font-family: 'DM Sans', sans-serif;
}
.bl-scope[contenteditable="true"] { cursor: text; }
.bl-scope[contenteditable="true"]:focus { border-bottom: 1px dashed rgba(91,77,232,0.2); }
.bl-scope:empty::before { content: "Scope…"; color: var(--muted2); font-style: italic; }

.bl-body { min-width: 0; }
.bl-desc {
  font-size: 14px; line-height: 1.5; outline: none; cursor: text;
  font-family: 'DM Sans', sans-serif;
  background: transparent; border: none; color: var(--text); width: 100%;
}
.bl-desc:focus { border-bottom: 1.5px solid var(--accent); }
.bl-desc[readonly] { cursor: default; }

.bl-when {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  outline: none; font-family: 'DM Sans', sans-serif;
}
.bl-when[contenteditable="true"] { cursor: text; }
.bl-when:empty::before { content: "Échéance…"; color: var(--muted2); font-style: italic; }
.bl-when[contenteditable="true"]:focus { border-bottom: 1px dashed rgba(91,77,232,0.2); }

.bl-actions {
  display: flex; align-items: flex-start; gap: 4px; padding-top: 2px;
  opacity: 0; transition: opacity 0.15s;
}
.bl-item:hover .bl-actions { opacity: 1; }

/* ── Drawers ──────────────────────────────────────── */
.drawer {
  position: fixed; top: 0; right: 0;
  width: 380px; height: 100vh;
  background: rgba(247,246,255,0.97);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(30,20,80,0.1);
  z-index: 200;
  display: flex; flex-direction: column;
  transform: translateX(0);
  transition: transform 0.22s ease;
  backdrop-filter: blur(20px);
}
.drawer.hidden { transform: translateX(100%); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px; color: var(--text);
}

.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px; }

.overlay {
  position: fixed; inset: 0; z-index: 199;
  background: rgba(30,20,80,0.1);
  backdrop-filter: blur(2px);
}
.overlay.hidden { display: none; }

/* ── Changelog entries ────────────────────────────── */
.cl-entry {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--muted); line-height: 1.5;
}
.cl-entry:last-child { border-bottom: none; }
.cl-action {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 20px;
  background: var(--tag-bg); color: var(--tag-txt); margin-right: 5px;
}
.cl-time { float: right; font-size: 11px; opacity: 0.5; }
.cl-detail { color: var(--text); }

/* ── Admin panel ──────────────────────────────────── */
.admin-hint {
  font-size: 12px; color: var(--muted); line-height: 1.6;
  margin: 0 0 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.admin-hint strong { color: var(--text); }

.admin-add-row { display: flex; gap: 8px; margin-bottom: 14px; }
.admin-input {
  flex: 1; font-family: 'DM Sans', sans-serif; font-size: 13px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 7px 12px;
  outline: none; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}
.admin-input:focus { border-color: var(--accent); }
.admin-input::placeholder { color: var(--muted2); }

.btn-add-member {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  background: var(--tag-bg); color: var(--accent);
  border: 1px solid rgba(91,77,232,0.2);
  border-radius: 8px; padding: 7px 16px;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}
.btn-add-member:hover { background: rgba(91,77,232,0.15); }

.admin-list { display: flex; flex-direction: column; gap: 6px; }

.admin-member-row,
.admin-user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.admin-member-name { color: var(--text); }

.admin-user-info { display: flex; align-items: center; gap: 10px; }
.admin-user-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft);
}
.admin-user-name { color: var(--text); font-size: 13px; }
.admin-user-email { color: var(--muted); font-size: 11px; }

.role-select {
  font-family: 'DM Sans', sans-serif; font-size: 12px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 4px 8px;
  outline: none; cursor: pointer; box-shadow: var(--shadow-sm);
}
.role-select option { background: #fff; color: var(--text); }

/* ── Toast ────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff; font-size: 13px; font-weight: 500;
  padding: 10px 22px; border-radius: 24px;
  box-shadow: 0 4px 20px rgba(30,20,80,0.2);
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none; z-index: 300; white-space: nowrap;
}
.toast.show { opacity: 1; }
.toast.success { background: #166534; }

/* ── Custom select ────────────────────────────────── */
.custom-select-wrap { display: flex; align-items: center; gap: 6px; }
.custom-select { position: relative; }
.cs-trigger {
  display: flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 10px 5px 12px;
  font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500;
  color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.cs-trigger:hover { border-color: var(--accent-soft); }
.custom-select.open .cs-trigger { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(91,77,232,0.12); }
.cs-value { display: flex; align-items: center; gap: 5px; }
.cs-chevron { flex-shrink: 0; color: var(--muted); transition: transform 0.15s; }
.custom-select.open .cs-chevron { transform: rotate(180deg); }
.cs-avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.cs-avatar.cs-initials {
  background: var(--accent-soft); color: var(--accent);
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cs-menu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 170px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
  box-shadow: 0 8px 24px rgba(30,20,80,0.12);
  z-index: 200; max-height: 240px; overflow-y: auto;
}
.cs-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--text);
  transition: background 0.1s;
}
.cs-option:hover { background: var(--accent-soft); }
.cs-option.selected { color: var(--accent); background: rgba(91,77,232,0.06); }
.cs-opt-label { flex: 1; }

/* ── Type tag ─────────────────────────────────────── */
.type-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase; cursor: pointer; user-select: none;
  transition: opacity 0.15s;
}
.type-tag.type-build { background: rgba(14,165,233,0.1); color: #0369a1; }
.type-tag.type-buy   { background: rgba(124,106,247,0.1); color: var(--accent); }
.type-tag.type-empty { background: rgba(0,0,0,0.04); color: var(--muted2); font-weight: 500; }

/* ── Avatar chips ─────────────────────────────────── */
.assignments-row {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  position: relative;
}
.avatar-chip {
  position: relative; width: 26px; height: 26px; border-radius: 50%;
  overflow: visible; flex-shrink: 0; cursor: default;
}
.avatar-chip img, .avatar-chip .avatar-initials {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; display: block;
}
.avatar-chip .avatar-initials {
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.avatar-chip.dri img, .avatar-chip.dri .avatar-initials {
  outline: 3px solid var(--accent); outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(91,77,232,0.25);
}
.avatar-chip.collaborateur img, .avatar-chip.collaborateur .avatar-initials {
  outline: 2px solid var(--border); outline-offset: 1px;
}
.avatar-remove-btn {
  display: none; position: absolute; top: -4px; right: -4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--delete-txt); color: #fff; border: none;
  font-size: 9px; line-height: 1; cursor: pointer;
  align-items: center; justify-content: center; padding: 0;
}
.avatar-chip:hover .avatar-remove-btn { display: flex; }
.avatar-add-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  border: 1.5px dashed var(--accent); font-size: 16px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.avatar-add-btn:hover { background: rgba(91,77,232,0.15); }

/* ── People picker ────────────────────────────────── */
.people-picker {
  position: absolute; top: 32px; left: 0; z-index: 300;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 6px;
  box-shadow: 0 8px 28px rgba(30,20,80,0.14);
  min-width: 220px; max-height: 260px; overflow-y: auto;
}
.pp-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px;
  transition: background 0.1s;
}
.pp-user:hover { background: var(--bg-hover); }
.pp-avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.pp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pp-initials {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.pp-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.pp-roles { display: flex; gap: 4px; }
.pp-role {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 20px; border: none; cursor: pointer;
  transition: background 0.1s;
}
.pp-role[data-role="dri"] {
  background: rgba(91,77,232,0.1); color: var(--accent);
}
.pp-role[data-role="dri"]:hover { background: rgba(91,77,232,0.2); }
.pp-role[data-role="collaborateur"] {
  background: rgba(0,0,0,0.05); color: var(--muted);
}
.pp-role[data-role="collaborateur"]:hover { background: rgba(0,0,0,0.1); }

/* ── Filter wrap multi ────────────────────────────── */
.filter-wrap { gap: 16px; }
.custom-select-wrap { display: flex; align-items: center; gap: 6px; }
