/* ---------- Tokens ---------- */
:root {
  --bg: #07080f;
  --bg-2: #0c0e1a;
  --ink: #f4f5fb;
  --ink-2: #b7bbd3;
  --ink-3: #7c819e;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --glass: rgba(20, 23, 40, 0.55);
  --glass-2: rgba(28, 32, 54, 0.65);

  --todo: #8ea2ff;
  --todo-bg: rgba(122, 142, 255, 0.14);
  --waiting: #ffb547;
  --waiting-bg: rgba(255, 181, 71, 0.14);
  --needs: #ff4d7d;
  --needs-bg: rgba(255, 77, 125, 0.16);
  --done: #3ee6a0;
  --done-bg: rgba(62, 230, 160, 0.13);

  --accent: #8b7bff;
  --accent-2: #3fd0ff;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.8);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 10px; }

/* ---------- Backdrop ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: radial-gradient(120% 80% at 50% -10%, #151a36 0%, var(--bg) 60%); }
.glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; will-change: transform; }
.glow-a { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax;
  background: radial-gradient(circle, rgba(139, 123, 255, 0.55), transparent 65%);
  animation: drift-a 22s ease-in-out infinite alternate; }
.glow-b { width: 60vmax; height: 60vmax; right: -25vmax; top: 10vh;
  background: radial-gradient(circle, rgba(63, 208, 255, 0.35), transparent 65%);
  animation: drift-b 26s ease-in-out infinite alternate; }
.glow-c { width: 55vmax; height: 55vmax; left: 10vw; bottom: -35vmax;
  background: radial-gradient(circle, rgba(255, 77, 125, 0.28), transparent 65%);
  animation: drift-c 30s ease-in-out infinite alternate; }
.grain { position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes drift-a { to { transform: translate(12vw, 10vh) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-14vw, 14vh) scale(0.9); } }
@keyframes drift-c { to { transform: translate(10vw, -12vh) scale(1.15); } }

/* ---------- Shell ---------- */
.shell {
  position: relative; z-index: 1;
  max-width: 1480px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) calc(env(safe-area-inset-right, 0px) + 16px)
           calc(env(safe-area-inset-bottom, 0px) + 28px) calc(env(safe-area-inset-left, 0px) + 16px);
}
.can-edit .shell { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); }

/* ---------- Entrance ---------- */
.reveal { animation: rise 0.7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); filter: blur(4px); }
                  to { opacity: 1; transform: none; filter: none; } }
.settled .reveal { animation: none; }

/* ---------- Masthead ---------- */
.masthead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.title {
  font-size: clamp(34px, 9vw, 52px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02;
  background: linear-gradient(100deg, #fff 0%, #e2e0ff 40%, #9fe8ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.asof { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2);
  padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--done); box-shadow: 0 0 0 0 rgba(62,230,160,0.6); animation: ping 2.4s ease-out infinite; }
.asof.is-stale .live-dot { background: var(--waiting); animation: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(62,230,160,0.55); } 80%,100% { box-shadow: 0 0 0 9px rgba(62,230,160,0); } }

/* ---------- Layout ---------- */
.top { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-bottom: 18px; }
.stage { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.main { min-width: 0; }
@media (min-width: 900px) {
  .top { grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); gap: 18px 22px; align-items: stretch; margin-bottom: 26px; }
}
@media (min-width: 1200px) {
  .stage { grid-template-columns: minmax(0, 1fr) 340px; gap: 26px; }
  .can-edit .feed { padding-bottom: 84px; }
  .feed { position: sticky; top: 18px; max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
}

/* ---------- Panels ---------- */
.panel {
  position: relative; border-radius: var(--r-lg); padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)), var(--glass);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.pill-muted { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); }

/* ---------- Hero / ring ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 220px; height: 220px; left: -60px; top: -60px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,123,255,0.28), transparent 70%); pointer-events: none; }
.ring-wrap { position: relative; width: 136px; height: 136px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(255,255,255,0.07); stroke-width: 11; }
.ring-bar { fill: none; stroke: url(#ringGrad); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 364.42; stroke-dashoffset: 364.42; transition: stroke-dashoffset 1.6s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-pct { font-size: 36px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.ring-pct small { font-size: 16px; font-weight: 700; color: var(--ink-2); margin-left: 1px; }
.ring-sub { font-size: 12px; color: var(--ink-3); margin-top: 5px; font-weight: 500; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 11px; border-radius: var(--r-sm);
  background: rgba(255,255,255,0.035); border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); box-shadow: 0 0 12px var(--c); }
.stat b { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat span { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.stat.s-needs_you.has b { color: var(--needs); text-shadow: 0 0 18px rgba(255,77,125,0.6); }
/* Phones: tighten the ring + stat tiles so every label ("NEEDS YOU") fits on one line down to 360px */
@media (max-width: 440px) {
  .hero { gap: 12px; padding: 16px 14px; }
  .ring-wrap { width: 112px; height: 112px; }
  .ring-pct { font-size: 30px; }
  .ring-pct small { font-size: 14px; }
  .ring-sub { font-size: 11px; margin-top: 4px; }
  .stats { gap: 6px; }
  .stat { padding: 9px 6px 9px 10px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 10px; letter-spacing: 0.02em; }
}
@media (max-width: 359px) { .hero { grid-template-columns: 1fr; justify-items: center; } .stats { width: 100%; } }

/* ---------- Waiting on you ---------- */
.wou { position: relative; border-radius: var(--r-lg); padding: 1.5px; isolation: isolate; overflow: hidden;
  background: linear-gradient(135deg, rgba(255,77,125,0.9), rgba(139,123,255,0.9) 50%, rgba(63,208,255,0.9));
  box-shadow: 0 0 0 1px rgba(255,77,125,0.15), 0 18px 50px -18px rgba(255,77,125,0.55), 0 10px 60px -30px rgba(139,123,255,0.8); }
