/* ── Top bar ───────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.topbar .date { color: var(--ink-3); font-size: 0.85rem; font-weight: 600; }
.topbar .greet { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px 7px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-weight: 800;
  font-size: 0.95rem;
  font-family: var(--font-num);
  transition: transform var(--t-fast) var(--ease-spring);
}
.streak-chip:active { transform: scale(0.94); }
.streak-chip .flame { font-size: 1.05rem; filter: saturate(1.2); }
.streak-chip.hot {
  background: linear-gradient(135deg, hsl(24 90% 55% / 0.22), hsl(350 90% 60% / 0.16));
  border-color: hsl(24 90% 60% / 0.4);
  color: var(--label-anchor);
}
.streak-chip.risk { border-color: hsl(45 90% 55% / 0.45); color: var(--warn); }

/* ── Hero: the day's shape at a glance ─────────────────────────────────── */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-2);
  margin-bottom: var(--s-5);
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-dawn);
  opacity: 0.5;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }

.ring { flex: 0 0 auto; width: 74px; height: 74px; }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .track { stroke: var(--surface-3); }
.ring .fill {
  stroke: url(#ringGrad);
  transition: stroke-dashoffset var(--t-slow) var(--ease-out);
}
.ring text {
  fill: var(--ink);
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 22px;
  text-anchor: middle;
}

.hero-copy h2 { font-size: 1.06rem; margin-bottom: 3px; }
.hero-copy p { color: var(--ink-3); font-size: 0.86rem; line-height: 1.4; }

/* ── XP bar ────────────────────────────────────────────────────────────── */

.xp {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  font-size: 0.78rem;
  color: var(--ink-3);
  font-weight: 600;
}
.xp-track {
  flex: 1;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--hairline);
}
.xp-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-sun);
  transition: width var(--t-slow) var(--ease-out);
}

/* ── Slot sections ─────────────────────────────────────────────────────── */

.slot-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: var(--s-5) 2px var(--s-3);
}
.slot-head:first-of-type { margin-top: 0; }
.slot-head .name { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.slot-head .why { font-size: 0.75rem; color: var(--ink-4); flex: 1; min-width: 0; }

.slot-anchor .name { color: var(--label-anchor); }
.slot-win    .name { color: var(--label-win); }
.slot-spark  .name { color: var(--label-spark); }
.slot-chore  .name { color: var(--ink-2); }
.slot-extra  .name { color: var(--ink-2); }

/* ── Goal card ─────────────────────────────────────────────────────────── */

/* Swipe container. The card slides; the action hint sits behind it. */
.swipe {
  position: relative;
  margin-bottom: var(--s-3);
  border-radius: var(--r-lg);
  overflow: hidden;
  touch-action: pan-y;   /* let vertical scrolling through, own the x-axis */
}

.swipe-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-5);
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: inherit;
  background: var(--surface-2);
}
.swipe-bg .do { color: var(--ok); opacity: 0; transition: opacity var(--t-fast); }
.swipe-bg .skip { color: var(--ink-3); opacity: 0; transition: opacity var(--t-fast); }
.swipe.at-do   .swipe-bg { background: var(--ok-dim); }
.swipe.at-do   .do   { opacity: 1; }
.swipe.at-skip .skip { opacity: 1; }
.swipe.sliding .card { transition: none; }
.swipe .card { margin-bottom: 0; }

.card {
  --hue: 220;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform var(--t-fast) var(--ease-out),
              opacity var(--t-med) var(--ease-out),
              border-color var(--t-med) var(--ease-out);
  animation: cardIn var(--t-med) var(--ease-out) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* A soft colour wash keyed to the goal's category. */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg,
    hsl(var(--hue) 80% 55% / 0.13), hsl(var(--hue) 80% 55% / 0.02) 55%, transparent);
  pointer-events: none;
  transition: opacity var(--t-med);
}
.card > * { position: relative; z-index: 1; }

.card:active { transform: scale(0.988); }

.card.done {
  opacity: 0.55;
  border-color: hsl(157 68% 55% / 0.3);
}
.card.done::before { opacity: 0.25; }
.card.done .card-title { text-decoration: line-through; text-decoration-color: var(--ink-4); }

.card.skipped { opacity: 0.4; }
.card.skipped .card-title { text-decoration: line-through; }

