:root {
  --ink: #07060d;
  --card: rgba(255, 255, 255, 0.06);
  --card-stroke: rgba(255, 255, 255, 0.10);
  --fg: #ffffff;
  --dim: rgba(255, 255, 255, 0.55);
  --green: #00f5a0;
  --orange: #ff8a00;
  --yellow: #ffd60a;
  --bg: #0d0611;
  --s1: #ff3d9a; --s2: #b14dff;      /* active space */
  --o1: #00c8ff; --o2: #3d5afe;      /* the other space */
  --c1: #ff2d87;
  --c2: #ff8a00;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input, textarea { font: inherit; -webkit-user-select: text; user-select: text; }
button:focus-visible, input:focus-visible, textarea:focus-visible, .task:focus-visible { outline: 2px solid var(--c1); outline-offset: 3px; }
[hidden] { display: none !important; }
svg { display: block; }

/* ---------- Background ---------- */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); transition: background 0.8s ease; }
.blob { position: absolute; border-radius: 50%; opacity: 0.55; transition: background 0.8s ease; }
.b1 { width: 120vmax; height: 120vmax; left: -55vmax; top: -60vmax; background: radial-gradient(circle, var(--c1) 0%, transparent 60%); animation: drift1 18s ease-in-out infinite alternate; }
.b2 { width: 110vmax; height: 110vmax; right: -60vmax; top: -40vmax; background: radial-gradient(circle, var(--c2) 0%, transparent 58%); opacity: 0.4; animation: drift2 22s ease-in-out infinite alternate; }
.b3 { width: 100vmax; height: 100vmax; left: -30vmax; bottom: -75vmax; background: radial-gradient(circle, var(--c1) 0%, transparent 60%); opacity: 0.25; animation: drift1 26s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(12vmax, 8vmax) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-10vmax, 14vmax) scale(0.92); } }
.flash { position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 50%, var(--flash, #fff) 0%, transparent 70%); }

/* ---------- Pager ---------- */
.pager {
  position: fixed; inset: 0; z-index: 1;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: none; }
.page::-webkit-scrollbar { display: none; }
.page-inner { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-top) + 70px) 16px calc(var(--safe-bottom) + 120px); display: flex; flex-direction: column; gap: 18px; }

