/* ===========================================================================
   Mind — canvas cerveau central. Direction artistique "Soft Studio" (atlas) :
   crème chaud, périwinkle pastel, cartes claires arrondies, ombres douces.
   Plus Jakarta Sans. Vanilla, zéro build.
   =========================================================================== */
:root {
  --bg:        #F3F1EA;
  --bg-2:      #EBE8DF;
  --card:      #FFFFFF;
  --ink:       #191814;
  --ink-2:     #232220;
  --ink-soft:  #6B6860;
  --ink-mute:  #9C988E;
  --on-dark:   #F4F2EC;
  --line:      rgba(25,24,20,.08);
  --accent:    #7C84F2;
  --accent-2:  #5E66E0;
  --accent-soft:#ECEDFC;
  --green: #2FA37A; --green-soft:#E0F0E9;
  --amber: #E2922F; --amber-soft:#FBEAD2;
  --red:   #DB5E47; --red-soft:#F8DFD9;
  --gray:  #ADA99E; --gray-soft:#ECE9E1;
  --radius:24px; --radius-sm:16px; --radius-pill:999px;
  --shadow:    0 8px 28px rgba(25,24,20,.06), 0 1px 2px rgba(25,24,20,.04);
  --shadow-sm: 0 2px 10px rgba(25,24,20,.05);
  --shadow-hover: 0 18px 44px rgba(25,24,20,.12), 0 2px 6px rgba(25,24,20,.05);
  --ease: cubic-bezier(.22,.61,.36,1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 520px at 84% -8%, rgba(124,132,242,.16), transparent 60%),
    radial-gradient(760px 520px at -6% 100%, rgba(94,102,224,.08), transparent 55%);
}
button { font-family: inherit; cursor: pointer; }
svg { display: block; }
h1,h2,h3,p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---- Header ------------------------------------------------------------ */
.hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 16px clamp(16px, 4vw, 32px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: radial-gradient(120% 120% at 30% 25%, #9aa0f7, var(--accent-2) 70%, #3a41c0);
  box-shadow: 0 6px 16px rgba(94,102,224,.34), inset 0 1px 1px rgba(255,255,255,.5);
}
.brand__name { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.brand__sub { display:block; font-size: 12px; font-weight: 500; color: var(--ink-mute); margin-top: 2px; }
.hdr__spacer { flex: 1; }

.btn {
  appearance: none; border: 1px solid var(--line); border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em;
  padding: 10px 16px; display: inline-flex; align-items: center; gap: 7px;
  transition: transform .14s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--on-dark); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.btn--primary:hover { box-shadow: var(--shadow); }
.btn--ghost { background: var(--card); color: var(--ink-soft); box-shadow: var(--shadow-sm); }
.btn--ghost:hover { color: var(--ink); }
.btn--danger { background: var(--red-soft); color: #B23A26; border-color: transparent; }
.btn--danger:hover { background: #f6d2c9; }

/* ---- Viewport / canvas ------------------------------------------------- */
.viewport {
  position: fixed; inset: 0; z-index: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: none;
}
.viewport.is-panning { cursor: grabbing; }
.world {
  position: relative; width: 2400px; height: 1600px;
  transform-origin: 0 0; will-change: transform;
}
.links { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: visible; }
.links line { stroke: rgba(124,132,242,.45); stroke-width: 2; transition: stroke .2s var(--ease); }
.links line.is-done { stroke: rgba(47,163,122,.4); }

/* ---- Brain ------------------------------------------------------------- */
.brain {
  position: absolute; left: 1200px; top: 800px; transform: translate(-50%,-50%);
  z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 12px;
  user-select: none;
}
.brain__core {
  width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(130% 130% at 32% 24%, #aab0fa, var(--accent) 52%, var(--accent-2) 100%);
  box-shadow: 0 24px 60px rgba(94,102,224,.42), 0 4px 14px rgba(94,102,224,.3),
              inset 0 2px 3px rgba(255,255,255,.55), inset 0 -10px 24px rgba(58,65,192,.4);
  position: relative;
  animation: breathe 6s var(--ease) infinite;
}
.brain__core::after {
  content:""; position:absolute; inset:-14px; border-radius:50%;
  border: 1.5px dashed rgba(124,132,242,.4);
  animation: spin 60s linear infinite;
}
@keyframes breathe { 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.04); } }
@keyframes spin { to { transform: rotate(360deg); } }
.brain__emoji { font-size: 54px; filter: drop-shadow(0 3px 5px rgba(58,65,192,.4)); }
.brain__label {
  font-size: 14px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink);
  background: var(--card); padding: 5px 14px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}

/* ---- Project nodes ----------------------------------------------------- */
.node {
  position: absolute; transform: translate(-50%,-50%);
  z-index: 4; min-width: 168px; max-width: 230px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: grab; user-select: none;
  transition: box-shadow .2s var(--ease), transform .08s var(--ease), border-color .2s var(--ease);
  touch-action: none;
}
.node:hover { box-shadow: var(--shadow-hover); border-color: rgba(124,132,242,.5); }
.node.is-dragging { cursor: grabbing; box-shadow: var(--shadow-hover); z-index: 9; transition: none; }
.node__top { display: flex; align-items: center; gap: 10px; }
.node__emoji {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: grid; place-items: center; font-size: 21px;
  background: var(--accent-soft);
}
.node__name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; min-width: 0; }
.node__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.node__count {
  font-size: 12px; font-weight: 700; color: var(--ink-mute);
  display: inline-flex; align-items: center; gap: 5px;
}
.node__bar { height: 6px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.node__bar > span { display:block; height:100%; border-radius:999px; background: var(--accent); transition: width .3s var(--ease); }
.node__status {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 8px; border-radius: 999px;
}
.st-todo    { background: var(--gray-soft);  color: #7d7a70; }
.st-doing   { background: var(--amber-soft); color: #97601a; }
.st-blocked { background: var(--red-soft);   color: #B23A26; }
.st-done    { background: var(--green-soft); color: #1f7a59; }
.node.is-done .node__bar > span { background: var(--green); }

/* ---- Dots -------------------------------------------------------------- */
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot--gray { background: var(--gray); } .dot--amber { background: var(--amber); }
.dot--red { background: var(--red); }  .dot--green { background: var(--green); }

/* ---- Agenda (Échéances à venir) — design "Soft Studio" / atlas --------- */
.agenda {
  position: fixed; top: 80px; left: clamp(12px, 2vw, 24px); z-index: 25;
  width: 340px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100vh - 104px);
}
.agenda__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm); padding: 8px 8px 8px 16px;
}
.agenda__title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.agenda__title svg { color: var(--accent-2); }
.agenda__count {
  min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; background: var(--accent-soft); color: var(--accent-2); border-radius: 999px;
}
.agenda__act { display: flex; gap: 6px; }
.iconbtn--sm { width: 32px; height: 32px; border-radius: 999px; box-shadow: none; }
.iconbtn--sm svg { width: 16px; height: 16px; }
.agenda.is-collapsed .agenda__scroll { display: none; }
.agenda.is-collapsed #agToggle svg { transform: rotate(180deg); }
#agToggle svg { transition: transform .2s var(--ease); }

.agenda__scroll { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding-bottom: 4px; }

/* Formulaire = carte */
.agenda__form {
  display: flex; flex-direction: column; gap: 9px; flex: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px;
}
.agenda__form[hidden] { display: none; }
.agenda__form input, .agenda__select {
  border: 1px solid var(--line); background: var(--bg); border-radius: 12px;
  padding: 10px 12px; font-family: inherit; font-size: 13.5px; color: var(--ink); width: 100%;
}
.agenda__form input:focus, .agenda__select:focus { outline: none; border-color: var(--accent); background: var(--card); }
.agenda__row { display: flex; gap: 8px; }
.agenda__row input[type="date"] { flex: 1.4; }
.agenda__row input[type="time"] { flex: 1; }
.agenda__kinds { display: flex; gap: 6px; }
.kchip {
  flex: 1; border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
  font-size: 12px; font-weight: 700; padding: 8px 6px; border-radius: 999px; transition: all .15s var(--ease);
}
.kchip.is-active { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.agenda__formbtns { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.agenda__formspacer { flex: 1; }
.btn--sm { padding: 8px 14px; font-size: 12.5px; }

/* Sections (cartes) — calquées atlas .ag-sec */
.ag-sec {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 14px 16px 8px; flex: none;
}
.ag-sec__head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.ag-sec__icon {
  width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--ink);
}
.ag-sec__icon svg { width: 16px; height: 16px; }
.ag-sec__title { font-size: 14.5px; font-weight: 700; letter-spacing: -0.02em; }
.ag-sec__count {
  margin-left: auto; min-width: 21px; height: 21px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; line-height: 1; background: var(--bg-2); color: var(--ink-soft); border-radius: 999px;
}
.ag-sec--alert { border-color: rgba(219,94,71,.30); }
.ag-sec--alert .ag-sec__icon { background: var(--red-soft); color: var(--red); }
.ag-sec--alert .ag-sec__title { color: var(--red); }
.ag-sec--alert .ag-sec__count { background: var(--red-soft); color: var(--red); }
.ag-sec--today .ag-sec__icon { background: var(--accent-soft); color: var(--accent-2); }
.ag-sec--later { background: var(--bg-2); box-shadow: none; }
.ag-sec--later .ag-sec__icon { background: var(--card); color: var(--ink-mute); }
.ag-sec--later .ag-sec__title { color: var(--ink-soft); }

/* Rangées — calquées atlas .ag-row */
.ag-row {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 11px;
  padding: 11px 2px; border-top: 1px solid var(--line); border-radius: 9px;
  transition: background .15s var(--ease), padding .15s var(--ease);
}
.ag-sec .ag-row:first-of-type { border-top: 0; }
.ag-row:hover { background: var(--bg-2); padding-left: 8px; padding-right: 6px; }
.ag-row__check {
  position: relative; width: 18px; height: 18px; flex: none; border: 0; background: transparent; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer; transition: background .15s var(--ease);
}
.ag-row__dot { width: 9px; height: 9px; border-radius: 50%; }
.ag-dot--retard { background: var(--red); } .ag-dot--today { background: var(--accent-2); }
.ag-dot--week { background: var(--amber); } .ag-dot--later { background: var(--gray); }
.ag-row__check:hover .ag-row__dot { box-shadow: 0 0 0 4px var(--bg-2); }
.ag-check { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; color: #fff; }
.ag-check svg { width: 11px; height: 11px; }
.ag-row.is-done .ag-row__check { background: var(--green); }
.ag-row.is-done .ag-row__dot { opacity: 0; }
.ag-row.is-done .ag-check { opacity: 1; }
.ag-row__body { min-width: 0; }
.ag-row__label {
  display: block; font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ag-row.is-done .ag-row__label { color: var(--ink-mute); text-decoration: line-through; }
.ag-row__meta {
  display: flex; align-items: center; gap: 6px; margin-top: 3px;
  font-size: 12px; font-weight: 500; color: var(--ink-mute); overflow: hidden;
}
.ag-row__kind { flex: none; }
.ag-row__proj {
  font-weight: 700; color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%;
}
.ag-row__proj:hover { text-decoration: underline; }
.ag-row__link { flex: none; display: inline-grid; place-items: center; color: var(--accent-2); width: 16px; height: 16px; }
.ag-row__link:hover { color: var(--accent); }
.ag-row__link svg { width: 13px; height: 13px; }
.ag-row__due {
  flex: none; font-size: 12px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink-soft); white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: var(--bg-2);
}
.ag-row__due--overdue { background: var(--red-soft); color: var(--red); }
.ag-row__due--today { background: var(--accent-soft); color: var(--accent-2); }
.ag-sec--later .ag-row__due { background: var(--card); }

.ag-empty {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  font-size: 13px; color: var(--ink-mute); padding: 26px 16px; text-align: center; line-height: 1.6;
}
.ag-donehead { cursor: pointer; }
.ag-donehead .ag-sec__title { color: var(--ink-mute); }

/* ---- Zoom badge -------------------------------------------------------- */
.zoombadge {
  position: fixed; bottom: 18px; left: 18px; z-index: 20;
  font-size: 12px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  padding: 7px 12px; border-radius: var(--radius-pill); min-width: 50px; text-align: center;
  user-select: none;
}

/* ---- Hint -------------------------------------------------------------- */
.hint {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 20;
  font-size: 12.5px; font-weight: 600; color: var(--ink-mute);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  padding: 8px 16px; border-radius: var(--radius-pill);
  transition: opacity .4s var(--ease);
}

/* ---- Drawer ------------------------------------------------------------ */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(25,24,20,.18);
  backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
}
.scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(440px, 92vw);
  background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(25,24,20,.16);
  transform: translateX(102%); transition: transform .34s var(--ease);
  display: flex; flex-direction: column; padding: 22px 22px 0;
}
.drawer.is-open { transform: translateX(0); }
.drawer__head { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; }
.drawer__emoji {
  width: 46px; height: 46px; flex: none; border: 0; border-radius: 13px;
  background: var(--accent-soft); font-size: 24px; display: grid; place-items: center;
  transition: transform .14s var(--ease);
}
.drawer__emoji:hover { transform: scale(1.06); }
.drawer__title {
  flex: 1; min-width: 0; border: 0; background: transparent;
  font-family: inherit; font-size: 21px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink);
  padding: 6px 4px; border-radius: 10px;
}
.drawer__title:focus { outline: none; background: var(--card); box-shadow: var(--shadow-sm); }
.iconbtn {
  border: 0; background: var(--card); width: 38px; height: 38px; flex: none;
  border-radius: 11px; display: grid; place-items: center; color: var(--ink-soft);
  box-shadow: var(--shadow-sm); transition: color .15s, transform .12s var(--ease);
}
.iconbtn:hover { color: var(--ink); }
.iconbtn--accent { background: var(--accent); color: #fff; }
.iconbtn--accent:hover { background: var(--accent-2); color: #fff; }

.drawer__status { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  font-size: 12.5px; font-weight: 700; padding: 8px 13px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 7px; box-shadow: var(--shadow-sm);
  transition: all .16s var(--ease);
}
.chip.is-active { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.chip.is-active .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.25); }

.drawer__progress { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; }
.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .35s var(--ease); }
.bar__label { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }

.drawer__tasks { flex: 1; overflow-y: auto; display: flex; flex-direction: column; margin: 0 -6px; padding: 0 6px; }
.tasks__head { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); padding: 4px 2px 12px; }
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px; box-shadow: var(--shadow-sm);
  transition: opacity .2s var(--ease);
}
.task__check {
  width: 22px; height: 22px; flex: none; margin-top: 1px; border-radius: 7px;
  border: 2px solid var(--gray); background: transparent;
  display: grid; place-items: center; transition: all .16s var(--ease); color: #fff;
}
.task__check svg { opacity: 0; }
.task.is-done .task__check { background: var(--green); border-color: var(--green); }
.task.is-done .task__check svg { opacity: 1; }
.task__label { flex: 1; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.4; padding-top: 1px; border: 0; background: transparent; font-family: inherit; color: var(--ink); resize: none; }
.task__label:focus { outline: none; }
.task.is-done .task__label { color: var(--ink-mute); text-decoration: line-through; }
.task__del {
  border: 0; background: transparent; color: var(--ink-mute); width: 26px; height: 26px;
  flex: none; border-radius: 8px; display: grid; place-items: center; opacity: 0; transition: opacity .15s, color .15s;
}
.task:hover .task__del { opacity: 1; }
.task__del:hover { color: var(--red); background: var(--red-soft); }

.addtask { display: flex; gap: 8px; padding: 12px 0 14px; position: sticky; bottom: 0; background: var(--bg); }
.addtask input {
  flex: 1; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: inherit; font-size: 14px; color: var(--ink); box-shadow: var(--shadow-sm);
}
.addtask input:focus { outline: none; border-color: var(--accent); }

.drawer__foot { padding: 14px 0 18px; border-top: 1px solid var(--line); }
.drawer__foot .btn { width: 100%; justify-content: center; }

.tasks__empty { font-size: 13px; color: var(--ink-mute); padding: 8px 2px; }

/* ---- Emoji popover ----------------------------------------------------- */
.emojipop {
  position: fixed; z-index: 60; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); padding: 10px;
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 280px;
}
.emojipop[hidden] { display: none; }
.emojipop button { border: 0; background: transparent; font-size: 22px; padding: 6px; border-radius: 9px; }
.emojipop button:hover { background: var(--accent-soft); }

@media (max-width: 560px) {
  .brand__sub { display: none; }
  .btn span, .recenter-text { display: none; }
}
