/* ══════════════════════════════════════════════════
   Anna — feuille de style cosy & pastel (mobile first)
   ══════════════════════════════════════════════════ */

:root {
  /* thème par défaut : 🌸 rose poudré */
  --bg1: #fdf3f0;
  --bg2: #fbe9ee;
  --bg3: #f6f0fb;
  --card: #fffdfc;
  --card-2: #fff7f6;
  --ink: #4a3f45;
  --ink-soft: #6f6169;
  --muted: #a2929a;
  --line: #f0e2e5;
  --accent: #e8a0b4;
  --accent-deep: #d4738f;
  --accent-soft: #fbe4ea;
  --accent-ink: #8d4c62;
  --ok: #a7c9a2;
  --shadow: 0 10px 24px -14px rgba(120, 80, 95, .45);
  --shadow-lg: 0 18px 40px -20px rgba(120, 80, 95, .5);
  --radius: 22px;
  --radius-sm: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html[data-theme="sauge"] {
  --bg1: #f3f7f1; --bg2: #e9f1e7; --bg3: #f6f4ec;
  --card: #fdfefc; --card-2: #f6faf4;
  --ink: #3f4a41; --ink-soft: #5e6b60; --muted: #97a599; --line: #e2ebe0;
  --accent: #a8c3a0; --accent-deep: #7fa375; --accent-soft: #e6f0e2; --accent-ink: #4c6a45;
  --shadow: 0 10px 24px -14px rgba(80, 105, 85, .45);
  --shadow-lg: 0 18px 40px -20px rgba(80, 105, 85, .5);
}
html[data-theme="lavande"] {
  --bg1: #f6f3fb; --bg2: #efeaf9; --bg3: #f9f1f7;
  --card: #fefdff; --card-2: #f7f4fd;
  --ink: #453f52; --ink-soft: #635b73; --muted: #9d95ac; --line: #e8e2f2;
  --accent: #b8a8e0; --accent-deep: #9179cf; --accent-soft: #ece5fa; --accent-ink: #5f4a91;
  --shadow: 0 10px 24px -14px rgba(95, 80, 130, .45);
  --shadow-lg: 0 18px 40px -20px rgba(95, 80, 130, .5);
}
html[data-theme="bleu"] {
  --bg1: #f0f6fa; --bg2: #e6f0f7; --bg3: #f2f6fb;
  --card: #fcfeff; --card-2: #f2f8fc;
  --ink: #3b4750; --ink-soft: #566670; --muted: #92a3ad; --line: #dfeaf1;
  --accent: #9cc6de; --accent-deep: #6aa5c6; --accent-soft: #e3f0f7; --accent-ink: #3f708c;
  --shadow: 0 10px 24px -14px rgba(70, 100, 120, .45);
  --shadow-lg: 0 18px 40px -20px rgba(70, 100, 120, .5);
}
html[data-theme="peche"] {
  --bg1: #fff4ee; --bg2: #ffeade; --bg3: #fdf3e9;
  --card: #fffdfb; --card-2: #fff6f0;
  --ink: #4d4139; --ink-soft: #6f6055; --muted: #ab998c; --line: #f6e5d9;
  --accent: #f2b795; --accent-deep: #dd8f66; --accent-soft: #fdeadd; --accent-ink: #96603c;
  --shadow: 0 10px 24px -14px rgba(140, 95, 65, .4);
  --shadow-lg: 0 18px 40px -20px rgba(140, 95, 65, .45);
}
html[data-theme="creme"] {
  --bg1: #fbf7f0; --bg2: #f6f0e6; --bg3: #f9f4ef;
  --card: #fffefb; --card-2: #faf6ee;
  --ink: #4a4438; --ink-soft: #6c6455; --muted: #a89e8c; --line: #eee6d8;
  --accent: #dcc7a4; --accent-deep: #c0a172; --accent-soft: #f3ead8; --accent-ink: #7d6740;
  --shadow: 0 10px 24px -14px rgba(120, 105, 75, .4);
  --shadow-lg: 0 18px 40px -20px rgba(120, 105, 75, .45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* l'attribut hidden doit toujours l'emporter sur nos display:flex */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Quicksand', ui-rounded, 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 10% 0%, var(--bg2) 0%, transparent 60%),
    radial-gradient(100% 60% at 90% 10%, var(--bg3) 0%, transparent 55%),
    var(--bg1);
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

/* le conteneur principal */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) 16px calc(96px + var(--safe-b)) 16px;
  min-height: 100%;
}

/* ══════════ EN-TÊTE ══════════ */
.header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

.avatar {
  width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 50%; border: none;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 25px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: transform .18s ease;
}
.avatar:active { transform: scale(.92); }

.header-text { flex: 1; min-width: 0; }
.brand {
  font-family: 'Baloo 2', 'Quicksand', sans-serif;
  font-size: 26px; margin: 0; line-height: 1.1; letter-spacing: .3px;
  color: var(--accent-ink);
}
.date { margin: 1px 0 0; font-size: 13px; color: var(--muted); text-transform: capitalize; }

.icon-btn {
  width: 42px; height: 42px; flex: 0 0 42px;
  border: none; border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .18s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.ghost { background: transparent; box-shadow: none; }

/* ══════════ PROGRESSION ══════════ */
.progress-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.progress-top { display: flex; align-items: baseline; justify-content: space-between; }
.progress-title { font-weight: 700; font-size: 17px; }
.progress-pct { font-weight: 700; color: var(--accent-deep); font-size: 15px; }
.progress-count { margin: 2px 0 12px; font-size: 14px; color: var(--ink-soft); }

.bar { height: 12px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-deep) 100%);
  transition: width .55s cubic-bezier(.22,.9,.3,1);
}
.cheer {
  margin: 12px 0 0; text-align: center; font-weight: 600; color: var(--accent-ink);
  animation: pop-in .5s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.85) translateY(6px); } to { opacity: 1; transform: none; } }