.wou::before { content: ""; position: absolute; inset: -60%; z-index: -1;
  background: conic-gradient(from 0deg, #ff4d7d, #8b7bff, #3fd0ff, #ffb547, #ff4d7d);
  animation: spin 7s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.wou-inner { position: relative; border-radius: calc(var(--r-lg) - 1.5px); padding: 18px;
  background: radial-gradient(120% 100% at 0% 0%, rgba(255,77,125,0.20), transparent 55%), linear-gradient(180deg, #161328, #0e0f1d); }
.wou-spark { width: 10px; height: 10px; border-radius: 50%; background: var(--needs); box-shadow: 0 0 0 0 rgba(255,77,125,0.7), 0 0 12px var(--needs); animation: ping-red 1.8s ease-out infinite; }
@keyframes ping-red { 0% { box-shadow: 0 0 0 0 rgba(255,77,125,0.6), 0 0 12px var(--needs); } 80%,100% { box-shadow: 0 0 0 10px rgba(255,77,125,0), 0 0 12px var(--needs); } }
.wou-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wou-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 60px;
  padding: 10px 10px 10px 12px; border-radius: var(--r-md); background: rgba(255,255,255,0.045); border: 1px solid var(--line);
  transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s; }
.wou-item.is-quiet { opacity: 0.72; }
.wou-item.is-quiet .avatar { filter: saturate(0.4); }
.wou-who { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.wou-what { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-top: 1px; overflow-wrap: anywhere; }
.wou-since { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.wou-empty { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-md); background: rgba(62,230,160,0.07); border: 1px dashed rgba(62,230,160,0.35); color: var(--ink-2); }
.wou-empty b { color: var(--ink); display: block; }
.wou-empty .emoji { font-size: 26px; }

/* ---------- Avatars / buttons ---------- */
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 85% 62%), hsl(calc(var(--h) + 40) 80% 48%));
  box-shadow: 0 6px 16px -6px hsl(var(--h) 85% 50% / 0.7), inset 0 1px 0 rgba(255,255,255,0.3); flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px;
  border-radius: 12px; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
  color: #fff; border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(135deg, rgba(139,123,255,0.9), rgba(63,208,255,0.85));
  box-shadow: 0 8px 20px -10px rgba(99,140,255,0.9), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.2s var(--spring), box-shadow 0.2s, filter 0.2s;
}
.btn svg { width: 14px; height: 14px; }
.btn-ghost { background: rgba(255,255,255,0.06); box-shadow: none; color: var(--ink); }
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); filter: brightness(1.1); box-shadow: 0 12px 26px -10px rgba(99,140,255,1), inset 0 1px 0 rgba(255,255,255,0.35); }
  .btn-ghost:hover { background: rgba(255,255,255,0.1); box-shadow: none; }
  .wou-item:hover { background: rgba(255,255,255,0.07); border-color: var(--line-2); }
}
.btn:active { transform: scale(0.94); filter: brightness(0.95); transition-duration: 0.08s; }

/* ---------- Filters ---------- */
/* Sticky chip bar: fully transparent in flow; once stuck, a blurred scrim fades in on a pseudo-element
   whose mask feathers the bottom edge, so there is never a hard seam against the backdrop. */
.filters-sentinel { display: block; height: 1px; margin-bottom: -1px; }
.filters { position: sticky; top: 0; z-index: 5; isolation: isolate; margin: 0 -16px 12px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px; }
.filters::before { content: ""; position: absolute; inset: 0 0 -22px 0; z-index: -1; pointer-events: none;
  /* Solid dark glass behind the chips themselves; only the 22px overhang below the bar feathers out. */
  background: linear-gradient(180deg, rgba(8,9,17,0.93) 0%, rgba(8,9,17,0.88) calc(100% - 22px), rgba(8,9,17,0) 100%);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 calc(100% - 22px), transparent 100%); mask-image: linear-gradient(180deg, #000 0%, #000 calc(100% - 22px), transparent 100%);
  opacity: 0; transition: opacity 0.35s var(--ease); }
.filters.is-stuck::before { opacity: 1; }
@media (min-width: 960px) { .filters { margin: 0 0 16px; padding: 0; position: static; } .filters::before, .filters-sentinel { display: none; } }
.filters { display: flex; align-items: center; gap: 8px; }
.filter-track { flex: 1 1 auto; min-width: 0; }
@media (max-width: 959px) { .filter-track { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 24px; } }
.fold-all { all: unset; box-sizing: border-box; flex: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-2); background: rgba(255,255,255,0.045); border: 1px solid var(--line);
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.2s var(--spring); }
.fold-all svg { width: 16px; height: 16px; transition: transform 0.45s var(--spring); }
.fold-all.is-folded svg { transform: rotate(180deg); }
.fold-all:active { transform: scale(0.94); }
.fold-all:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
@media (hover: hover) { .fold-all:hover { color: var(--ink); background: rgba(255,255,255,0.08); border-color: var(--line-2); } }
@media (max-width: 759px) { .fold-all span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .fold-all { width: 44px; padding: 0; justify-content: center; } }
.filter-track { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding: 2px; }
.filter-track::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.045); color: var(--ink-2);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.2s var(--spring), box-shadow 0.25s;
}
.chip-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-3)); box-shadow: 0 0 10px var(--c, transparent); }
.chip-btn .n { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--ink-2); min-width: 22px; text-align: center; }
.chip-btn[aria-pressed="true"] { color: #fff; border-color: color-mix(in srgb, var(--c, #fff) 55%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c, #8b7bff) 30%, transparent), color-mix(in srgb, var(--c, #8b7bff) 14%, transparent));
  box-shadow: 0 8px 24px -12px var(--c, #8b7bff), inset 0 1px 0 rgba(255,255,255,0.15); }
.chip-btn[aria-pressed="true"] .n { background: rgba(255,255,255,0.18); color: #fff; }
.chip-btn.f-all { --c: #a99bff; }
@media (hover: hover) { .chip-btn:hover { color: var(--ink); border-color: var(--line-2); background: rgba(255,255,255,0.08); } }
.chip-btn:active { transform: scale(0.94); }

/* ---------- Groups: see "Flow chart" below ---------- */
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

/* ---------- Task card ---------- */
.task { --c: var(--todo); --cbg: var(--todo-bg);
  position: relative; border-radius: var(--r-md); background: rgba(255,255,255,0.035); border: 1px solid var(--line);
  transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.3s; overflow: hidden; }
.task::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); opacity: 0.85; box-shadow: 0 0 14px var(--c); }
.task.st-waiting { --c: var(--waiting); --cbg: var(--waiting-bg); }
.task.st-needs_you { --c: var(--needs); --cbg: var(--needs-bg);
  background: linear-gradient(90deg, rgba(255,77,125,0.13), rgba(255,77,125,0.03) 60%); border-color: rgba(255,77,125,0.35);
  box-shadow: 0 0 0 1px rgba(255,77,125,0.12), 0 10px 30px -14px rgba(255,77,125,0.7); }
.task.st-done { --c: var(--done); --cbg: var(--done-bg); }
.task-title .tt { background: linear-gradient(rgba(62,230,160,0.8), rgba(62,230,160,0.8)) no-repeat 0 58% / 0% 2px;
  transition: background-size 0.55s var(--ease) 0.12s, color 0.4s; }
.task.st-done .task-title .tt { background-size: 100% 2px; color: var(--ink-3); }
.task.st-done .task-body { opacity: 0.6; }
.task.is-hidden { display: none; }

.task-row { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: stretch;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.task-toggle { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 58px; padding: 12px 6px 12px 0; }
.is-readonly .task-toggle { padding-right: 12px; }
.task-check { all: unset; box-sizing: border-box; cursor: pointer; display: grid; place-items: center; min-height: 58px; padding-left: 4px; border-radius: var(--r-md); }
.task-check:disabled { cursor: default; }
.task-check:focus-visible, .task-more:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -4px; }
.task-check:not(:disabled):active .status-ic { transform: scale(0.82); transition-duration: 0.08s; }
.task-more { all: unset; box-sizing: border-box; cursor: pointer; display: grid; place-items: center; width: 44px; min-height: 58px; color: var(--ink-3);
  border-radius: var(--r-md); transition: color 0.2s, background 0.2s; }
.task-more svg { width: 20px; height: 20px; }
.task-more:active { color: var(--ink); background: rgba(255,255,255,0.06); }
.task-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; border-radius: var(--r-md); }
.status-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--c); color: var(--c); background: var(--cbg);
  transition: transform 0.3s var(--spring), background 0.3s, border-color 0.3s, box-shadow 0.3s; }
