/* =========================================================
   Canopy — styles
   Mobile-first · sobre · clair / sombre automatique
   ========================================================= */

:root {
  --bg: #F4F4F1;
  --bg-blur: rgba(244, 244, 241, .84);
  --surface: #FFFFFF;
  --surface-2: #EEEEEA;
  --surface-3: #FFFFFF;
  --text: #161816;
  --text-2: #61655F;
  --text-3: #9DA19A;
  --border: #E5E5DF;
  --border-2: #D3D3CB;
  --accent: #2D7A55;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EFE8;
  --danger: #C4432E;
  --danger-soft: #FAE8E4;
  --warn: #AD6F12;
  --warn-soft: #F8EEDB;
  --toast-act: #86D9AE;

  --st-clone: #5FAFC4;
  --st-veg: #3E9A67;
  --st-flower: #D08C34;
  --st-dry: #9A8470;

  --r: 16px;
  --tab-h: 58px;
  --kb: 0px;
  --shadow-lg: 0 10px 30px rgba(18, 28, 20, .16), 0 2px 8px rgba(18, 28, 20, .08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0E0D;
    --bg-blur: rgba(13, 14, 13, .82);
    --surface: #171917;
    --surface-2: #222522;
    --surface-3: #2E322E;
    --text: #ECEEEA;
    --text-2: #A2A79F;
    --text-3: #6A6F68;
    --border: #252825;
    --border-2: #363A36;
    --accent: #5DC08E;
    --accent-ink: #06120B;
    --accent-soft: rgba(93, 192, 142, .14);
    --danger: #F07C66;
    --danger-soft: rgba(240, 124, 102, .14);
    --warn: #E5AB4C;
    --warn-soft: rgba(229, 171, 76, .14);
    --toast-act: #2D7A55;
    --st-clone: #6CBCD1;
    --st-veg: #4FB07A;
    --st-flower: #E09D45;
    --st-dry: #A89380;
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
html.locked, html.locked body { overflow: hidden; }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 600px; margin: 0 auto; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 100px); }
#view.enter { animation: enter .28s ease; }
@keyframes enter { from { opacity: 0; } to { opacity: 1; } }

/* ---------- En-tête ---------- */
.top {
  position: sticky; top: 0; z-index: 15;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 12px;
  background: var(--bg-blur);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}
.top-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 3px; }
.top .seg, .top .chips { margin-top: 14px; }
.top .chips.scroll { margin: 14px -20px 0; padding: 2px 20px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: var(--text-2);
  transition: background .15s;
}
.icon-btn:active { background: var(--surface-2); }
.top .icon-btn { background: var(--surface); border: 1px solid var(--border); }

.view { padding: 4px 16px 0; }