/* ══════════ CHIPS / FILTRES ══════════ */
.chips-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chips-row.wrap { flex-wrap: wrap; overflow: visible; }

.chip {
  flex: 0 0 auto; border: 1.5px solid transparent;
  background: var(--card); color: var(--ink-soft);
  border-radius: 99px; padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, background .2s ease, color .2s ease;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }

/* ══════════ LISTES ══════════ */
.lists { display: block; }
.block { margin-bottom: 18px; }
.block-title {
  font-size: 14px; font-weight: 700; color: var(--ink-soft);
  margin: 0 0 10px; padding-left: 4px; display: flex; align-items: center; gap: 8px;
}
.block-title.as-button {
  width: 100%; background: none; border: none; font-family: inherit; cursor: pointer;
  justify-content: space-between; padding: 4px;
}
.chev { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.block-title.as-button[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.pill {
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 700;
}

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-list.collapsed { display: none; }

/* ══════════ CARTE TÂCHE ══════════ */
.task {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 12px 12px 12px 14px;
  box-shadow: var(--shadow);
  position: relative;
  animation: slide-in .32s cubic-bezier(.2,.9,.3,1) both;
  touch-action: pan-y;
}
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.task.prio-high { box-shadow: var(--shadow), inset 3px 0 0 0 var(--accent-deep); }
.task.dragging { opacity: .95; box-shadow: var(--shadow-lg); transform: scale(1.03); z-index: 5; }
.task.drop-target { transform: translateY(2px); }

.check {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--accent); background: transparent;
  cursor: pointer; display: grid; place-items: center; padding: 0;
  transition: transform .2s cubic-bezier(.2,1.4,.4,1), background .2s ease, border-color .2s ease;
}
.check svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.5); transition: opacity .2s ease, transform .25s cubic-bezier(.2,1.5,.4,1); }
.check:active { transform: scale(.85); }
.task.done .check { background: var(--accent); border-color: var(--accent); }
.task.done .check svg { opacity: 1; transform: none; }

.task-emoji {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 14px;
  background: var(--card-2); display: grid; place-items: center;
  font-size: 21px; line-height: 1;
}
.task-main { flex: 1; min-width: 0; text-align: left; background: none; border: none; font: inherit; color: inherit; padding: 0; cursor: pointer; }
.task-name {
  font-weight: 600; font-size: 15.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .25s ease;
}
.task-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.tag { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tag.cat { color: var(--accent-ink); background: var(--accent-soft); border-radius: 99px; padding: 1px 8px; }

.task.done .task-name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.task.done .task-emoji { filter: saturate(.55); opacity: .75; }
.task.paused { opacity: .62; }
.task.paused .task-emoji { filter: grayscale(.6); }

.handle {
  flex: 0 0 30px; width: 30px; height: 38px; border: none; background: none;
  cursor: grab; display: grid; place-items: center; padding: 0;
  touch-action: none; color: var(--muted);
}
.handle svg { width: 16px; height: 16px; fill: currentColor; opacity: .55; }
.handle:active { cursor: grabbing; }

/* petite explosion d'étincelles au clic */
.spark { position: absolute; left: 20px; top: 50%; pointer-events: none; font-size: 15px; animation: spark-up .75s ease-out forwards; }
@keyframes spark-up {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -34px)) scale(1.15); }
}