.status-ic svg { width: 14px; height: 14px; }
.st-done .status-ic { background: var(--done); color: #052b1c; border-color: var(--done); box-shadow: 0 0 14px rgba(62,230,160,0.55); }
.st-needs_you .status-ic { animation: throb 1.8s ease-in-out infinite; }
@keyframes throb { 0%,100% { box-shadow: 0 0 0 0 rgba(255,77,125,0.5); } 50% { box-shadow: 0 0 0 6px rgba(255,77,125,0); } }
.task-title { font-size: 15.5px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.3; overflow-wrap: anywhere; }
.task-meta { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
  color: var(--c); background: var(--cbg); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.st-needs_you .chip { color: #fff; background: linear-gradient(135deg, #ff4d7d, #ff2e63); border-color: transparent; box-shadow: 0 6px 16px -6px rgba(255,46,99,0.9); }
.chev { width: 18px; height: 18px; color: var(--ink-3); transition: transform 0.35s var(--spring); }
.task.is-open .chev { transform: rotate(180deg); }

.task-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s var(--ease); }
.task.is-open .task-body { grid-template-rows: 1fr; }
.task-body > div { overflow: hidden; min-height: 0; }
.task-body-inner { padding: 0 14px 14px 50px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.task-detail { flex: 1 1 220px; font-size: 14px; color: var(--ink-2); opacity: 0; transform: translateY(-4px); transition: opacity 0.3s, transform 0.35s var(--ease); }
.task.is-open .task-detail { opacity: 1; transform: none; transition-delay: 0.08s; }

@media (hover: hover) {
  .task:hover { background: rgba(255,255,255,0.06); border-color: var(--line-2); transform: translateY(-1px); }
  .task:hover .chev { color: var(--ink); }
  .task-more:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
  .task-check:not(:disabled):hover .status-ic { transform: scale(1.08); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
}
.task:has(.task-toggle:active) { transform: scale(0.985); background: rgba(255,255,255,0.075); transition-duration: 0.1s; }

@media (max-width: 380px) { .task-row { grid-template-columns: 46px minmax(0, 1fr) auto; } .task-toggle { gap: 8px; padding-right: 2px; } .task-body-inner { padding-left: 46px; } .chip { padding: 0 8px; } .task-more { width: 40px; } }
.task.pop { animation: rise 0.45s var(--ease) both; animation-delay: calc(var(--j, 0) * 28ms); }
[hidden] { display: none !important; }

.empty { text-align: center; padding: 34px 18px; color: var(--ink-2); }
.empty .emoji { font-size: 34px; display: block; margin-bottom: 8px; }
.empty b { color: var(--ink); display: block; font-size: 16px; margin-bottom: 4px; }

/* ---------- Timeline ---------- */
.feed-spark { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.tl-wrap { position: relative; }
.tl-wrap::before { content: ""; position: absolute; left: 18px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, rgba(139,123,255,0.7), rgba(63,208,255,0.35), rgba(255,255,255,0.04)); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }

/* Collapsible remainder of the feed (same 0fr -> 1fr technique as task bodies) */
.tl-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s var(--ease); }
.tl-more-clip { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s linear 0.45s; }
.tl-more.is-open { grid-template-rows: 1fr; }
.tl-more.is-open .tl-more-clip { visibility: visible; transition-delay: 0s; }
.tl-more .tl-item { opacity: 0; transform: translateY(-6px); transition: opacity 0.25s, transform 0.35s var(--ease); }
.tl-more.is-open .tl-item { opacity: 1; transform: none; transition-delay: calc(0.06s + var(--k, 0) * 45ms); }

.tl-toggle { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 44px; margin-top: 8px; border-radius: var(--r-sm); font-size: 13px; font-weight: 700; color: var(--ink-2);
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.2s var(--spring); }
.tl-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.tl-toggle-chev { width: 16px; height: 16px; transition: transform 0.4s var(--spring); }
.tl-toggle[aria-expanded="true"] .tl-toggle-chev { transform: rotate(180deg); }
@media (hover: hover) { .tl-toggle:hover { color: var(--ink); background: rgba(255,255,255,0.08); border-color: var(--line-2); } }
.tl-toggle:active { transform: scale(0.97); }
.tl-item { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 8px 0; }
.tl-item .avatar { position: relative; z-index: 1; outline: 3px solid #10121f; }
.tl-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.tl-who { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.tl-time { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.tl-text { font-size: 14px; color: var(--ink-2); margin-top: 3px; overflow-wrap: anywhere; }
.tl-card { padding: 10px 12px; border-radius: var(--r-sm); background: rgba(255,255,255,0.03); border: 1px solid transparent; transition: background 0.25s, border-color 0.25s; }
@media (hover: hover) { .tl-item:hover .tl-card { background: rgba(255,255,255,0.06); border-color: var(--line); } }
.tl-card .btn { margin-top: 10px; }
.src { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: rgba(255,255,255,0.08); color: var(--ink-2); border: 1px solid var(--line); }
.src-instagram { color: #fff; border-color: transparent; background: linear-gradient(45deg, #f9a43f, #e8346f 50%, #a232c9); }
.src-bot { color: #e6e1ff; border-color: rgba(139,123,255,0.45); background: rgba(139,123,255,0.22); }
.src-sms, .src-text, .src-imessage { color: #d6ffe9; border-color: rgba(62,230,160,0.4); background: rgba(62,230,160,0.16); }
.src-email { color: #dff4ff; border-color: rgba(63,208,255,0.4); background: rgba(63,208,255,0.16); }

/* ---------- Footer / toast / error ---------- */
.foot { text-align: center; padding: 28px 12px 6px; color: var(--ink-2); font-size: 14px; }
.foot-sub { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 50; display: flex; align-items: center; gap: 12px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 600;
  background: rgba(30,32,52,0.92); border: 1px solid var(--line-2); box-shadow: 0 18px 40px -16px rgba(0,0,0,0.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.3s, transform 0.4s var(--spring); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.error-card { text-align: center; padding: 34px 20px; border-color: rgba(255,77,125,0.35); }
.error-card .emoji { font-size: 38px; display: block; margin-bottom: 10px; }
.error-card b { display: block; font-size: 17px; margin-bottom: 6px; }
.error-card p { color: var(--ink-2); margin-bottom: 16px; font-size: 14px; }

/* skeleton */
.skel { height: 64px; border-radius: var(--r-md); background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Editing: card feedback ---------- */
.task.is-pressing { transform: scale(0.97); background: rgba(255,255,255,0.07); transition: transform 0.45s cubic-bezier(0.3, 0, 0.2, 1), background 0.45s; }
.task.press-pop { animation: press-pop 0.42s var(--spring); }
@keyframes press-pop { 0% { transform: scale(0.965); } 60% { transform: scale(1.015); } 100% { transform: none; } }

.task.just-done { animation: settle 0.7s var(--ease); }
@keyframes settle { 0% { transform: none; } 22% { transform: scale(0.975); } 60% { transform: scale(1.012); } 100% { transform: none; } }
.task.just-done::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(62,230,160,0.26), rgba(62,230,160,0.06) 55%, transparent 80%);
  animation: sweep 0.95s var(--ease) forwards; }
@keyframes sweep { 0% { opacity: 0; transform: translateX(-40%); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateX(15%); } }
.task.just-done .status-ic { animation: pop 0.55s var(--spring); }
.task.just-done .status-ic path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.42s 0.12s var(--ease) forwards; }
.task.just-undone .status-ic { animation: pop 0.45s var(--spring); }
@keyframes pop { 0% { transform: scale(0.55); } 60% { transform: scale(1.18); } 100% { transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

.burst { position: fixed; z-index: 60; width: 0; height: 0; pointer-events: none; }
.burst-ring { position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--done); box-shadow: 0 0 14px rgba(62,230,160,0.7); }
.burst-dot { position: absolute; left: 0; top: 0; border-radius: 50%; box-shadow: 0 0 8px currentColor; }

.pop-in { animation: pop-in 0.6s var(--spring) both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(0.94); } to { opacity: 1; transform: none; } }
.task.is-new { border-color: rgba(63,208,255,0.55); box-shadow: 0 0 0 1px rgba(63,208,255,0.25), 0 0 34px -8px rgba(63,208,255,0.75); }
.task.saved-flash { animation: saved 1.1s var(--ease); }
@keyframes saved { 0% { box-shadow: 0 0 0 0 rgba(63,208,255,0.6); } 40% { box-shadow: 0 0 0 4px rgba(63,208,255,0.25), 0 0 34px -8px rgba(63,208,255,0.8); } 100% { box-shadow: 0 0 0 0 rgba(63,208,255,0); } }

/* ---------- Inline edit ---------- */
.task.is-editing { border-color: rgba(63,208,255,0.45); background: rgba(255,255,255,0.06); transform: none;
  box-shadow: 0 0 0 1px rgba(63,208,255,0.18), 0 16px 40px -18px rgba(63,208,255,0.55); }
.task.is-editing > .task-row, .task.is-editing > .task-body { display: none; }
.task-edit { display: grid; gap: 12px; padding: 14px 14px 14px 16px; animation: rise 0.4s var(--ease) both; }
.edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.edit-actions .btn { min-width: 96px; }

/* ---------- Form fields ---------- */
.field-wrap { display: block; }
.field-group { display: grid; }
.field-label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px 2px; }
.field { display: block; width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2);
  background: rgba(255,255,255,0.05); color: var(--ink); font: inherit; font-size: 16px; /* 16px stops iOS zoom-on-focus */
  outline: none; -webkit-appearance: none; appearance: none; transition: border-color 0.2s, box-shadow 0.25s, background 0.2s; }
.field::placeholder { color: var(--ink-3); }
.field:focus { border-color: rgba(63,208,255,0.65); background: rgba(255,255,255,0.07); box-shadow: 0 0 0 4px rgba(63,208,255,0.14); }
textarea.field { resize: none; min-height: 76px; line-height: 1.4; }
select.field { padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b7bbd3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; }
select.field option { background: #15172a; color: var(--ink); }
.field.is-invalid { border-color: var(--needs); box-shadow: 0 0 0 4px rgba(255,77,125,0.16); animation: shake 0.4s var(--ease); }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.field-error { min-height: 1.2em; font-size: 13px; font-weight: 600; color: #ff7a9c; margin: -4px 2px 0; }

.reveal-grid { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.4s var(--ease), opacity 0.3s; }
.reveal-grid.is-open { grid-template-rows: 1fr; opacity: 1; }
.reveal-grid > div { overflow: hidden; min-height: 0; display: grid; gap: 8px; padding: 0 4px; margin: 0 -4px; }
.reveal-grid.is-open > div { padding-top: 8px; padding-bottom: 4px; }

.btn-block { width: 100%; }
.btn:disabled { opacity: 0.7; cursor: default; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: spin 0.7s linear infinite; }

/* ---------- Segmented status picker ---------- */
.seg { --idx: 0; position: relative; display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px; border-radius: 16px;
  background: rgba(255,255,255,0.045); border: 1px solid var(--line); }
.seg-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 4); border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 34%, transparent), color-mix(in srgb, var(--c) 15%, transparent));
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 8px 22px -10px var(--c), inset 0 1px 0 rgba(255,255,255,0.14);
  transform: translateX(calc(var(--idx) * 100%)); transition: transform 0.45s var(--spring), background 0.3s, border-color 0.3s, box-shadow 0.3s; }
.seg-btn { all: unset; box-sizing: border-box; position: relative; z-index: 1; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 4px; border-radius: 12px; font-size: 13px; font-weight: 700; color: var(--ink-2); text-align: center; cursor: pointer; transition: color 0.25s, transform 0.2s var(--spring); }
.seg-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.seg-btn[aria-checked="true"] { color: #fff; }
.seg-btn:active { transform: scale(0.94); }
.seg-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
@media (max-width: 400px) { .seg-btn { font-size: 12.5px; gap: 0; } .seg-btn .dot { display: none; } }

/* ---------- Bottom sheet ---------- */
.sheet-open, .sheet-open body { overflow: hidden; }
.sheet-layer { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(4,5,12,0.55); touch-action: none;
  backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%); opacity: 0; transition: opacity 0.35s var(--ease); }
.sheet-layer.is-open .sheet-backdrop { opacity: 1; }
.sheet { --drag: 0px; position: relative; width: min(560px, 100%); margin-bottom: var(--kb, 0px); outline: none;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 16px - var(--kb, 0px)); overflow-y: auto; overscroll-behavior: contain;
  padding: 0 calc(env(safe-area-inset-right, 0px) + 18px) calc(env(safe-area-inset-bottom, 0px) + 18px) calc(env(safe-area-inset-left, 0px) + 18px);
  border-radius: 28px 28px 0 0; border: 1px solid var(--line-2); border-bottom: 0;
  background: radial-gradient(120% 60% at 0% 0%, rgba(139,123,255,0.16), transparent 60%), linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)), rgba(16,18,33,0.94);
  box-shadow: 0 -24px 60px -20px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  transform: translateY(calc(100% + 40px)); transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1); }
.sheet-layer.is-open .sheet { transform: translateY(var(--drag)); }
.sheet.is-dragging { transition: none; }
.sheet-head { position: sticky; top: 0; z-index: 2; padding: 0 0 6px; margin: 0 -18px; padding-left: 18px; padding-right: 18px; touch-action: none; cursor: grab;
  background: linear-gradient(180deg, rgba(20,22,40,0.96) 70%, rgba(20,22,40,0)); }
.sheet-grab { display: grid; place-items: center; height: 26px; }
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: rgba(255,255,255,0.28); transition: background 0.2s, width 0.3s var(--spring); }
.sheet.is-dragging .sheet-handle { background: rgba(255,255,255,0.5); width: 48px; }
.sheet-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; }
.sheet-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }
.sheet-body { padding-top: 10px; }
.sheet-form { display: grid; gap: 14px; }
.sheet-text { color: var(--ink-2); font-size: 14.5px; }
.sheet-buttons { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 4px; }
.sheet-actions { display: grid; gap: 8px; margin-top: 16px; }
.sheet-action { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 16px; border-radius: 16px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); font-size: 15.5px; font-weight: 650; color: var(--ink); text-decoration: none;
  transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.2s var(--spring), box-shadow 0.3s; }