/* ---------- Sections ---------- */
.sec { margin-top: 28px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px 10px; min-height: 28px; }
.sec-h h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.link { display: inline-flex; align-items: center; gap: 1px; padding: 4px 0; font-size: 14.5px; font-weight: 550; color: var(--accent); }
.link .i { width: 16px; height: 16px; }
.muted { color: var(--text-2); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Tuiles de synthèse ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  display: flex; flex-direction: column; min-height: 116px; padding: 13px 14px 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  text-align: left; transition: transform .15s;
}
.stat:active { transform: scale(.98); }
.stat-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stat .l { font-size: 13px; font-weight: 550; color: var(--text-2); }
.stat-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.stat-ic .i { width: 16px; height: 16px; }
.stat .n { margin-top: auto; padding-top: 8px; font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .n small { font-size: 17px; font-weight: 600; color: var(--text-3); margin-left: 1px; letter-spacing: 0; }
.stat .s { margin-top: 3px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.ok .stat-ic { background: var(--accent-soft); color: var(--accent); }
.stat.alert .stat-ic { background: var(--danger-soft); color: var(--danger); }
.stat.alert .n { color: var(--danger); }
.stat.warn .stat-ic { background: var(--warn-soft); color: var(--warn); }
.mini { display: block; height: 4px; margin-top: 7px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.mini i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width .4s ease; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-top: 4px; }
.kpis div { padding: 12px 14px; display: flex; flex-direction: column; gap: 1px; }
.kpis div + div { border-left: 1px solid var(--border); }
.kpis b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpis span { font-size: 12px; color: var(--text-2); }

/* ---------- Listes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.row {
  --inset: 52px;
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 58px; padding: 10px 14px; text-align: left;
  transition: background .15s;
}
button.row:active { background: var(--surface-2); }
.list > .row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset); height: 1px; background: var(--border); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 2px 0; text-align: left; }
.row-title { font-size: 15.5px; font-weight: 530; line-height: 1.3; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; font-size: 13px; color: var(--text-2); }
.meta > span { display: inline-flex; align-items: center; gap: 4px; }
.meta .i { width: 13px; height: 13px; }
.due.late { color: var(--danger); font-weight: 600; }
.due.today { color: var(--accent); font-weight: 600; }

.av {
  --c: var(--text-3);
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #fff; background: var(--c);
}
.av .i { width: 11px; height: 11px; stroke-width: 2.4; }
.av.lg { width: 38px; height: 38px; font-size: 15px; }

/* Tâche */
.check {
  position: relative; flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border-2); color: transparent;
  display: grid; place-items: center; transition: background .2s, border-color .2s, color .2s;
}
.check::after { content: ""; position: absolute; inset: -12px; }
.check .i { width: 14px; height: 14px; stroke-width: 3; }
.check.hi { border-color: var(--danger); }
.task.done .check, .task.completing .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task.done .row-title, .task.completing .row-title { color: var(--text-3); text-decoration: line-through; }
.task.completing { animation: fadeout .28s ease forwards .05s; }
@keyframes fadeout { to { opacity: .35; } }
.flag { color: var(--danger); display: grid; }
.flag .i { width: 16px; height: 16px; }

/* Événement */
.ev { --inset: 70px; }
.ev-time { width: 44px; flex: none; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ev-bar { width: 4px; align-self: stretch; margin: 3px 0; border-radius: 2px; flex: none; }
.ev.past { opacity: .5; }
.ms { --inset: 56px; }
.ms-ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c);
}
.ms-ic .i { width: 17px; height: 17px; }

/* Achat */
.buy { --inset: 54px; }
.bstat {
  position: relative; flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border-2); display: grid; place-items: center; transition: all .2s;
}
.bstat::after { content: ""; position: absolute; inset: -10px; }
.bstat .i { width: 14px; height: 14px; stroke-width: 2.5; }
.bstat.ordered { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.bstat.received { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.buy.received .row-title { color: var(--text-2); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  font-size: 11.5px; font-weight: 650; background: var(--surface-2); color: var(--text-2);
}
.tag .i { width: 12px; height: 12px; stroke-width: 2.6; }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.ok { background: var(--accent-soft); color: var(--accent); }

.grp-h {
  display: flex; align-items: center; gap: 8px; margin: 22px 4px 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2);
}
.grp-h span { color: var(--text-3); font-weight: 600; }
.grp-h.late { color: var(--danger); }
.sub-h { margin: 18px 4px 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.grp-toggle { display: flex; align-items: center; gap: 6px; margin: 24px 4px 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.grp-toggle span { color: var(--text-3); }
.grp-toggle .i { width: 16px; height: 16px; }

/* ---------- Saisie rapide ---------- */
.quick {
  display: flex; align-items: center; gap: 8px; margin: 4px 0 6px;
  padding: 4px 4px 4px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s;
}
.quick:focus-within { border-color: var(--accent); }
.quick input { flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: 0; background: none; font-size: 16px; }
.quick input::placeholder { color: var(--text-3); }
.quick button { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; }
.hint { margin: 0 4px 4px; font-size: 12.5px; color: var(--text-3); }

/* ---------- Cultures ---------- */
.batch { display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 14px; text-align: left; transition: transform .15s; }
.batch:active { transform: scale(.99); }
.b-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.b-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.b-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.b-id .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage {
  --c: var(--text-3);
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 650;
  background: color-mix(in srgb, var(--c) 15%, transparent);
  color: color-mix(in srgb, var(--c) 70%, var(--text));
}
.stage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.stagebar { display: flex; gap: 3px; height: 8px; }
.stagebar span { --c: var(--text-3); height: 100%; border-radius: 3px; overflow: hidden; background: color-mix(in srgb, var(--c) 20%, transparent); }
.stagebar i { display: block; height: 100%; background: var(--c); }
.b-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); }
.b-foot b { color: var(--text); font-weight: 650; }

.hscroll {
  display: flex; gap: 10px; margin: 0 -16px; padding: 0 16px 2px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: 0 0 80%; max-width: 310px; scroll-snap-align: start; }

/* Rotation (Gantt) */
.gantt { overflow: hidden; }
.g-scroll { overflow-x: auto; scrollbar-width: none; }
.g-scroll::-webkit-scrollbar { display: none; }
.g-inner { position: relative; }
.g-head, .g-row { display: flex; align-items: center; height: 42px; }
.g-head { height: 32px; }
.g-row { cursor: pointer; }
.g-lab {
  position: sticky; left: 0; z-index: 3; flex: none; width: 84px; height: 100%;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  padding: 0 10px 0 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.g-lab b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-lab span { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-axis, .g-track { position: relative; flex: none; height: 100%; }
.g-track { overflow: hidden; }
.g-track i { position: absolute; top: 13px; height: 16px; border-radius: 4px; }
.g-axis em { position: absolute; top: 9px; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-size: 11px; font-weight: 650; color: var(--text-2); }
.g-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.g-now { position: absolute; top: 26px; bottom: 0; z-index: 2; width: 2px; border-radius: 1px; background: var(--danger); }
.g-now::before {
  content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}
.legend .now { width: 2px; height: 12px; border-radius: 1px; background: var(--danger); display: inline-block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- Agenda ---------- */
.week-nav { display: flex; align-items: center; gap: 2px; margin: 2px 0 8px; }
.week-nav .month { margin-right: auto; padding-left: 4px; font-size: 15px; font-weight: 650; }
.week-nav .month span { color: var(--text-3); font-weight: 600; }
.week-nav .link { margin-right: 6px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; touch-action: pan-y; }
.day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 14px; }
.day .dw { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: capitalize; }
.day .dn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; transition: background .15s; }
.day.is-today .dn { color: var(--accent); }
.day.on .dn { background: var(--text); color: var(--bg); }
.day.on.is-today .dn { background: var(--accent); color: var(--accent-ink); }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; }
.d-ev { background: var(--accent); }
.d-tk { background: var(--text-3); }
.d-ms { background: var(--st-flower); }
.day-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 20px 4px 0; }
.day-h h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.day-h + .empty { margin-top: 12px; }