.empty {
  text-align: center; color: var(--muted); font-size: 14px;
  background: var(--card-2); border: 1.5px dashed var(--line);
  border-radius: var(--radius); padding: 22px 16px; margin: 0;
}
.footnote { text-align: center; color: var(--muted); font-size: 12px; margin: 22px 0 0; }

/* ══════════ BARRE D'AJOUT ══════════ */
.addbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 9px;
  max-width: 560px; margin: 0 auto;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: linear-gradient(to top, var(--bg1) 62%, transparent);
}
.addbar-emoji, .addbar-more {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 16px; border: none;
  background: var(--card); box-shadow: var(--shadow-lg); font-size: 21px; cursor: pointer;
  display: grid; place-items: center; transition: transform .18s ease;
}
.addbar-emoji:active, .addbar-more:active { transform: scale(.9); }
.addbar-more { background: var(--accent); }
.addbar-more svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.addbar-input {
  flex: 1; min-width: 0; height: 46px; border-radius: 16px; border: none;
  background: var(--card); box-shadow: var(--shadow-lg);
  padding: 0 16px; font: inherit; font-size: 15px; color: var(--ink);
}
.addbar-input::placeholder { color: var(--muted); }
.addbar-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ══════════ FEUILLES (bottom sheets) ══════════ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(60, 45, 52, .28);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .2s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%; max-width: 560px;
  background: var(--bg1);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 40px -18px rgba(70, 50, 60, .5);
  padding: 8px 16px calc(18px + var(--safe-b));
  max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  animation: sheet-up .32s cubic-bezier(.2,.9,.3,1) both;
}
.sheet.tall { height: 88vh; height: 88dvh; display: flex; flex-direction: column; overflow: hidden; }
.sheet.closing { animation: sheet-down .22s ease both; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { from { transform: none; } to { transform: translateY(100%); } }

.sheet-handle { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-family: 'Baloo 2', 'Quicksand', sans-serif; font-size: 20px; margin: 0; color: var(--accent-ink); }
.sheet-body { padding-bottom: 4px; }

.field-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.emoji-slot {
  flex: 0 0 54px; width: 54px; height: 54px; border-radius: 18px; border: 1.5px dashed var(--line);
  background: var(--card); font-size: 26px; cursor: pointer; display: grid; place-items: center;
  transition: transform .18s ease;
}
.emoji-slot:active { transform: scale(.92); }
.text-input {
  flex: 1; min-width: 0; height: 54px; border-radius: 18px; border: 1.5px solid transparent;
  background: var(--card); padding: 0 16px; font: inherit; font-size: 16px; color: var(--ink);
}
.text-input:focus { outline: none; border-color: var(--accent); }
.text-input::placeholder { color: var(--muted); }

.field-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 16px 0 8px; padding-left: 4px; }