.sheet-action svg { width: 20px; height: 20px; flex: none; }
.sheet-action:active { transform: scale(0.97); background: rgba(255,255,255,0.09); }
.sheet-action:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.sheet-action.danger { color: #ff7a9c; }
.sheet-action.danger.is-confirm { color: #fff; border-color: transparent; background: linear-gradient(135deg, #ff4d7d, #ff2e63);
  box-shadow: 0 12px 28px -10px rgba(255,46,99,0.9); animation: nudge 0.4s var(--spring); }
@keyframes nudge { 0% { transform: scale(0.96); } 60% { transform: scale(1.02); } 100% { transform: none; } }
@media (hover: hover) {
  .sheet-action:hover { background: rgba(255,255,255,0.08); border-color: var(--line-2); }
  .sheet-action.danger.is-confirm:hover { background: linear-gradient(135deg, #ff5d89, #ff3d6e); }
}
.sheet-cancel { margin-top: 10px; }
@media (min-width: 640px) {
  .sheet-layer { align-items: center; padding: 24px; }
  .sheet { border-radius: 26px; border-bottom: 1px solid var(--line-2); max-height: calc(100dvh - 48px); opacity: 0;
    padding-bottom: 20px; transform: translateY(30px) scale(0.96); transition: transform 0.45s var(--spring), opacity 0.3s var(--ease); }
  .sheet-layer.is-open .sheet { opacity: 1; transform: translateY(var(--drag)); }
}

/* ---------- Floating add button ---------- */
.fab { position: fixed; z-index: 15; right: calc(env(safe-area-inset-right, 0px) + 18px); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; padding: 0;
  border: 1px solid rgba(255,255,255,0.24); background: linear-gradient(135deg, #8b7bff, #3fd0ff);
  box-shadow: 0 16px 34px -10px rgba(99,140,255,0.95), 0 0 0 0 rgba(139,123,255,0.45), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: transform 0.35s var(--spring), box-shadow 0.3s, filter 0.2s, opacity 0.25s;
  animation: fab-in 0.7s var(--spring) 0.6s backwards, fab-glow 3.4s ease-in-out 1.4s infinite; }
.is-editing-task .fab { opacity: 0; transform: scale(0.4) rotate(-45deg); pointer-events: none; }
.fab svg { width: 26px; height: 26px; transition: transform 0.45s var(--spring); }
.fab:active { transform: scale(0.86); transition-duration: 0.1s; }
.fab[aria-expanded="true"] svg { transform: rotate(135deg); }
@media (hover: hover) { .fab:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.08); } }
@keyframes fab-in { from { opacity: 0; transform: translateY(30px) scale(0.4) rotate(-90deg); } to { opacity: 1; transform: none; } }
@keyframes fab-glow { 0%, 100% { box-shadow: 0 16px 34px -10px rgba(99,140,255,0.95), 0 0 0 0 rgba(139,123,255,0.45), inset 0 1px 0 rgba(255,255,255,0.4); }
  50% { box-shadow: 0 18px 40px -10px rgba(63,208,255,0.95), 0 0 0 10px rgba(139,123,255,0), inset 0 1px 0 rgba(255,255,255,0.4); } }
@media (min-width: 960px) { .fab { right: max(calc(env(safe-area-inset-right, 0px) + 28px), calc((100vw - 1480px) / 2 - 20px)); bottom: 28px; } }

/* ---------- Toast extras ---------- */
.can-edit .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); }
/* While a sheet is open, toasts drop in from the top so they never cover sheet controls. */
.sheet-open .toast { top: calc(env(safe-area-inset-top, 0px) + 14px); bottom: auto; transform: translate(-50%, -20px); }
.sheet-open .toast.show { transform: translate(-50%, 0); }
.toast.has-action { padding: 5px 5px 5px 16px; }
.toast.has-action.show { pointer-events: auto; }
.toast-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.is-error { border-color: rgba(255,77,125,0.5); }
.toast.is-error::before, .toast.is-ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast.is-error::before { background: var(--needs); box-shadow: 0 0 10px var(--needs); }
.toast.is-ok::before { background: var(--done); box-shadow: 0 0 10px var(--done); }
.toast-action { all: unset; box-sizing: border-box; flex: none; cursor: pointer; min-height: 44px; min-width: 64px; padding: 0 14px; border-radius: 11px; text-align: center;
  font-weight: 800; color: #9fe8ff; background: rgba(63,208,255,0.14); border: 1px solid rgba(63,208,255,0.35); transition: transform 0.2s var(--spring), background 0.2s; }
.toast-action:active { transform: scale(0.94); background: rgba(63,208,255,0.24); }

/* ---------- Waiting on you: clear ---------- */
.wou-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { all: unset; box-sizing: border-box; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; cursor: pointer; color: var(--ink-2);
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); transition: transform 0.2s var(--spring), background 0.2s, color 0.2s, border-color 0.2s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.88); }
.icon-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.wou-clear:active { color: var(--done); border-color: rgba(62,230,160,0.5); background: rgba(62,230,160,0.14); }
@media (hover: hover) { .wou-clear:hover { color: var(--ink); background: rgba(255,255,255,0.1); border-color: var(--line-2); } }