/* ---------- Hero ---------- */
.hero { display: flex; align-items: center; gap: 14px; position: relative; }
.hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hero h1 { margin: 0; text-align: left; font-size: clamp(34px, 10vw, 42px); font-weight: 900; letter-spacing: -0.02em; line-height: 1; background: linear-gradient(120deg, var(--a), var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 2px; }
.hero .sub { font-size: 15px; font-weight: 600; color: var(--dim); }
.hero .headline { font-size: 15px; font-weight: 700; color: rgba(255,255,255,.92); margin-top: 6px; text-wrap: balance; }
.legend { display: grid; gap: 3px; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--dim); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend b { color: #fff; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, var(--a), var(--b)); flex: none; }
.ring-wrap { position: relative; flex: none; width: min(40vw, 164px); aspect-ratio: 1; }
.ring-wrap svg { width: 100%; height: 100%; overflow: visible; }
.ring-track { fill: none; }
.ring-bar { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(.34, 1.4, .64, 1), opacity 0.3s; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center .pct { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ring-center .lbl { font-size: 12px; font-weight: 600; color: var(--dim); margin-top: -2px; }
.settings-btn { align-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; background: rgba(255,255,255,.07); border: 1px solid var(--card-stroke); color: var(--dim); font-size: 14px; font-weight: 700; }
.settings-btn svg { width: 16px; height: 16px; }

/* ---------- Stat chips ---------- */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.chip { padding: 12px; border-radius: 18px; background: color-mix(in srgb, var(--col) 11%, transparent); border: 1px solid color-mix(in srgb, var(--col) 28%, transparent); min-width: 0; }
.chip .v { display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.chip .v svg { width: 14px; height: 14px; color: var(--col); flex: none; }
.chip .l { font-size: 11px; font-weight: 600; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bump { animation: bump 0.45s cubic-bezier(.34, 1.8, .64, 1); }
@keyframes bump { 40% { transform: scale(1.25); } }

/* ---------- Tasks ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.task {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: 22px; background: var(--card);
  border: 1px solid var(--card-stroke); overflow: hidden; cursor: pointer;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.4s;
  touch-action: pan-y;
}
.task.done { background: linear-gradient(90deg, color-mix(in srgb, var(--hue) 22%, transparent), var(--card) 75%); border-color: color-mix(in srgb, var(--hue) 50%, transparent); border-width: 1.5px; }
.task.pressing { transform: scale(0.97); transition: transform 0.4s; }
.swipe-row { position: relative; border-radius: 22px; }
.swipe-del { position: absolute; inset: 0; border-radius: 22px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding-right: 22px; color: #fff; font-size: 15px; font-weight: 900; background: linear-gradient(90deg, #ff2d55, #ff453a); opacity: 0; }
.swipe-del svg { width: 19px; height: 19px; transition: transform 0.25s cubic-bezier(.34, 1.8, .64, 1); }
.swipe-row.armed .swipe-del svg { transform: scale(1.35); }
.swipe-row.armed .swipe-del { background: #ff2d55; }
.orb { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--hue) 75%, transparent); background: color-mix(in srgb, var(--hue) 13%, transparent); box-shadow: 0 0 6px color-mix(in srgb, var(--hue) 35%, transparent); display: grid; place-items: center; transition: background 0.25s, box-shadow 0.3s, border-color 0.25s; }
.orb svg { width: 16px; height: 16px; color: var(--ink); transform: scale(0.1); opacity: 0; transition: transform 0.35s cubic-bezier(.34, 1.8, .64, 1), opacity 0.2s; }
.task.done .orb { border-color: var(--hue); background: radial-gradient(circle at 30% 25%, #fff, var(--hue) 70%); box-shadow: 0 0 14px var(--hue); }
.task.done .orb svg { transform: none; opacity: 1; }
.orb .wave { position: absolute; inset: -3px; border-radius: 50%; border: 6px solid var(--hue); opacity: 0; pointer-events: none; }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.task-title { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; transition: color 0.3s; }
.task.done .task-title { color: var(--dim); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--hue) 80%, transparent); text-decoration-thickness: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges:empty { display: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; color: var(--col); background: color-mix(in srgb, var(--col) 14%, transparent); padding: 3px 8px; border-radius: 99px; }
.badge svg { width: 11px; height: 11px; }
.sweep { position: absolute; top: 0; bottom: 0; left: 0; width: 60%; pointer-events: none; opacity: 0; filter: blur(6px); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hue) 70%, transparent), rgba(255,255,255,.55), color-mix(in srgb, var(--hue) 70%, transparent), transparent); }
.cheer { position: absolute; right: 18px; top: 50%; translate: 0 -50%; font-size: 22px; font-weight: 900; pointer-events: none; opacity: 0; background: linear-gradient(90deg, var(--hue), #fff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 8px var(--hue)); white-space: nowrap; }

.empty { text-align: center; padding: 28px 22px; display: grid; justify-items: center; gap: 8px; }
.empty svg { width: 42px; height: 42px; color: var(--a); animation: pulse 2s ease-in-out infinite; }
.empty h3 { margin: 0; font-size: 19px; font-weight: 800; }
.empty p { margin: 0; font-size: 14px; font-weight: 500; color: var(--dim); max-width: 30ch; }
@keyframes pulse { 50% { opacity: 0.45; transform: scale(0.92); } }

/* ---------- Cards & charts ---------- */
.card { padding: 16px; border-radius: 24px; background: var(--card); border: 1px solid var(--card-stroke); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-head svg { width: 17px; height: 17px; color: var(--col); flex: none; }
.card-head h2 { margin: 0; font-size: 17px; font-weight: 800; flex: 1; white-space: nowrap; }
.card-head small { font-size: 12px; font-weight: 600; color: var(--dim); text-align: right; }
.charts { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); font-weight: 700; fill: var(--dim); }
.chart .val { fill: #fff; }
.grow { transform-box: fill-box; transform-origin: bottom; animation: grow 0.7s cubic-bezier(.34, 1.5, .64, 1) both; }
@keyframes grow { from { transform: scaleY(0); } }
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.fade-in { animation: fadein 0.8s ease both; }
@keyframes fadein { from { opacity: 0; } }
.chart-empty { min-height: 90px; display: grid; place-items: center; text-align: center; font-size: 14px; font-weight: 500; color: var(--dim); }
.legend-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--dim); }
.legend-row span { display: flex; align-items: center; gap: 5px; }
.donut-wrap { position: relative; width: 100%; max-width: 124px; margin: 0 auto; aspect-ratio: 1; }
.donut-wrap svg { width: 100%; height: 100%; }
.donut-wrap .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-wrap .center b { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.donut-wrap .center span { font-size: 11px; font-weight: 600; color: var(--dim); }
.donut-arc { transition: stroke-dashoffset 0.9s cubic-bezier(.34, 1.3, .64, 1); }
.cad-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; height: 124px; }
.cad-bar { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cad-track { flex: 1; width: 100%; max-width: 26px; border-radius: 99px; background: rgba(255,255,255,.08); position: relative; overflow: hidden; }
.cad-fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 99px; background: linear-gradient(180deg, var(--a), var(--b)); box-shadow: 0 0 10px var(--a); transition: height 0.8s cubic-bezier(.34, 1.4, .64, 1); min-height: 8px; }
.cad-bar small { font-size: 11px; font-weight: 800; color: var(--dim); }
.pace { display: flex; gap: 18px; align-items: center; }
.pace .donut-wrap { width: 110px; flex: none; margin: 0; }
.pace-bars { flex: 1; min-width: 0; display: grid; gap: 12px; }
.pace-row .top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--dim); margin-bottom: 5px; }
.pace-row .top b { color: #fff; font-variant-numeric: tabular-nums; }
.pace-track { height: 12px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.pace-fill { height: 100%; min-width: 12px; border-radius: 99px; transition: width 0.8s cubic-bezier(.34, 1.3, .64, 1); }
.pace-verdict { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; }
.pace-verdict svg { width: 16px; height: 16px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; z-index: 10; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 6px);
  max-width: 536px; margin: 0 auto;
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 99px;
  background: rgba(20, 18, 30, 0.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255,255,255,.12);
}
.tab { position: relative; z-index: 1; flex: 1; min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 9px 0; border-radius: 99px; color: rgba(255,255,255,.75); transition: color 0.3s; }
.tab svg { width: 18px; height: 18px; }
.tab span { font-size: 11px; font-weight: 800; }
.tab.on { color: var(--ink); }
.tab .count { position: absolute; top: 1px; right: 8px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; font-size: 10px; font-weight: 900; line-height: 17px; color: var(--ink); background: linear-gradient(135deg, var(--a), var(--b)); transition: transform 0.3s; }
.tab.on .count { transform: scale(0); }
.tab-indicator { position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 0; border-radius: 99px; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 0 14px var(--c1); transition: transform 0.45s cubic-bezier(.34, 1.3, .64, 1), width 0.45s, background 0.5s, box-shadow 0.5s; }
.add-btn { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: conic-gradient(from 0deg, #ff2d87, #ff8a00, #ffd60a, #b6ff3b, #00f5a0, #00e5ff, #4d7cff, #b45cff, #ff2d87); box-shadow: 0 0 16px var(--c1); transition: transform 0.2s, box-shadow 0.5s; }
.add-btn:active { transform: scale(0.9) rotate(45deg); }
.add-btn svg { width: 26px; height: 26px; }

/* ---------- Confetti & banner ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; pointer-events: none; }
.banner-wrap { position: fixed; inset: 0; z-index: 41; display: grid; place-items: center; pointer-events: none; padding: 16px; }
.banner { text-align: center; padding: 24px 30px; border-radius: 32px; background: rgba(0,0,0,.6); border: 2px solid var(--a); animation: bannerIn 0.6s cubic-bezier(.34, 1.7, .64, 1) both, glow 0.5s ease-in-out 0.6s infinite alternate; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.banner.out { animation: bannerOut 0.35s ease-in forwards; }
.banner svg { width: 56px; height: 56px; margin: 0 auto 6px; color: var(--a); animation: bounce 0.6s ease 0.4s 2; }
.banner h2 { margin: 0; font-size: 40px; font-weight: 900; line-height: 1.05; background: linear-gradient(120deg, var(--a), var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.banner p { margin: 6px 0 0; font-size: 16px; font-weight: 600; color: rgba(255,255,255,.8); }
@keyframes bannerIn { from { transform: scale(0.3); opacity: 0; } }
@keyframes bannerOut { to { transform: scale(1.2); opacity: 0; } }
@keyframes glow { from { box-shadow: 0 0 10px color-mix(in srgb, var(--a) 40%, transparent); } to { box-shadow: 0 0 44px var(--a); } }
@keyframes bounce { 50% { transform: translateY(-12px) scale(1.1); } }

/* ---------- Sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); animation: fadein 0.25s ease; }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  max-height: calc(100% - var(--safe-top) - 24px); overflow-y: auto;
  padding: 20px 20px calc(var(--safe-bottom) + 20px);
  border-radius: 32px 32px 0 0; background: linear-gradient(180deg, color-mix(in srgb, var(--a) 22%, var(--ink)), var(--ink) 55%);
  border: 1px solid rgba(255,255,255,.1); border-bottom: 0;
  animation: sheetIn 0.42s cubic-bezier(.2, 1.1, .3, 1);
  display: flex; flex-direction: column; gap: 20px;
}
.sheet.closing { animation: sheetOut 0.25s ease-in forwards; }
.sheet > * { flex-shrink: 0; } /* tall sheets scroll; never squash fields */
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 30px; font-weight: 900; background: linear-gradient(120deg, var(--a), var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.close { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); }
.close svg { width: 14px; height: 14px; }
.field { width: 100%; padding: 18px; border-radius: 20px; font-size: 22px; font-weight: 700; color: #fff; background: rgba(255,255,255,.07); border: 1.5px solid color-mix(in srgb, var(--hue, var(--a)) 60%, transparent); outline: none; resize: none; caret-color: var(--hue, var(--a)); }
.field::placeholder { color: rgba(255,255,255,.35); }
.section-label { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; }
.pills { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pill { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 8px; border-radius: 99px; font-size: 15px; font-weight: 800; background: rgba(255,255,255,.08); transition: background 0.25s, color 0.25s, transform 0.15s; white-space: nowrap; }
.pill svg { width: 16px; height: 16px; flex: none; }
.pill:active { transform: scale(0.95); }
.pill.on { color: var(--ink); background: linear-gradient(135deg, var(--pa), var(--pb)); }
.pills.three { grid-template-columns: repeat(3, 1fr); }
.pill.span2 { grid-column: span 2; }
.sched-pick { margin-top: 12px; }
.dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow-btn { aspect-ratio: 1; border-radius: 50%; font-size: 15px; font-weight: 900; background: rgba(255,255,255,.08); transition: background 0.2s, color 0.2s, transform 0.25s cubic-bezier(.34, 1.8, .64, 1); }
.dow-btn.on { color: var(--ink); background: linear-gradient(135deg, var(--a), var(--b)); transform: scale(1.06); box-shadow: 0 0 10px color-mix(in srgb, var(--a) 60%, transparent); }
.mdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mday { height: 38px; border-radius: 12px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.07); transition: background 0.2s, color 0.2s; }
.mday.on { color: var(--ink); background: linear-gradient(135deg, var(--a), var(--b)); }
.date-field { font-size: 18px; padding: 14px 16px; color-scheme: dark; }
.hint { margin: 10px 0 0; font-size: 13px; font-weight: 500; color: var(--dim); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); justify-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--sw); transition: transform 0.3s cubic-bezier(.34, 1.8, .64, 1), box-shadow 0.3s; }
.swatch.on { transform: scale(1.22); box-shadow: 0 0 0 3px #fff inset, 0 0 12px var(--sw); }
.cta { width: 100%; padding: 17px; border-radius: 99px; display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 19px; font-weight: 900; color: var(--ink); background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: 0 6px 18px color-mix(in srgb, var(--a) 55%, transparent); transition: opacity 0.2s, transform 0.15s; }
.cta svg { width: 20px; height: 20px; }
.cta:disabled { opacity: 0.4; }
.cta:active:not(:disabled) { transform: scale(0.97); }
.cta.danger { background: #ff3b5c; color: #fff; box-shadow: none; }
.menu { display: grid; gap: 10px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 18px; background: rgba(255,255,255,.07); font-size: 17px; font-weight: 700; text-align: left; }
.menu-item svg { width: 20px; height: 20px; flex: none; color: var(--a); }
.menu-item.red, .menu-item.red svg { color: #ff5470; }
.menu-item .sub { display: block; font-size: 13px; font-weight: 500; color: var(--dim); margin-top: 2px; }
.switch { margin-left: auto; width: 50px; height: 30px; border-radius: 99px; background: rgba(255,255,255,.18); position: relative; flex: none; transition: background 0.25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.25s cubic-bezier(.34, 1.5, .64, 1); }
.switch.on { background: linear-gradient(135deg, var(--a), var(--b)); }
.switch.on::after { transform: translateX(20px); }
.note { font-size: 13px; font-weight: 500; color: var(--dim); line-height: 1.45; margin: 0; }

.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--safe-bottom) + 92px); translate: -50% 0; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 14px; white-space: nowrap; padding: 12px 18px; border-radius: 16px; background: rgba(30, 28, 44, .95); border: 1px solid rgba(255,255,255,.12); font-size: 14px; font-weight: 700; text-align: center; animation: fadein 0.2s ease; }

@media (prefers-reduced-motion: reduce) {
  .blob, .empty svg { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
.toast-action { flex: none; padding: 6px 12px; border-radius: 99px; font-size: 14px; font-weight: 900; color: var(--ink); background: linear-gradient(135deg, var(--c1), var(--c2)); }

/* ---------- Overdue ---------- */
.task.overdue {
  border: 1.5px solid rgba(255, 90, 95, 0.75);
  background: linear-gradient(90deg, rgba(255, 69, 58, 0.24), var(--card) 70%);
  animation: lateGlow 2.2s ease-in-out infinite;
}
.task.overdue .orb { border-style: dashed; }
.task.overdue .orb::after { content: "!"; position: absolute; top: -7px; right: -7px; width: 17px; height: 17px; border-radius: 50%; background: #ff3b47; color: #fff; font-size: 12px; font-weight: 900; line-height: 17px; text-align: center; box-shadow: 0 0 8px #ff3b47; }
.badge.late { color: #fff; background: linear-gradient(135deg, #ff3b47, #ff6a3d); }
@keyframes lateGlow { 50% { box-shadow: 0 0 18px rgba(255, 59, 71, 0.45); } }
.overdue-strip { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 16px; background: linear-gradient(90deg, rgba(255, 59, 71, 0.28), rgba(255, 106, 61, 0.12)); border: 1px solid rgba(255, 90, 95, 0.5); font-size: 15px; margin-bottom: -6px; }
.overdue-strip svg { width: 18px; height: 18px; color: #ff5a5f; flex: none; }
.overdue-strip b { font-weight: 900; }
.overdue-strip span { margin-left: auto; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.75); }
.tab .count.late { background: #ff3b47; color: #fff; box-shadow: 0 0 8px #ff3b47; }
@media (prefers-reduced-motion: reduce) { .task.overdue { animation: none; } }

/* ---------- Complete vs open ---------- */
.task { padding-left: 6px; gap: 8px; }
.orb-hit { flex: none; width: 50px; height: 50px; margin: -6px 0; display: grid; place-items: center; border-radius: 50%; }
.orb-hit:active .orb { transform: scale(0.88); }
.orb { transition: background 0.25s, box-shadow 0.3s, border-color 0.25s, transform 0.15s; }
.chev { flex: none; width: 18px; height: 18px; color: rgba(255, 255, 255, 0.3); margin-left: 2px; }
.chev svg { width: 100%; height: 100%; }
.task.pressing { transform: scale(0.98); background: rgba(255, 255, 255, 0.1); }

/* ---------- Snoozed ---------- */
.snoozed { display: grid; gap: 8px; }
.snoozed-toggle { justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); border: 1px dashed rgba(255, 255, 255, 0.22); font-size: 14px; font-weight: 800; color: var(--dim); }
.snoozed-toggle svg { width: 15px; height: 15px; }
.snoozed-toggle .snz-chev { transform: rotate(90deg); transition: transform 0.25s; }
.snoozed-toggle.open .snz-chev { transform: rotate(-90deg); }
.snoozed-list { display: grid; gap: 8px; }
.snoozed-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 18px; text-align: left; background: rgba(255, 255, 255, 0.04); border: 1px dashed rgba(255, 255, 255, 0.16); opacity: 0.8; }
.snz-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--hue); flex: none; opacity: 0.7; }
.snz-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.snoozed-row small { flex: none; font-size: 12px; font-weight: 700; color: var(--dim); }

/* ---------- Task sheet extras ---------- */
.snooze-box { padding: 14px; border-radius: 20px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--card-stroke); display: grid; gap: 10px; }
.snooze-box .section-label { margin: 0; display: flex; align-items: center; gap: 6px; }
.lbl-ic { width: 14px; height: 14px; }
.pill.snz { flex-direction: column; gap: 1px; padding: 10px 8px; }
.pill.snz small { font-size: 11px; font-weight: 600; color: var(--dim); }
.pill.mini { padding: 7px 12px; font-size: 13px; margin-left: auto; color: var(--ink); background: linear-gradient(135deg, var(--a), var(--b)); }
.snoozed-note { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.pick-date { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); font-size: 15px; font-weight: 800; cursor: pointer; }
.pick-date svg { width: 16px; height: 16px; }
.pick-date input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; color-scheme: dark; }
.menu-item.center { justify-content: center; }

/* ---------- Sign-in ---------- */
.auth-lede { font-size: 15px; margin-top: -8px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 15px; border-radius: 99px; background: #fff; color: #1f1f1f; font-size: 17px; font-weight: 800; }
.google-btn svg { width: 20px; height: 20px; }
.google-btn:disabled, .auth-form button:disabled { opacity: 0.5; }
.or { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.15); }
.auth-form { display: grid; gap: 10px; }
.auth-field { font-size: 17px; padding: 15px 16px; }
.auth-error { margin: 0; font-size: 14px; font-weight: 700; color: #ff7b80; }
.auth-error.ok { color: var(--green); }
.auth-links { display: flex; justify-content: space-between; }
.auth-links button { font-size: 14px; font-weight: 700; color: var(--a); padding: 8px 2px; }
.menu-item.account { cursor: default; }

/* Sync status: a small dot on the settings button */
.settings-btn { position: relative; }
:root[data-sync] .settings-btn::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
:root[data-sync="saving"] .settings-btn::after { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
:root[data-sync="offline"] .settings-btn::after, :root[data-sync="off"] .settings-btn::after { background: rgba(255,255,255,.4); box-shadow: none; }
:root[data-sync="error"] .settings-btn::after { background: #ff3b47; box-shadow: 0 0 6px #ff3b47; }

/* ---------- Past tasks button ---------- */
.history-btn { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 18px; background: linear-gradient(90deg, color-mix(in srgb, var(--a) 16%, transparent), rgba(255,255,255,.04)); border: 1px solid color-mix(in srgb, var(--a) 30%, transparent); text-align: left; }
.history-btn svg { width: 18px; height: 18px; color: var(--a); flex: none; }
.history-btn .h-label { font-size: 16px; font-weight: 800; }
.history-btn .h-sub { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--dim); }
.history-btn .h-chev { width: 15px; height: 15px; color: rgba(255,255,255,.35); }

/* ---------- History sheet ---------- */
.h-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.h-stat { padding: 10px 8px; border-radius: 16px; text-align: center; background: color-mix(in srgb, var(--col) 12%, transparent); border: 1px solid color-mix(in srgb, var(--col) 30%, transparent); min-width: 0; }
.h-stat b { display: block; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; }
.h-stat small { display: block; font-size: 10px; font-weight: 700; color: var(--dim); opacity: .8; }
.h-stat span { display: block; font-size: 11px; font-weight: 700; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heatmap-wrap { padding: 14px; border-radius: 20px; background: rgba(255,255,255,.05); border: 1px solid var(--card-stroke); }
.hm-months { display: grid; gap: 4px; margin-bottom: 6px; font-size: 10px; font-weight: 800; color: var(--dim); }
.hm-months span { white-space: nowrap; overflow: visible; }
.heatmap { display: grid; grid-template-rows: repeat(7, auto); gap: 4px; }
.hm-cell { display: block; aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,.07); padding: 0; transition: transform 0.15s; }
.hm-cell.future { background: transparent; }
.hm-cell.l1 { background: rgba(255,45,135,.45); }
.hm-cell.l2 { background: #ff2d87; box-shadow: 0 0 4px rgba(255,45,135,.6); }
.hm-cell.l3 { background: #ff8a00; box-shadow: 0 0 6px rgba(255,138,0,.7); }
.hm-cell.l4 { background: #ffd60a; box-shadow: 0 0 8px rgba(255,214,10,.8); }
.hm-cell.today { outline: 2px solid #fff; outline-offset: 1px; }
button.hm-cell:active { transform: scale(1.4); }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 11px; font-weight: 700; color: var(--dim); }
.hm-legend .hm-cell { width: 12px; }
.timeline { display: grid; gap: 18px; }
.tl-group { display: grid; gap: 8px; scroll-margin-top: 12px; border-radius: 16px; }
.tl-group.flash-row { animation: tlflash 1.2s ease; }
@keyframes tlflash { 20% { background: rgba(255, 214, 10, .18); box-shadow: 0 0 0 6px rgba(255, 214, 10, .18); } }
.tl-day { position: relative; display: flex; align-items: baseline; gap: 8px; padding-bottom: 6px; }
.tl-day b { font-size: 17px; font-weight: 900; }
.tl-day span { font-size: 13px; font-weight: 700; color: var(--dim); }
.tl-bar { position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 3px; background: linear-gradient(90deg, #ff2d87, #ff8a00, #ffd60a); }
.tl-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,.05); }
.tl-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #fff, var(--hue) 70%); box-shadow: 0 0 10px color-mix(in srgb, var(--hue) 60%, transparent); }
.tl-dot svg { width: 13px; height: 13px; color: var(--ink); }
.tl-text { flex: 1; min-width: 0; }
.tl-title { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.tl-kind { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--dim); margin-top: 2px; }
.tl-item time { flex: none; font-size: 12px; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---------- Work / Personal ---------- */
:root[data-space="work"] { --bg: #030a18; --s1: #00c8ff; --s2: #3d5afe; --o1: #ff3d9a; --o2: #b14dff; }
.space-glow { position: absolute; inset: 0; opacity: 0; transition: opacity 0.9s ease; }
.sg-personal { background: radial-gradient(130% 75% at 80% 0%, rgba(177, 77, 255, 0.75), transparent 62%), radial-gradient(110% 70% at 0% 100%, rgba(255, 61, 154, 0.55), transparent 65%), linear-gradient(180deg, #1a0822, #0d0611); }
.sg-work { background: radial-gradient(130% 75% at 20% 0%, rgba(0, 200, 255, 0.65), transparent 62%), radial-gradient(110% 70% at 100% 100%, rgba(61, 90, 254, 0.65), transparent 65%), linear-gradient(180deg, #04142a, #030a18); }
:root:not([data-space="work"]) .sg-personal, :root[data-space="work"] .sg-work { opacity: 1; }
.blob { mix-blend-mode: screen; }
.b1 { opacity: 0.32; } .b2 { opacity: 0.22; } .b3 { opacity: 0.14; }

.spacebar { position: fixed; z-index: 9; top: calc(var(--safe-top) + 10px); left: 50%; translate: -50% 0; }
.space-toggle {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; width: 236px; padding: 4px; border-radius: 99px;
  /* The track shows the space you're NOT in; the knob carries the active one. */
  background: linear-gradient(135deg, var(--o1), var(--o2));
  box-shadow: 0 6px 22px color-mix(in srgb, var(--o2) 45%, transparent), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  transition: background 0.5s, box-shadow 0.5s;
}
.space-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 99px;
  background: linear-gradient(135deg, var(--s1), var(--s2));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform 0.5s cubic-bezier(.34, 1.4, .64, 1), background 0.5s;
}
:root:not([data-space="work"]) .space-thumb { transform: translateX(100%); }
.space-toggle button { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 0; border-radius: 99px; font-size: 15px; font-weight: 800; color: rgba(7, 6, 13, 0.75); transition: color 0.3s; }
.space-toggle button svg { width: 16px; height: 16px; }
.space-toggle button[aria-checked="true"] { color: #fff; font-weight: 900; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }

/* ---------- Keyboard hint (only where there's a keyboard and mouse) ---------- */
.kbd-hint { display: none; margin: -8px 0 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--dim); }
.kbd-hint kbd { font-family: inherit; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); color: #fff; }
@media (hover: hover) and (pointer: fine) { .kbd-hint { display: block; } }

/* ---------- Desktop: sheets open as a centered dialog ---------- */
@media (min-width: 700px) and (min-height: 500px) {
  .sheet {
    top: 50%; bottom: auto; translate: 0 -50%;
    width: min(560px, calc(100% - 48px));
    max-height: min(88vh, 900px);
    border-radius: 30px; border-bottom: 1px solid rgba(255,255,255,.1);
    padding-bottom: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: dialogIn 0.32s cubic-bezier(.2, 1.2, .3, 1);
  }
  .sheet.closing { animation: dialogOut 0.2s ease-in forwards; }
  .toast { bottom: auto; top: calc(var(--safe-top) + 64px); }
}
@keyframes dialogIn { from { opacity: 0; transform: scale(0.94) translateY(12px); } }
@keyframes dialogOut { to { opacity: 0; transform: scale(0.96); } }

.moved-banner { position: fixed; z-index: 11; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 80px); max-width: 536px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, #00c8ff, #3d5afe); color: #fff; font-size: 14px; font-weight: 800; text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.moved-banner svg { width: 18px; height: 18px; flex: none; }

/* ---------- Back to dashboard ---------- */
.home-btn {
  position: fixed; z-index: 9; top: calc(var(--safe-top) + 12px); left: max(14px, calc(50% - 280px));
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: rgba(20, 18, 30, 0.55); border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); transition: transform 0.2s, background 0.2s;
}
.home-btn svg { width: 19px; height: 19px; }
.home-btn:hover { background: rgba(255, 255, 255, 0.16); }
.home-btn:active { transform: scale(0.9); }
.skip-btn { width: 100%; }

/* ---------- Goal history ---------- */
.hm-cell.gn { background: rgba(255,255,255,.07); }
.hm-cell.gx { background: rgba(255, 77, 90, .55); }
.hm-cell.g1 { background: rgba(0, 245, 160, .28); }
.hm-cell.g2 { background: rgba(0, 245, 160, .5); }
.hm-cell.g3 { background: #2fe3a0; box-shadow: 0 0 5px rgba(0,245,160,.6); }
.hm-cell.g4 { background: #7dffcb; box-shadow: 0 0 9px rgba(0,245,160,.9); }
.tl-bar.mixed { background: linear-gradient(90deg, #00f5a0 var(--hitpct), #ff4d5a var(--hitpct)); }
.tl-item.miss { background: rgba(255, 77, 90, .08); border: 1px dashed rgba(255, 77, 90, .35); }
.tl-item.miss .tl-dot { background: rgba(255, 77, 90, .25); box-shadow: none; }
.tl-item.miss .tl-dot svg { color: #ff6b76; }
.tl-item.miss .tl-title { color: rgba(255,255,255,.75); }
.tl-item.miss time { color: #ff7b85; }

/* ---------- Push to tomorrow ---------- */
.swipe-push { position: absolute; inset: 0; border-radius: 22px; display: flex; align-items: center; justify-content: flex-start; gap: 7px; padding-left: 22px; color: #04121f; font-size: 15px; font-weight: 900; background: linear-gradient(90deg, #00e5ff, #4d7cff); opacity: 0; }
.swipe-push svg { width: 19px; height: 19px; transition: transform 0.25s cubic-bezier(.34, 1.8, .64, 1); }
.swipe-row.armed-push .swipe-push svg { transform: translateX(6px) scale(1.3); }
.push-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: 18px; text-align: left; color: #04121f; background: linear-gradient(135deg, #00e5ff, #4d7cff); box-shadow: 0 6px 18px rgba(0, 150, 255, 0.35); }
.push-btn svg { width: 22px; height: 22px; flex: none; }
.push-btn span { display: grid; font-size: 17px; font-weight: 900; }
.push-btn small { font-size: 12px; font-weight: 700; opacity: 0.75; }
.push-btn:active { transform: scale(0.98); }
.push-all { align-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 800; color: #9fe8ff; background: rgba(0, 229, 255, 0.1); border: 1px solid rgba(0, 229, 255, 0.35); margin-top: -6px; }
.push-all svg { width: 16px; height: 16px; }

/* ---------- Period picker ---------- */
.title-btn { display: inline-flex; align-items: center; gap: 6px; justify-self: start; align-self: flex-start; padding: 0; text-align: left; border-radius: 12px; }
.title-caret { width: 22px; height: 22px; color: var(--a); transform: rotate(90deg); transition: transform 0.25s; flex: none; }
.page.strip-open .title-caret { transform: rotate(-90deg); }
.page.past .hero h1 { font-size: clamp(28px, 8vw, 36px); }
.back-now { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 800; color: var(--ink); background: linear-gradient(135deg, var(--a), var(--b)); }
.back-now svg { width: 14px; height: 14px; }
.page.past .ring-wrap { opacity: 0.85; }
.period-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: -6px -2px 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.period-strip::-webkit-scrollbar { display: none; }
.pchip { position: relative; flex: none; min-width: 74px; display: grid; gap: 2px; padding: 9px 12px 12px; border-radius: 16px; text-align: left; background: rgba(255,255,255,.07); border: 1px solid var(--card-stroke); overflow: hidden; }
.pchip b { font-size: 13px; font-weight: 900; white-space: nowrap; }
.pchip small { font-size: 11px; font-weight: 700; color: var(--dim); }
.pchip .pbar { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--pct); background: linear-gradient(90deg, var(--a), var(--b)); }
.pchip.on { background: linear-gradient(135deg, color-mix(in srgb, var(--a) 35%, transparent), color-mix(in srgb, var(--b) 25%, transparent)); border-color: var(--a); }
.pchip.on small { color: #fff; }
.page.future .back-now svg { transform: rotate(180deg); }
.pchip.ahead { border-style: dashed; }
.pchip.ahead small { color: color-mix(in srgb, var(--a) 70%, #fff); }
.pchip.now:not(.on) { border-color: color-mix(in srgb, var(--a) 55%, transparent); }
.page.future .task .orb { border-style: dashed; opacity: 0.7; }