.card.pop { animation: pop var(--t-slow) var(--ease-spring); }
@keyframes pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.035); }
  100% { transform: scale(1); }
}

/* Check button — the most-tapped thing in the app, so it's big. */
.check {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2.5px solid var(--hairline-firm);
  display: grid;
  place-items: center;
  transition: all var(--t-med) var(--ease-spring);
  position: relative;
}
/* Enlarge the touch target well past the visual circle. */
.check::after {
  content: '';
  position: absolute;
  inset: -11px;
  border-radius: 50%;
}
.check svg { width: 17px; height: 17px; stroke: var(--brand-ink); stroke-width: 3.5;
             fill: none; stroke-linecap: round; stroke-linejoin: round;
             opacity: 0; transform: scale(0.4); transition: all var(--t-med) var(--ease-spring); }
.check:active { transform: scale(0.85); }

.card.done .check {
  background: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 0 6px var(--ok-dim);
}
.card.done .check svg { opacity: 1; transform: none; stroke: #06281c; }

.card-body { flex: 1; min-width: 0; }

.card-title {
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.32;
  letter-spacing: -0.012em;
}

.card-why {
  margin-top: 5px;
  font-size: 0.82rem;
  color: var(--ink-3);
  line-height: 1.4;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-3);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.cat {
  background: hsl(var(--hue) 70% 55% / 0.15);
  border-color: hsl(var(--hue) 70% 55% / 0.28);
  color: hsl(var(--hue) 70% var(--cat-text-l));
}

.chip.pace { font-family: var(--font-num); }
.chip.pace.behind { color: var(--warn); border-color: hsl(45 90% 55% / 0.3); }
.chip.pace.ontrack { color: var(--ok); border-color: hsl(157 68% 55% / 0.3); }

/* Row of small actions revealed on the card */
.card-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
  align-self: flex-start;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--ink-4);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink-2); }
.icon-btn:active { transform: scale(0.88); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2;
                fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin var(--t-slow) var(--ease-out); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 var(--s-5);
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink);
  transition: transform var(--t-fast) var(--ease-spring), filter var(--t-fast), background var(--t-fast);
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: var(--gradient-sun);
  color: var(--brand-ink);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: hsl(0 80% 65% / 0.3); }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; fill: none;
           stroke-linecap: round; stroke-linejoin: round; }

.btn-row { display: flex; gap: var(--s-2); }
.btn-row > * { flex: 1; }

/* ── Bottom navigation ─────────────────────────────────────────────────── */

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: hsl(230 14% 7% / 0.82);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--hairline);
}
:root[data-theme='light'] .nav { background: hsl(40 30% 98% / 0.86); }

.nav-inner {
  max-width: var(--app-max);
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-4);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
  transition: color var(--t-fast);
}
.nav-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2;
               fill: none; stroke-linecap: round; stroke-linejoin: round;
               transition: transform var(--t-med) var(--ease-spring); }
.nav-btn[aria-current='page'] { color: var(--label-anchor); }
.nav-btn[aria-current='page'] svg { transform: translateY(-2px) scale(1.08); }
.nav-btn[aria-current='page']::before {
  content: '';
  position: absolute;
  top: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: hsl(24 90% 55% / 0.16);
  animation: navPop var(--t-med) var(--ease-spring);
}
@keyframes navPop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.nav-btn:active svg { transform: scale(0.85); }

.nav-dot {
  position: absolute;
  top: 8px; right: 50%;
  margin-right: -16px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--sun-2);
  box-shadow: 0 0 0 2px var(--bg);
}

/* ── Sheet (bottom modal) ──────────────────────────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: hsl(0 0% 0% / 0.6);
  backdrop-filter: blur(3px);
  animation: fade var(--t-med) var(--ease-out);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 51;
  max-width: var(--app-max);
  margin: 0 auto;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1px solid var(--hairline);
  border-bottom: none;
  box-shadow: var(--shadow-3);
  padding-bottom: var(--safe-b);
  animation: sheetUp var(--t-med) var(--ease-out);
  touch-action: pan-y;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet.closing { animation: sheetDown var(--t-fast) var(--ease-out) forwards; }
@keyframes sheetDown { to { transform: translateY(100%); } }

.sheet-grip {
  width: 42px; height: 4px;
  border-radius: 2px;
  background: var(--hairline-firm);
  margin: var(--s-3) auto var(--s-2);
  flex: 0 0 auto;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-5) var(--s-3);
  flex: 0 0 auto;
}
.sheet-head h2 { font-size: 1.15rem; }
.sheet-body { padding: 0 var(--s-5) var(--s-5); overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.field { margin-bottom: var(--s-4); }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.input, .textarea, select.input {
  width: 100%;
  min-height: 50px;
  padding: 13px var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 1rem; /* 16px stops iOS zoom-on-focus */
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input:focus, .textarea:focus { border-color: hsl(24 90% 60% / 0.55); outline: none; }
.textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }

/* Segmented control */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}
.seg button {
  flex: 1;
  min-height: 40px;
  border-radius: calc(var(--r-md) - 5px);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-3);
  transition: all var(--t-fast) var(--ease-out);
}
.seg button[aria-pressed='true'] {
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.seg.accent button[aria-pressed='true'] {
  background: var(--gradient-sun);
  color: var(--brand-ink);
}

/* Choice pills (categories etc.) */
.pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  padding: 9px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink-2);
  transition: all var(--t-fast) var(--ease-out);
}
.pill[aria-pressed='true'] {
  --hue: 24;
  background: hsl(var(--hue) 80% 55% / 0.2);
  border-color: hsl(var(--hue) 80% 60% / 0.5);
  color: hsl(var(--hue) 85% 72%);
}
:root[data-theme='light'] .pill[aria-pressed='true'] { color: hsl(var(--hue) 70% 32%); }
.pill:active { transform: scale(0.94); }

/* Toggle row */
.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--hairline);
}
.row:last-child { border-bottom: none; }
.row-body { flex: 1; min-width: 0; }
.row-body .t { font-weight: 650; font-size: 0.95rem; }
.row-body .d { font-size: 0.79rem; color: var(--ink-3); margin-top: 2px; line-height: 1.35; }

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 50px; height: 30px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  position: relative;
  transition: background var(--t-med) var(--ease-out);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink-2);
  transition: all var(--t-med) var(--ease-spring);
}
.switch[aria-checked='true'] { background: var(--gradient-sun); border-color: transparent; }
.switch[aria-checked='true']::after { left: 25px; background: #fff; }

/* ── Cards / panels ────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-1);
}
.panel-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s-3);
}

.empty {
  text-align: center;
  padding: var(--s-7) var(--s-4);
  color: var(--ink-3);
}
.empty .big { font-size: 2.6rem; margin-bottom: var(--s-3); }
.empty p { font-size: 0.9rem; line-height: 1.5; max-width: 30ch; margin: 0 auto var(--s-4); }

/* ── Toast ─────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 var(--s-4);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 12px var(--s-4);
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--hairline-firm);
  box-shadow: var(--shadow-3);
  font-size: 0.88rem;
  font-weight: 650;
  animation: toastIn var(--t-med) var(--ease-spring);
}
.toast.leaving { animation: toastOut var(--t-fast) var(--ease-out) forwards; }
.toast .undo { color: var(--label-anchor); font-weight: 800; padding: 0 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.96); } }

/* ── Celebration overlay ───────────────────────────────────────────────── */

#fx {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

.banner {
  position: fixed;
  inset: 0;
  z-index: 71;
  display: grid;
  place-items: center;
  padding: var(--s-5);
  background: hsl(0 0% 0% / 0.55);
  backdrop-filter: blur(6px);
  animation: fade var(--t-med);
}
.banner-card {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--hairline-firm);
  border-radius: var(--r-xl);
  padding: var(--s-6) var(--s-5);
  box-shadow: var(--shadow-3);
  max-width: 340px;
  animation: bannerIn var(--t-slow) var(--ease-spring);
}
@keyframes bannerIn { from { transform: scale(0.82) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.banner-card .emoji { font-size: 3.4rem; line-height: 1; margin-bottom: var(--s-3);
                      animation: bob 1.6s var(--ease-out) infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.banner-card h2 { font-size: 1.5rem; margin-bottom: var(--s-2); }
.banner-card p { color: var(--ink-3); font-size: 0.92rem; margin-bottom: var(--s-5); line-height: 1.5; }

/* ── Progress view bits ────────────────────────────────────────────────── */

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { text-align: center; }
.week-day .l { font-size: 0.68rem; font-weight: 800; color: var(--ink-4); margin-bottom: 5px; }
.week-day .dot {
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-num);
  color: var(--ink-4);
  transition: all var(--t-med) var(--ease-out);
}
.week-day .dot.has {
  background: var(--gradient-sun);
  border-color: transparent;
  color: var(--brand-ink);
}
.week-day .dot.partial { background: hsl(24 80% 55% / 0.28); border-color: hsl(24 80% 55% / 0.4); color: var(--sun-1); }
.week-day.today .dot { box-shadow: 0 0 0 2px var(--sun-1); }

.heat { display: grid; grid-template-columns: repeat(auto-fit, minmax(9px, 1fr)); gap: 3px; }
.heat i {
  aspect-ratio: 1;
  border-radius: 2.5px;
  background: var(--surface-2);
  display: block;
}
.heat i[data-l='1'] { background: hsl(24 80% 55% / 0.28); }
.heat i[data-l='2'] { background: hsl(24 85% 55% / 0.52); }
.heat i[data-l='3'] { background: hsl(24 90% 57% / 0.78); }
.heat i[data-l='4'] { background: var(--sun-1); }

/* Label on its own line above the bar: goal titles are sentences, and
   squeezing them into a fixed column turned every one into "Move your…". */
.bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'lbl val' 'bar bar';
  align-items: center;
  column-gap: var(--s-3);
  row-gap: 6px;
  margin-bottom: var(--s-4);
}
.bar-row .lbl {
  grid-area: lbl;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-2);
  line-height: 1.3;
  /* Two lines maximum, then ellipsis — keeps rows scannable. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bar-track { grid-area: bar; height: 9px; border-radius: var(--r-pill);
             background: var(--surface-2); overflow: hidden; }
/* display:block is load-bearing. This is a <span> inside the track, and width
   and height do not apply to a non-replaced inline element — so every bar in
   the app drew an empty groove regardless of the percentage set on it. The
   track itself was fine only because grid-area makes it a grid item, which
   blockifies it. */
/* Checkboxes in sheets. The browser default is 13px, and even bumped to 20
   it fails WCAG 2.5.8 — so the box stays small to look at and carries an
   invisible 44px target, the same trick the icon buttons use. */
.check-row {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  line-height: 1.5;
  cursor: pointer;
  min-height: 44px;
  padding: var(--s-2) 0;
}
.check-row input[type='checkbox'] {
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--sun-1);
}
.check-row input[type='checkbox']::after {
  content: '';
  position: absolute;
  inset: -11px;
}