/* ---------- Read-only ---------- */
.mast-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ro-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--waiting); padding: 6px 11px; border-radius: 999px;
  background: var(--waiting-bg); border: 1px solid rgba(255,181,71,0.35); animation: rise 0.5s var(--ease) both; }
.ro-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Flow chart ---------- */
/* Each topic is a band: a big glass topic node on the left, an SVG layer of glowing bezier wires, and the
   topic's task nodes stacked on the right. On phones the band stacks: topic on top, then a left spine with
   wires curving down-and-right into indented task nodes. app.js computes every wire from live layout. */
.flow { display: grid; gap: 18px; position: relative; }
.band { --hue: 258; --acc: hsl(var(--hue) 92% 72%); --acc-2: hsl(calc(var(--hue) + 28) 92% 64%);
  position: relative; isolation: isolate; min-width: 0; border-radius: 30px; padding: 12px;
  background:
    radial-gradient(70% 120% at 0% 50%, hsl(var(--hue) 90% 60% / 0.11), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.008));
  border: 1px solid hsl(var(--hue) 70% 72% / 0.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.4s, background 0.4s; }
.band::after { content: ""; position: absolute; left: 30px; right: 30px; top: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, hsl(var(--hue) 90% 75% / 0.55), transparent); opacity: 0.6; }
@media (hover: hover) { .band:hover { border-color: hsl(var(--hue) 70% 72% / 0.24); } }
.band.is-collapsed { padding-top: 10px; padding-bottom: 10px; }
.wires { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.topic, .branch, .stub { position: relative; z-index: 1; }

/* --- Topic node --- */
.topic { all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 14px; min-height: 64px; padding: 16px 16px 16px 16px; border-radius: 24px;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  background:
    radial-gradient(120% 90% at 0% 0%, hsl(var(--hue) 90% 62% / 0.30), transparent 60%),
    linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.015) 60%),
    rgba(17, 19, 36, 0.92);
  border: 1px solid hsl(var(--hue) 90% 76% / 0.38);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 22px 50px -26px hsl(var(--hue) 90% 45% / 0.95), 0 0 46px -20px hsl(var(--hue) 95% 62% / 0.75);
  transition: transform 0.4s var(--spring), box-shadow 0.4s, border-color 0.3s; }