.seg { display: flex; gap: 8px; background: var(--card-2); border-radius: 16px; padding: 5px; }
.seg-btn {
  flex: 1; border: none; background: transparent; border-radius: 12px;
  padding: 9px 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; transition: background .2s ease, color .2s ease, transform .15s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg-btn:active { transform: scale(.96); }
.seg-btn.on { background: var(--card); color: var(--accent-ink); box-shadow: var(--shadow); }

.days-row { display: flex; gap: 6px; margin-top: 10px; }
.day-btn {
  flex: 1; aspect-ratio: 1 / 1; border-radius: 14px; border: 1.5px solid transparent;
  background: var(--card); color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: transform .15s ease, background .2s ease;
}
.day-btn:active { transform: scale(.92); }
.day-btn.on { background: var(--accent); color: #fff; }

.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.btn-primary {
  flex: 1; height: 52px; border: none; border-radius: 18px;
  background: var(--accent); color: #fff; font: inherit; font-size: 16px; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow-lg); transition: transform .16s ease, filter .2s ease;
}
.btn-primary:active { transform: scale(.97); filter: brightness(.96); }
.btn-danger {
  height: 52px; border: none; border-radius: 18px; padding: 0 18px;
  background: var(--card); color: #c4707f; font: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow);
}
.btn-danger.wide { width: 100%; margin-top: 10px; }
.btn-soft {
  flex: 1; height: 46px; border: none; border-radius: 16px;
  background: var(--card); color: var(--ink-soft); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow);
}
.btn-pause {
  width: 100%; height: 46px; margin-top: 14px; border: none; border-radius: 16px;
  background: var(--card-2); color: var(--ink-soft); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ══════════ SÉLECTEUR D'EMOJIS ══════════ */
.emoji-search { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.search-ico { position: absolute; margin-left: 14px; font-size: 14px; pointer-events: none; }
.emoji-search input {
  flex: 1; min-width: 0; height: 46px; border-radius: 16px; border: 1.5px solid transparent;
  background: var(--card); padding: 0 14px 0 38px; font: inherit; font-size: 15px; color: var(--ink);
  -webkit-appearance: none;
}
.emoji-search input:focus { outline: none; border-color: var(--accent); }
.btn-none {
  flex: 0 0 auto; height: 46px; padding: 0 14px; border-radius: 16px; border: none;
  background: var(--card); color: var(--ink-soft); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow);
}
.emoji-tabs { padding-bottom: 8px; }
.emoji-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
.emoji-group-title { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; padding-left: 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; }
.emoji-cell {
  aspect-ratio: 1 / 1; border: none; background: transparent; border-radius: 14px;
  font-size: 24px; line-height: 1; cursor: pointer; display: grid; place-items: center;
  position: relative; transition: transform .15s ease, background .2s ease;
}
.emoji-cell:active { transform: scale(.86); background: var(--accent-soft); }
.emoji-cell.fav::after { content: '⭐'; position: absolute; right: 2px; top: 1px; font-size: 9px; }
.emoji-hint { text-align: center; font-size: 11.5px; color: var(--muted); margin: 6px 0 0; }
.emoji-none-note { font-size: 13px; color: var(--muted); padding: 6px 4px; }

/* ══════════ RÉGLAGES ══════════ */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card {
  border: 2px solid transparent; border-radius: 18px; background: var(--card);
  padding: 12px 6px 10px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); box-shadow: var(--shadow); display: grid; gap: 6px; justify-items: center;
  transition: transform .15s ease;
}
.theme-card:active { transform: scale(.95); }
.theme-card.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.swatch { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); }
.avatar-row { display: flex; align-items: center; gap: 12px; }
.hint { font-size: 12.5px; color: var(--muted); }
.hint.center { text-align: center; display: block; margin-top: 18px; }
.data-row { display: flex; gap: 10px; }

/* ══════════ TOAST + CONFETTIS ══════════ */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 99px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; z-index: 80; box-shadow: var(--shadow-lg);
  animation: toast-in .28s cubic-bezier(.2,1.2,.4,1) both; max-width: 90vw; text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti span {
  position: absolute; top: -8vh; font-size: 22px;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { opacity: 0; transform: translateY(0) rotate(0deg); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translateY(110vh) rotate(var(--spin, 220deg)); }
}