.bar-fill { display: block; height: 100%; border-radius: inherit;
            background: hsl(var(--hue) 75% 58%);
            transition: width var(--t-slow) var(--ease-out); }
.bar-row .val { grid-area: val; font-size: 0.78rem; font-weight: 700; color: var(--ink-3);
                font-family: var(--font-num); white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); margin-bottom: var(--s-4); }
.stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.stat .v { font-size: 1.7rem; font-weight: 800; font-family: var(--font-num); letter-spacing: -0.02em; }
.stat .k { font-size: 0.74rem; font-weight: 700; color: var(--ink-4); text-transform: uppercase;
           letter-spacing: 0.07em; margin-top: 2px; }

/* ── Goals list ────────────────────────────────────────────────────────── */

.list-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--hairline);
  margin-bottom: var(--s-2);
  --hue: 220;
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.list-item:active { transform: scale(0.99); }
.list-item.off { opacity: 0.45; }
.list-item .dotcat {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  background: hsl(var(--hue) 75% 58%);
}
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 0.93rem; font-weight: 620; line-height: 1.3; }
.list-item .li-sub { font-size: 0.74rem; color: var(--ink-4); margin-top: 2px; }

.search-wrap { position: relative; margin-bottom: var(--s-3); }
.search-wrap .input { padding-left: 42px; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; stroke: var(--ink-4); stroke-width: 2; fill: none;
}

.filter-scroll {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-3);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-scroll .pill { flex: 0 0 auto; }

/* Floating add button */
.fab {
  position: fixed;
  right: max(var(--s-4), calc(50vw - var(--app-max) / 2 + var(--s-4)));
  bottom: calc(var(--nav-h) + var(--safe-b) + var(--s-4));
  z-index: 41;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gradient-sun);
  color: var(--brand-ink);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-glow), var(--shadow-2);
  transition: transform var(--t-fast) var(--ease-spring);
}
.fab:active { transform: scale(0.9); }
.fab svg { width: 25px; height: 25px; stroke: currentColor; stroke-width: 2.8; fill: none;
           stroke-linecap: round; }