/* ---------- Contrôles ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg button { padding: 8px 4px; border-radius: 9px; text-align: center; font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: background .2s, color .2s; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.seg .cnt { color: var(--text-3); font-weight: 600; margin-left: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 36px; padding: 0 13px; border-radius: 999px; white-space: nowrap;
  font-size: 14px; font-weight: 550; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
}
.chip .cnt { font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip.on .av { box-shadow: 0 0 0 1.5px var(--bg); }

.search { display: flex; align-items: center; gap: 8px; margin: 14px 0 12px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-3); }
.search input { flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); -webkit-appearance: none; appearance: none; }
.search .i { width: 18px; height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 18px; border-radius: 14px;
  font-size: 16px; font-weight: 650; white-space: nowrap;
  transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 36px; padding: 0 13px; border-radius: 11px; font-size: 14px; }
.btn.sm .i { width: 16px; height: 16px; }
.btn.grow { flex: 1; }
.btn.icon { width: 50px; padding: 0; }
.btn.block { display: flex; width: 100%; margin-top: 16px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 20px; text-align: center; font-size: 14px; color: var(--text-2);
  border: 1px dashed var(--border-2); border-radius: var(--r);
}
.empty > .i { width: 22px; height: 22px; color: var(--text-3); }

/* Achats */
.summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; padding: 16px; }
.big { margin: 1px 0 2px; font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.summary .eyebrow { margin: 0; }

/* Idées */
.capture { margin: 4px 0 0; padding: 12px 12px 10px 14px; transition: border-color .15s; }
.capture:focus-within { border-color: var(--accent); }
.capture textarea { width: 100%; min-height: 46px; border: 0; outline: 0; resize: none; background: none; font-size: 16px; line-height: 1.45; }
.capture textarea::placeholder { color: var(--text-3); }
.capture-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.idea { display: block; padding: 14px 14px 8px; cursor: pointer; transition: transform .15s; }
.idea:active { transform: scale(.99); }
.idea p {
  font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.idea.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.idea-f { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.idea-f .sp { flex: 1; }
.pin { width: 36px; height: 36px; margin-right: -8px; border-radius: 10px; display: grid; place-items: center; color: var(--text-3); }
.pin .i { width: 17px; height: 17px; }
.pin.on { color: var(--accent); }
.pin.on .i { fill: currentColor; }

/* ---------- Barre d'onglets & bouton + ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-blur); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 600px; height: var(--tab-h); margin: 0 auto; }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--text-3); transition: color .15s; }
.tab .i { width: 23px; height: 23px; }
.tab.on { color: var(--accent); }
.badge {
  position: absolute; top: 5px; left: calc(50% + 5px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center; border: 2px solid var(--bg);
  font-size: 10px; font-weight: 700; color: #fff; background: var(--danger);
}

.fab {
  position: fixed; z-index: 25;
  right: max(16px, calc(50% - 300px + 16px));
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
  width: 58px; height: 58px; border-radius: 20px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .2s;
}
.fab:active { transform: scale(.93); }
.fab .i { width: 26px; height: 26px; stroke-width: 2.4; }

.toast {
  position: fixed; z-index: 60;
  left: max(16px, calc(50% - 284px));
  right: max(90px, calc(50% - 284px + 74px));
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 17px);
  min-height: 52px; display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 550;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .2s, transform .25s;
}
.toast.on { opacity: 1; transform: none; pointer-events: auto; }
.toast span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { flex: none; padding: 9px 12px; border-radius: 10px; font-weight: 700; color: var(--toast-act); }

/* ---------- Feuille (bottom sheet) ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .38); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: var(--kb);
  max-width: 600px; margin: 0 auto;
  max-height: calc(100dvh - var(--kb) - 36px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(110%); visibility: hidden;
  transition: transform .34s cubic-bezier(.32, .72, 0, 1), visibility 0s linear .34s;
}
.sheet.on { transform: none; visibility: visible; transition: transform .34s cubic-bezier(.32, .72, 0, 1), visibility 0s; }
.sheet-head { flex: none; padding: 8px 16px 2px; touch-action: none; }
.grab { width: 38px; height: 5px; margin: 0 auto 4px; border-radius: 3px; background: var(--border-2); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.sheet-title { font-size: 17px; font-weight: 700; }
.types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 4px 0 2px; }
.type {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 0 9px;
  border-radius: 13px; background: var(--surface-2);
  font-size: 12px; font-weight: 650; color: var(--text-2); transition: background .15s, color .15s;
}
.type .i { width: 19px; height: 19px; }
.type.on { background: var(--text); color: var(--bg); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 22px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }

.title-input {
  display: block; width: 100%; padding: 14px 0 8px;
  border: 0; border-bottom: 1px solid var(--border); outline: 0; background: none;
  font-size: 21px; font-weight: 650; letter-spacing: -.01em;
}
.title-input:focus { border-bottom-color: var(--accent); }
.title-input::placeholder { color: var(--text-3); }
textarea.title-input { resize: none; font-size: 18px; font-weight: 550; line-height: 1.4; }
.field { display: block; margin-top: 18px; }
.flabel { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.input {
  width: 100%; min-height: 46px; padding: 11px 13px;
  border: 1px solid transparent; border-radius: 12px; outline: 0;
  background: var(--surface-2); font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--accent); background: var(--surface); }
textarea.input { resize: none; line-height: 1.45; }
.sheet .chip { background: var(--surface-2); border-color: transparent; }
.sheet .chip.on { background: var(--text); color: var(--bg); }
.date-chip { width: auto; min-width: 128px; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 550; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2.tight { gap: 8px; }
.phase span { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.switch-row { position: relative; display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 550; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--border-2); transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.preview { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 13.5px; }
.preview div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.preview span { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.preview b { font-weight: 650; }
.members { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.member { display: flex; align-items: center; gap: 10px; }
.note { margin-bottom: 10px; font-size: 13.5px; color: var(--text-2); }
.note b { display: inline-block; margin-top: 4px; font-weight: 600; color: var(--text); }
.lead { margin: 6px 0 16px; font-size: 16px; color: var(--text-2); }
.callout { display: flex; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); font-size: 13.5px; line-height: 1.45; }
.callout .i { width: 18px; height: 18px; margin-top: 1px; color: var(--warn); }
.version { margin-top: 22px; text-align: center; font-size: 12px; color: var(--text-3); }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-col .btn { justify-content: flex-start; font-size: 15px; font-weight: 600; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

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