/* ══════════ ÉCRANS PLUS LARGES ══════════ */
@media (min-width: 620px) {
  .app { padding-top: 28px; }
  .brand { font-size: 30px; }
  .addbar { border-radius: 24px 24px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ══════════ AJUSTEMENTS ══════════ */
.emoji-search { position: relative; }
.wide-soft { width: 100%; margin-top: 10px; }
.btn-soft.collapsed { display: none; }
.task-main:focus-visible, .check:focus-visible, .chip:focus-visible, .emoji-cell:focus-visible {
  outline: 2px solid var(--accent-deep); outline-offset: 2px;
}

/* zone de toucher confortable pour la petite case à cocher */
.check { position: relative; }
.check::before { content: ''; position: absolute; inset: -10px; border-radius: 50%; }

/* ══════════ FERMETURE DES FEUILLES ══════════ */
.sheet-close-bottom {
  width: 100%; margin: 16px 0 4px; height: 48px;
  border: none; border-radius: 16px;
  background: var(--card-2); color: var(--ink-soft);
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow);
}
.sheet-close-bottom:active { transform: scale(.97); }
.sheet.tall .sheet-close-bottom { flex: 0 0 auto; margin-top: 8px; }
/* la poignée devient une vraie zone de préhension (glisser vers le bas pour fermer) */
.sheet-handle { touch-action: none; cursor: grab; padding: 0; }
.sheet-grab { padding: 10px 0 6px; margin: -6px 0 4px; touch-action: none; }
.sheet-grab .sheet-handle { margin: 0 auto; }

/* ══════════ SEMAINE EN COURS ══════════ */
.week-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
  margin: 0 0 14px;
}
.week-day {
  position: relative; border: 1.5px solid transparent; border-radius: 16px;
  background: var(--card); box-shadow: var(--shadow);
  padding: 8px 2px 9px; cursor: pointer; font: inherit;
  display: grid; gap: 1px; justify-items: center;
  transition: transform .15s ease, background .25s ease, border-color .25s ease;
}
.week-day:active { transform: scale(.93); }
.week-day .wd-letter { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.week-day .wd-num { font-size: 15px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.week-day .wd-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  margin-top: 2px; opacity: .75;
}
.week-day .wd-dot.empty { background: transparent; }
.week-day.today { background: var(--accent-soft); border-color: var(--accent); }
.week-day.today .wd-letter { color: var(--accent-ink); }
.week-day.today .wd-num { color: var(--accent-ink); }
.week-day.selected { border-color: var(--accent-deep); }
.week-day.past { opacity: .72; }

/* bandeau d'aperçu d'un autre jour */
.day-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card-2); border: 1.5px dashed var(--line);
  border-radius: var(--radius); padding: 10px 12px 10px 16px; margin-bottom: 14px;
  font-size: 14px; font-weight: 600; color: var(--ink-soft);
}
.btn-today {
  flex: 0 0 auto; border: none; border-radius: 12px; padding: 8px 14px;
  background: var(--accent); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn-today:active { transform: scale(.95); }

/* en aperçu, on ne peut pas cocher une autre journée */
.task.readonly .check { opacity: .45; pointer-events: none; }

/* ══════════ VALIDATION D'UNE TÂCHE ══════════ */
@keyframes card-pop {
  0%   { transform: none; }
  30%  { transform: scale(1.035); }
  100% { transform: none; }
}
.task.just-done {
  animation: card-pop .45s cubic-bezier(.2,1.2,.4,1) both;
  background: var(--accent-soft);
}
.spark { font-size: 17px; z-index: 3; will-change: transform, opacity; }

/* mouvement réduit : on garde un retour visuel court, sans envol d'étincelles */
@media (prefers-reduced-motion: reduce) {
  .task.just-done { animation: none !important; transition: background .22s ease !important; }
  .spark { display: none !important; }
  .check svg { transition: opacity .18s ease !important; }
  .bar-fill { transition: width .25s ease !important; }
}

/* ══════════ BASCULE TÂCHES / COURSES ══════════ */
.view-switch {
  display: flex; gap: 6px; padding: 5px;
  background: var(--card-2); border-radius: 18px; margin-bottom: 16px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.03);
}
.view-btn {
  flex: 1; border: none; background: transparent; border-radius: 14px;
  padding: 11px 8px; font: inherit; font-size: 14px; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: background .22s ease, color .22s ease, transform .15s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.view-btn:active { transform: scale(.97); }
.view-btn.on { background: var(--card); color: var(--accent-ink); box-shadow: var(--shadow); }

/* champ pleine largeur (quantité) */
.text-input.full { width: 100%; }

/* quantité affichée sur la carte d'un article */
.qty {
  flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 99px; padding: 2px 9px; margin-left: 8px;
}

/* semaine affichée dans la vue Courses : informative, non cliquable */
.week-day.static { cursor: default; }
.week-day.static:active { transform: none; }
.shop-date {
  margin: -4px 0 14px; text-align: center;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  text-transform: capitalize;
}

/* ══════════ CALENDRIER ══════════ */
.cal {
  background: var(--card); border-radius: var(--radius);
  padding: 10px 10px 12px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.cal-nav {
  flex: 0 0 38px; width: 38px; height: 38px; border: none; border-radius: 12px;
  background: transparent; cursor: pointer; display: grid; place-items: center;
  transition: background .2s ease, transform .15s ease;
}
.cal-nav:active { transform: scale(.88); background: var(--accent-soft); }
.cal-nav svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cal-title {
  flex: 1; border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px; border-radius: 12px; text-transform: capitalize;
}
.cal-title:active { background: var(--accent-soft); }
.cal-title .chev { stroke: var(--accent-deep); }
.cal-title[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* la bande de la semaine vit maintenant dans la carte calendrier */
.cal .week-row { margin-bottom: 0; }

.month { margin-top: 10px; animation: month-in .25s ease both; }
@keyframes month-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.month-dow, .month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-dow { margin-bottom: 4px; }
.month-dow span {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.month-cell {
  position: relative; aspect-ratio: 1 / 1; border: 1.5px solid transparent; border-radius: 12px;
  background: transparent; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); display: grid; place-items: center; padding: 0;
  font-variant-numeric: tabular-nums;
  transition: background .2s ease, transform .15s ease, border-color .2s ease;
}
.month-cell:active { transform: scale(.9); }
.month-cell.out { color: var(--line); }
.month-cell.today { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.month-cell.selected { border-color: var(--accent-deep); }
.month-cell.has::after {
  content: ''; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: .8;
}
.month-cell.today.has::after { background: var(--accent-deep); }

.cal-today {
  width: 100%; margin-top: 10px; border: none; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent-ink);
  font: inherit; font-size: 13.5px; font-weight: 700; padding: 10px; cursor: pointer;
}
.cal-today:active { transform: scale(.97); }