/* ── Onboarding ────────────────────────────────────────────────────────── */

.onb { text-align: center; padding-top: var(--s-6); }
/* The mark, not the 🌅 that used to sit here. The app ships a drawn icon that
   every home screen and every share card uses, and the one screen that
   introduces the product was showing a platform emoji instead — a different
   picture on Android, iOS and desktop, none of them the logo. */
.onb .logo { width: 84px; height: 84px; border-radius: 22px; display: block;
             margin: 0 auto var(--s-4); box-shadow: var(--shadow-2);
             animation: bob 3s var(--ease-out) infinite; }
.onb h1 { font-size: 2rem; margin-bottom: var(--s-3); }
.onb p { color: var(--ink-3); line-height: 1.55; margin-bottom: var(--s-5); font-size: 0.95rem; }
.onb-step { animation: viewIn var(--t-med) var(--ease-out) both; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: var(--s-5); }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); transition: all var(--t-med); }
.dots i.on { background: var(--sun-1); width: 20px; border-radius: var(--r-pill); }

/* ── Card body as a tap target ─────────────────────────────────────────── */

.card-body {
  /* The whole body opens the detail sheet — a much bigger target than an
     icon, which matters most on the screen you use one-handed. */
  text-align: left;
  cursor: pointer;
}

/* ── "Why this?" reason line ───────────────────────────────────────────── */

.card-reason {
  display: flex;
  /* Pin the icon to the first line rather than centring it against a
     two-line reason. */
  align-items: flex-start;
  gap: 5px;
  margin-top: 8px;
  font-size: 0.74rem;
  font-weight: 650;
  /* Tinted by the goal's category. The lightness is a token because the
     value that reads as text differs per theme, and has to clear 4.5:1 for
     the worst of the nine hues. */
  color: hsl(var(--hue) 70% var(--cat-text-l));
  line-height: 1.35;
}
.card-reason svg { margin-top: 2px; }
.card-reason.urgent { color: var(--warn); }
.card.done .card-reason { display: none; }

/* ── Focus timer ───────────────────────────────────────────────────────── */