.topic::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(135deg, hsl(var(--hue) 95% 80% / 0.9), transparent 40%, transparent 65%, hsl(calc(var(--hue) + 40) 95% 70% / 0.6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.55; transition: opacity 0.3s; }
.topic:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.topic:active { transform: scale(0.975); transition-duration: 0.12s; }
@media (hover: hover) {
  .topic:hover, .band.hot-all .topic { transform: translateY(-3px); border-color: hsl(var(--hue) 95% 80% / 0.6);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 28px 60px -26px hsl(var(--hue) 90% 45% / 1), 0 0 60px -14px hsl(var(--hue) 95% 62% / 0.9); }
  .topic:hover::before, .band.hot-all .topic::before { opacity: 1; }
  .topic:hover .topic-chev { color: var(--ink); background: hsl(var(--hue) 90% 70% / 0.2); }
}
.topic-ring { position: relative; width: 56px; height: 56px; display: grid; place-items: center; flex: none; }
.topic-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.topic-ring .tr-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 5; }
.topic-ring .tr-bar { fill: none; stroke: var(--acc); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 131.95; stroke-dashoffset: 131.95;
  filter: drop-shadow(0 0 4px hsl(var(--hue) 95% 65% / 0.8)); transition: stroke-dashoffset 1.1s var(--ease); }
.band.is-complete .topic-ring .tr-bar { stroke: var(--done); filter: drop-shadow(0 0 5px rgba(62,230,160,0.8)); }
.topic-ring-n { position: relative; font-size: 13px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.topic-ring-n small { font-size: 10px; color: var(--ink-3); font-weight: 700; }
.topic-text { display: grid; gap: 3px; min-width: 0; }
.topic-area { font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: hsl(var(--hue) 60% 82%); opacity: 0.8;
  display: flex; align-items: center; gap: 6px; }
.topic-area::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 8px var(--acc); }
.topic-title { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.topic-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.topic-needs { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 800;
  color: #fff; background: linear-gradient(135deg, #ff4d7d, #ff2e63); box-shadow: 0 4px 14px -4px rgba(255,46,99,0.9); }
.topic-needs::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.topic-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.topic-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); opacity: 0.9; transition: background 0.3s, box-shadow 0.3s; }
.topic-dots i.st-todo { --c: var(--todo); } .topic-dots i.st-waiting { --c: var(--waiting); } .topic-dots i.st-needs_you { --c: var(--needs); } .topic-dots i.st-done { --c: var(--done); opacity: 0.55; }
.topic-chev { align-self: start; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--ink-2);
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); transition: background 0.25s, color 0.25s; }
.topic-chev svg { width: 18px; height: 18px; transition: transform 0.5s var(--spring); transform: rotate(180deg); }
.band.is-collapsed .topic-chev svg { transform: none; }
@media (min-width: 760px) { .topic-chev svg { transform: rotate(90deg); } .band.is-collapsed .topic-chev svg { transform: rotate(-90deg); } }
.topic-port { position: absolute; width: 12px; height: 12px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0 22%, var(--acc) 40%); box-shadow: 0 0 0 3px hsl(var(--hue) 90% 65% / 0.22), 0 0 14px var(--acc);
  transition: transform 0.4s var(--spring), opacity 0.3s; }