.timer {
  text-align: center;
  padding: var(--s-3) 0 var(--s-5);
}
.timer-ring { width: 216px; height: 216px; margin: 0 auto var(--s-4); position: relative; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.timer-ring .track { stroke: var(--surface-2); }
.timer-ring .fill  { stroke: url(#ringGrad); transition: stroke-dashoffset 1s linear; }
.timer-ring.paused .fill { opacity: 0.4; }
.timer-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 2px;
}
.timer-face .t {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 3.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.timer-face .s { font-size: 0.76rem; font-weight: 700; color: var(--ink-4);
                 text-transform: uppercase; letter-spacing: 0.1em; }
.timer-goal { font-size: 1rem; font-weight: 650; line-height: 1.35; margin-bottom: var(--s-5); }
.timer-presets { display: flex; gap: 6px; justify-content: center; margin-bottom: var(--s-4); }
.timer-presets .pill { min-width: 58px; justify-content: center; }

/* ── Insights ──────────────────────────────────────────────────────────── */

.insight {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--hairline);
}
.insight:last-child { border-bottom: none; padding-bottom: 0; }
.insight .ic { flex: 0 0 auto; font-size: 1.35rem; line-height: 1.3; }
.insight .it { font-weight: 700; font-size: 0.95rem; line-height: 1.3; margin-bottom: 3px; }
.insight .ix { font-size: 0.83rem; color: var(--ink-3); line-height: 1.5; }
.insight.muted-insight .it { color: var(--ink-2); font-weight: 650; }

/* ── Inline icons ──────────────────────────────────────────────────────── */

/* An <svg> dropped into flowing text has no intrinsic sizing to inherit, so
   it falls back to its default 300×150 box and paints its shapes filled
   black. Buttons already constrain their icons; these contexts did not. */
.chip svg,
.card-reason svg,
.list-item svg,
.panel-title svg,
.row-body svg {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Sparkline ─────────────────────────────────────────────────────────── */

.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 56px;
}
.spark i {
  flex: 1;
  min-height: 3px;
  border-radius: 3px 3px 1px 1px;
  background: hsl(var(--hue) 75% 58%);
  opacity: 0.9;
  transition: height var(--t-slow) var(--ease-out);
}
.spark i[style*="height: 3%"] { background: var(--surface-3); }

/* A checkbox inside a plain row (past-day editing) needs its checkmark shown
   without the .card.done ancestor the Today view provides. */
.row .check.on svg { opacity: 1; transform: none; stroke: #06281c; }

/* ── Storage alarm ─────────────────────────────────────────────────────── */

/* Deliberately loud and deliberately not dismissible. Everything else in
   this app can wait; unsaved data cannot. */
.alarm {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: calc(var(--safe-t) * -1 - var(--s-4)) calc(var(--s-4) * -1) var(--s-4);
  padding: calc(var(--safe-t) + var(--s-4)) var(--s-4) var(--s-4);
  background: linear-gradient(180deg, hsl(0 75% 22%), hsl(0 70% 17%));
  border-bottom: 1px solid hsl(0 80% 45% / 0.5);
  color: #ffe9e9;
  box-shadow: var(--shadow-2);
  animation: alarmIn var(--t-med) var(--ease-out);
}
:root[data-theme='light'] .alarm {
  background: linear-gradient(180deg, hsl(0 80% 96%), hsl(0 75% 93%));
  color: hsl(0 60% 25%);
  border-bottom-color: hsl(0 70% 70%);
}
@keyframes alarmIn { from { transform: translateY(-100%); } to { transform: none; } }

.alarm .t { font-weight: 800; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.alarm .d { font-size: 0.83rem; line-height: 1.5; margin: 6px 0 var(--s-3); opacity: 0.92; }
.alarm .btn { min-height: 42px; background: hsl(0 0% 100% / 0.14); border-color: hsl(0 0% 100% / 0.25); color: inherit; }
/* Share the row when both labels fit, stack full-width when they do not.
   An even split made "Free up space" wrap onto two lines beside the shorter
   primary action; sizing to content left them ragged. */
.alarm .btn-row { flex-wrap: wrap; }
.alarm .btn-row > * { flex: 1 1 150px; }
.alarm .btn.primary { background: #fff; color: hsl(0 60% 25%); border-color: transparent; box-shadow: none; }
:root[data-theme='light'] .alarm .btn { background: hsl(0 0% 100% / 0.7); border-color: hsl(0 40% 80%); }

/* ── Journal ───────────────────────────────────────────────────────────── */

.jentry {
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--hairline);
}
.jentry:last-child { border-bottom: none; padding-bottom: 0; }
.jhead {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin-bottom: 5px;
}
.jdate { font-size: 0.8rem; font-weight: 750; color: var(--ink-2); }
.jmood { font-size: 0.78rem; }
.jcount {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-4);
}
.jtext {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
  /* Long reflections are worth reading in full inside the sheet, but the
     Progress preview should stay a preview. */
  overflow-wrap: anywhere;
}
.panel .jtext {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sheet .jtext { display: block; }
.jnote {
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--ink-3);
  margin-top: 6px;
  overflow-wrap: anywhere;
}

/* ── Hit targets ───────────────────────────────────────────────────────── */

/*
 * WCAG 2.5.8 asks for 24x24; every mobile platform asks for 44x44, and this
 * app is used one-handed on a phone. Controls that should stay visually
 * small grow an invisible overlay instead of getting bigger — the same trick
 * the check circle already used.
 */
.icon-btn { position: relative; }
.icon-btn::after {
  content: '';
  position: absolute;
  inset: -5px;
}

.switch::before {
  content: '';
  position: absolute;
  inset: -7px -4px;
}

/* These can simply be the right size. */
.pill { min-height: 44px; }
.seg button { min-height: 44px; }
.streak-chip { min-height: 44px; }
.list-item .li-body { min-height: 44px; display: flex; flex-direction: column;
                      justify-content: center; }

/*
 * Range inputs were browser-default: a 16px-tall strip, which fails even the
 * 24px minimum and is genuinely hard to hit on a phone. Styled explicitly so
 * the interactive area is 44px tall while the track still reads as a thin
 * line.
 */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--hairline);
}
input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--hairline);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--gradient-sun);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-1);
}
input[type='range']::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sun-1);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-1);
}
input[type='range']:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--sun-1); outline-offset: 2px; }