.topic-port::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid var(--acc); opacity: 0; animation: port-ping 2.6s ease-out infinite; }
@keyframes port-ping { 0% { transform: scale(0.5); opacity: 0.8; } 70%, 100% { transform: scale(1.8); opacity: 0; } }
/* Collapsed topic with something that needs you: pulse. */
.band.is-collapsed.has-needs .topic { animation: needs-pulse 2s ease-in-out infinite; }
@keyframes needs-pulse { 0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 0 rgba(255,77,125,0.55), 0 0 40px -18px rgba(255,77,125,0.8); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 7px rgba(255,77,125,0), 0 0 60px -10px rgba(255,77,125,0.9); } }

/* --- Branch (the task stack) --- */
.branch { display: grid; grid-template-rows: 1fr; min-width: 0; transition: grid-template-rows 0.55s var(--ease); }
.branch-clip { min-height: 0; min-width: 0; }
.band.is-anim .branch-clip, .band.is-collapsed .branch-clip { overflow: hidden; margin-left: -80px; padding-left: 80px; }
.band.is-collapsed .branch { grid-template-rows: 0fr; transition-delay: 0.14s; }
.branch .tasks { padding: 6px 4px 6px 0; }
.band.is-collapsed .branch .task { opacity: 0; transform: translateX(-46px) scale(0.86);
  transition: opacity 0.26s ease calc(var(--rj, 0) * 22ms), transform 0.34s cubic-bezier(.5,0,.75,0) calc(var(--rj, 0) * 22ms); }
.band.is-expanding .branch .task { transition: opacity 0.36s ease calc(0.26s + var(--j, 0) * 45ms), transform 0.6s var(--spring) calc(0.26s + var(--j, 0) * 45ms),
  background 0.25s, border-color 0.25s, box-shadow 0.3s; }

/* --- Collapsed stub (desktop): a compact pill standing in for the hidden tasks --- */
.stub { display: none; cursor: pointer; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: var(--ink-2); background: rgba(17,19,36,0.9); border: 1px dashed hsl(var(--hue) 80% 72% / 0.45);
  opacity: 0; transform: translateX(-16px) scale(0.92); pointer-events: none;
  transition: opacity 0.25s, transform 0.3s var(--ease), border-color 0.25s, color 0.25s; }
.stub-dots { display: flex; gap: 4px; }
.stub-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.stub-dots i.st-todo { --c: var(--todo); } .stub-dots i.st-waiting { --c: var(--waiting); } .stub-dots i.st-needs_you { --c: var(--needs); } .stub-dots i.st-done { --c: var(--done); opacity: 0.55; }
.band.is-collapsed .stub { opacity: 1; transform: none; pointer-events: auto; transition-delay: 0.42s; }
@media (hover: hover) { .stub:hover { color: var(--ink); border-color: hsl(var(--hue) 90% 78% / 0.8); } }

/* --- Task nodes in the chart --- */
.flow .task { background: linear-gradient(100deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02) 60%), rgba(14, 16, 30, 0.93);
  border-color: rgba(255,255,255,0.09); box-shadow: 0 14px 30px -22px rgba(0,0,0,0.9); }
.flow .task.st-needs_you { background: linear-gradient(90deg, rgba(255,77,125,0.18), rgba(255,77,125,0.04) 60%), rgba(20, 13, 26, 0.94); border-color: rgba(255,77,125,0.45);
  box-shadow: 0 0 0 1px rgba(255,77,125,0.14), 0 10px 34px -12px rgba(255,77,125,0.75); animation: needs-glow 2.6s ease-in-out infinite; }
@keyframes needs-glow { 0%, 100% { box-shadow: 0 0 0 1px rgba(255,77,125,0.14), 0 10px 34px -12px rgba(255,77,125,0.7); }
  50% { box-shadow: 0 0 0 1px rgba(255,77,125,0.3), 0 10px 44px -8px rgba(255,77,125,0.95); } }
.flow .task.st-waiting { border-color: rgba(255,181,71,0.22); }
.flow .task.st-done { background: rgba(13, 16, 26, 0.8); border-color: rgba(62,230,160,0.14); }
.flow .task.st-done .task-row { opacity: 0.72; }
@media (hover: hover) {
  .flow .task:hover, .flow .task.is-hot { background: linear-gradient(100deg, rgba(255,255,255,0.085), rgba(255,255,255,0.03) 60%), rgba(18, 20, 36, 0.95);
    border-color: color-mix(in srgb, var(--c) 45%, transparent); transform: translateY(-2px);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 18%, transparent), 0 18px 40px -18px color-mix(in srgb, var(--c) 70%, transparent); }
  .flow .task.st-done:hover .task-row { opacity: 1; }
}
.flow .task.is-editing { background: rgba(18, 20, 36, 0.97); }

/* --- Wires --- */
.wire { --w: var(--todo); }
.wire.st-waiting { --w: var(--waiting); } .wire.st-needs_you { --w: var(--needs); } .wire.st-done { --w: var(--done); } .wire.is-stub { --w: var(--acc); }
.wire path { fill: none; stroke: var(--w); stroke-linecap: round; transition: stroke 0.5s, opacity 0.35s, stroke-width 0.3s; }
/* Gap slightly longer than the path: when retracted (offset 1.01) no dash, not even a zero-length one whose
   round cap would paint a dot, intersects the path. */
.wire .w-glow, .wire .w-base { stroke-dasharray: 1 1.02; stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.6s var(--ease) calc(var(--wd, 0ms) + var(--wj, 0) * 45ms), stroke 0.5s, opacity 0.35s, stroke-width 0.3s; }
.wire .w-glow { stroke-width: 8; opacity: 0.13; }
.wire .w-base { stroke-width: 2; opacity: 0.72; }
.wire .w-flow { stroke-width: 2.2; stroke: color-mix(in srgb, var(--w) 55%, #fff); stroke-dasharray: 3 15; opacity: 0.55;
  animation: wire-flow 1.15s linear infinite; transition: opacity 0.4s ease calc(0.35s + var(--wd, 0ms) + var(--wj, 0) * 45ms), stroke 0.5s; }
@keyframes wire-flow { to { stroke-dashoffset: -36; } }
.wire .w-head { fill: var(--w); stroke: none; transform: scale(1); opacity: 1;
  transition: transform 0.4s var(--spring) calc(0.4s + var(--wd, 0ms) + var(--wj, 0) * 45ms), opacity 0.2s ease calc(0.4s + var(--wd, 0ms) + var(--wj, 0) * 45ms), fill 0.5s; }
.wire.st-done .w-base { opacity: 0.4; } .wire.st-done .w-glow { opacity: 0.06; } .wire.st-done .w-flow { opacity: 0; animation: none; } .wire.st-done .w-head { opacity: 0.55; }
.wire.st-needs_you .w-base { stroke-width: 2.4; opacity: 0.95; } .wire.st-needs_you .w-glow { opacity: 0.24; stroke-width: 10; }
.wire.is-stub .w-base { opacity: 0.5; stroke-width: 1.6; } .wire.is-stub .w-glow { opacity: 0.08; } .wire.is-stub .w-flow { opacity: 0.4; }
/* Hover: brighten the hovered task's wire, or the whole branch when the topic is hovered */
.band.hot-all .wire .w-base, .wire.is-hot .w-base { opacity: 1; stroke-width: 2.8; }
.band.hot-all .wire .w-glow, .wire.is-hot .w-glow { opacity: 0.32; stroke-width: 12; }
.band.hot-all .wire .w-flow, .wire.is-hot .w-flow { opacity: 0.95; }
.band.hot-all .wire.st-done .w-base, .wire.st-done.is-hot .w-base { opacity: 0.75; }
/* Retracted (collapsed / leaving / just created): undraw toward the topic, hide flow + head, no delays */
/* Once the undraw finishes the whole wire (and its particles) is hidden outright; it shows again immediately on draw-in. */
.wire.off { visibility: hidden; transition: visibility 0s linear 0.38s; }
.wire.off .w-glow, .wire.off .w-base { stroke-dashoffset: 1.01 !important; transition: stroke-dashoffset 0.34s cubic-bezier(.5,0,.75,0) 0s, stroke 0.5s, opacity 0.35s; }
.wire.off .w-flow { opacity: 0 !important; transition: opacity 0.12s 0s; }
.wire.off .w-head { opacity: 0 !important; transform: scale(0); transition: transform 0.2s ease 0s, opacity 0.15s 0s; }

/* --- Particles (SMIL animateMotion along each wire) --- */
/* Only on a fully drawn wire: fade in after the draw-in completes, vanish at once when it retracts. */
.wire .w-pts { opacity: 1; transition: opacity 0.3s ease calc(0.65s + var(--wd, 0ms) + var(--wj, 0) * 45ms); }
.wire.off .w-pts { opacity: 0 !important; transition: opacity 0.08s 0s; }
.pt .pt-halo { fill: var(--w); opacity: 0.28; }
.pt .pt-core { fill: color-mix(in srgb, var(--w) 40%, #fff); }
.pt { --w: var(--todo); } .pt.st-waiting { --w: var(--waiting); } .pt.st-needs_you { --w: var(--needs); }

/* --- Desktop / tablet: topic left, tasks right --- */
@media (min-width: 760px) {
  .band { --tw: 236px; --gap: 84px; display: grid; grid-template-columns: var(--tw) minmax(0, 1fr); column-gap: var(--gap); align-items: center; padding: 18px 20px; }
  .band.is-collapsed { padding-top: 16px; padding-bottom: 16px; }
  .topic { grid-column: 1; grid-row: 1; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ring chev" "text text"; align-items: start; padding: 18px; gap: 12px 10px; }
  .topic-ring { grid-area: ring; }
  .topic-chev { grid-area: chev; }
  .topic-text { grid-area: text; }
  .topic-port { right: -6px; top: calc(50% - 6px); }
  .branch { grid-column: 2; grid-row: 1; }
  .stub { grid-column: 2; grid-row: 1; justify-self: start; align-self: center; display: inline-flex; }
  .band.is-collapsed .topic-port { transform: scale(0.8); }
}
@media (min-width: 1440px) { .band { --tw: 268px; --gap: 108px; padding: 20px 22px; } .topic-title { font-size: 22px; } }

/* --- Phones: topic on top, spine down the left, tasks indented --- */
@media (max-width: 759px) {
  .flow { gap: 14px; }
  .band { display: flex; flex-direction: column; padding: 8px; border-radius: 26px; }
  .band.is-collapsed { padding-top: 8px; padding-bottom: 8px; }
  .topic { padding: 14px; gap: 12px; border-radius: 20px; }
  .topic-ring { width: 50px; height: 50px; }
  .topic-title { font-size: 19px; }
  .topic-chev { align-self: center; width: 36px; height: 36px; }
  .topic-port { left: 16px; bottom: -6px; }
  .branch .tasks { padding: 12px 0 4px 42px; }
  .band.is-collapsed .branch .task { transform: translateY(-24px) scale(0.9); }
  /* Narrow task nodes: title gets its own line, chip + chevron below */
  .flow .task-row { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .flow .task-toggle { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 11px 2px 11px 0; min-height: 58px; }
  .flow .task-meta { gap: 6px; }
  .flow .task-meta .chev { margin-left: auto; }
  .flow .task-body-inner { padding-left: 48px; padding-right: 12px; }
  .flow .task-more { width: 44px; }
  .flow .task-check { padding-left: 2px; }
}

/* --- Skeleton --- */
.band-skel { display: grid; gap: 10px; }
@media (min-width: 760px) { .band-skel { grid-template-columns: 236px minmax(0, 1fr); column-gap: 84px; align-items: center; } }
.band-skel .skel-topic { height: 140px; border-radius: 24px; }
.band-skel .skel-tasks { display: grid; gap: 10px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .glow, .wou::before, .fab, .topic-port::after, .wire .w-flow { animation: none !important; }
  .w-pts { display: none; }
  .task.is-pressing { transform: none; }
}
