@import url('/fonts/fonts.css');

/* ── Capture ────────────────────────────────────────────────────────────────
   Warm paper, ink, one apricot accent. Built for a thumb at 390px.
   Motion rule: entrances are choreographed once; everything else is feedback.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --bg:         #F6F1E8;
  --bg-sink:    #EFE8DB;
  --surface:    #FFFDFA;
  --surface-2:  #FBF6EE;
  --ink:        #1A1714;
  --ink-2:      #46403A;
  --muted:      #6F675B;
  --faint:      #8A8173;
  --hair:       #E6DCCB;
  --hair-soft:  #EFE7D9;
  --accent:     #C4562C;
  --accent-lo:  #F7E4D8;
  --done:       #5F8A5E;
  --over:       #B93B2C;
  --on-accent:  #fff;                 /* text drawn ON an accent fill */
  --on-done:    #fff;

  --sh-1: 0 1px 2px rgba(74,54,32,.04), 0 4px 12px -6px rgba(74,54,32,.10);
  --sh-2: 0 2px 6px rgba(74,54,32,.06), 0 16px 34px -14px rgba(74,54,32,.24);
  --sh-3: 0 3px 10px rgba(74,54,32,.09), 0 30px 60px -20px rgba(74,54,32,.34);

  --r:    18px;
  --r-sm: 12px;
  --rail: 74px;                       /* width of the time column */

  --sans:  'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;

  --quart: cubic-bezier(.25, 1, .5, 1);
  --quint: cubic-bezier(.22, 1, .36, 1);
  --expo:  cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #121110;
    --bg-sink:    #0D0C0B;
    --surface:    #1D1B18;
    --surface-2:  #232019;
    --ink:        #F4EFE6;
    --ink-2:      #D3CABC;
    --muted:      #978E81;
    --faint:      #6E665C;
    --hair:       #2F2A24;
    --hair-soft:  #262119;
    --accent:     #E2865A;
    --accent-lo:  #35251B;
    --done:       #7FA87C;
    --over:       #E07A66;

    --sh-1: 0 1px 2px rgba(0,0,0,.34), 0 4px 12px -6px rgba(0,0,0,.5);
    --sh-2: 0 2px 6px rgba(0,0,0,.4),  0 16px 34px -14px rgba(0,0,0,.62);
    --sh-3: 0 3px 10px rgba(0,0,0,.46), 0 30px 60px -20px rgba(0,0,0,.7);
  }
}

/* ── themes ─────────────────────────────────────────────────────────────
   Each theme restates every token, so switching can never leave a stray
   colour from the one before. Pick one in Settings; the choice is written to
   <html data-theme> before the first paint, so there is no flash of the wrong
   colours on load.
   ────────────────────────────────────────────────────────────────────── */

/* Paper — white, black, one red. Swiss and bright. */
:root[data-theme='paper'] {
  --bg: #FFFFFF; --bg-sink: #F2F3F5; --surface: #FFFFFF; --surface-2: #F7F8FA;
  --ink: #0A0A0B; --ink-2: #3D4148; --muted: #686E79; --faint: #8B919C;
  --hair: #E3E6EA; --hair-soft: #EEF0F3;
  --accent: #E03A2F; --accent-lo: #FDECEA; --done: #1F9D62; --over: #C42B21;
  --sans: 'Inter', system-ui, sans-serif;
  --serif: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --sh-1: 0 1px 2px rgba(16,20,28,.05), 0 4px 12px -6px rgba(16,20,28,.10);
  --sh-2: 0 2px 6px rgba(16,20,28,.07), 0 16px 34px -14px rgba(16,20,28,.20);
  --sh-3: 0 3px 10px rgba(16,20,28,.10), 0 30px 60px -20px rgba(16,20,28,.28);
}

/* A chosen theme is a decision, so it wins over the system light/dark guess. */
:root[data-theme] { color-scheme: light dark; }

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

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* light falling from the top-left, so the page isn't a flat slab */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(128% 62% at 6% -8%, rgba(255,241,225,.9), transparent 60%),
    radial-gradient(92% 48% at 104% 2%, rgba(196,86,44,.075), transparent 62%);
}
@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(128% 62% at 6% -8%, rgba(226,134,90,.11), transparent 60%),
      radial-gradient(92% 48% at 104% 2%, rgba(226,134,90,.05), transparent 62%);
  }
}

/* Once a theme is chosen the glow follows it, not the phone's dark-mode
   setting — otherwise a light theme on a dark phone gets washed over. */
:root[data-theme] body::before {
  background:
    radial-gradient(128% 62% at 6% -8%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 60%),
    radial-gradient(92% 48% at 104% 2%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 62%);
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

/* ── shell ──────────────────────────────────────────────────────────────── */
#app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

.head {
  padding: calc(env(safe-area-inset-top) + 16px) 20px 10px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  animation: settle .62s var(--expo) backwards;
}
.head h1 {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: clamp(27px, 7.4vw, 33px); line-height: 1; letter-spacing: -.022em;
  font-variation-settings: 'SOFT' 36, 'opsz' 72;
}
.head .dow {
  display: block; font-weight: 700; font-size: 11px;
  letter-spacing: .19em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 7px;
}
.gear {
  width: 44px; height: 44px; margin: -6px -8px 0 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
  transition: background .24s var(--quart), color .24s, transform .5s var(--expo);
}
.gear:active { transform: rotate(40deg) scale(.92); background: var(--bg-sink); color: var(--ink); }

/* ── tabs ───────────────────────────────────────────────────────────────── */
/* five tabs overflow a phone, so the row scrolls — silently, with no bar */
.tabs {
  position: relative; display: flex; gap: 2px; padding: 0 10px 8px;
  animation: settle .62s var(--expo) 60ms backwards;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; z-index: 1; flex: 1 0 auto; justify-content: center;
  min-width: 48px; padding: 12px 10px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; color: var(--muted);
  transition: color .3s var(--quart);
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px;
}
.tab[hidden] { display: none; }
.tab[aria-selected="true"] { color: var(--surface); }
.pill {
  position: absolute; z-index: 0; top: 0; left: 0; height: 44px;
  border-radius: 999px; background: var(--ink); box-shadow: var(--sh-1);
  transition: transform .46s var(--expo), width .46s var(--expo);
  will-change: transform, width;
}
.count {
  min-width: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 800; line-height: 19px; text-align: center;
}

/* ── calendar ───────────────────────────────────────────────────────────── */
.cal-fold {
  width: 44px; height: 44px; margin: -6px -8px 0 4px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); flex: none;
  transition: background .24s var(--quart), color .24s;
}
.cal-fold svg { width: 19px; height: 19px; transition: transform .38s var(--quint); }
.cal.is-folded .cal-fold svg { transform: rotate(180deg); }
.cal-fold:active { background: var(--bg-sink); color: var(--ink); }
/* Folding hands the month's 380px back to the list underneath it. */
.cal-body {
  overflow: hidden;
  transition: max-height .42s var(--expo), opacity .3s var(--quart);
  max-height: 520px; opacity: 1;
}
.cal.is-folded .cal-body { max-height: 0; opacity: 0; }

.cal { margin: 2px 0 18px; animation: settle .5s var(--expo) backwards; }
.cal-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.cal-title {
  margin: 0; font-family: var(--serif); font-size: 25px; font-weight: 500;
  letter-spacing: -.01em; color: var(--ink);
}
/* 44px is the smallest target a thumb hits reliably on iOS */
.cal-nav {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center; border-radius: 50%; color: var(--muted);
  transition: background .2s var(--quart), color .2s var(--quart), transform .2s var(--quart);
}
.cal-nav svg { width: 21px; height: 21px; }
.cal-nav:active { background: var(--bg-sink); color: var(--ink); transform: scale(.9); }

.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 2px; }
.cal-dow span {
  text-align: center; font-size: 11.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  /* shorter than square: six rows still fit above the fold with the day's
     first appointments visible underneath */
  position: relative; aspect-ratio: 1 / .82; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; border-radius: 14px;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
  touch-action: manipulation;                    /* kills the 300ms tap delay on iOS */
  transition: background .2s var(--quart), color .2s var(--quart), transform .2s var(--quart);
}
.cal-day:active { transform: scale(.9); }
.cal-day.out { color: var(--faint); }
.cal-n { font-size: 16px; font-weight: 600; line-height: 1; }

.cal-dots { display: flex; gap: 3px; height: 7px; align-items: center; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
/* Still to do: bigger, red, and lit — readable at a glance across the month. */
.cal-dots i.live {
  width: 6px; height: 6px; background: var(--over);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--over) 22%, transparent);
}
/* Finished: smaller and drained of colour, so it reads as settled. */
.cal-dots i.done { width: 4px; height: 4px; background: var(--faint); opacity: .5; }

/* today is stated with a ring, the chosen day with weight — never the same signal */
.cal-day.is-today .cal-n { color: var(--accent); font-weight: 800; }
.cal-day.is-today::after {
  content: ''; position: absolute; inset: 4px; border-radius: 12px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 42%, transparent);
}
.cal-day.is-picked { background: var(--ink); }
.cal-day.is-picked .cal-n { color: var(--surface); }
.cal-day.is-picked .cal-dots i.live {
  background: var(--surface); box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 30%, transparent);
}
.cal-day.is-picked .cal-dots i.done { background: color-mix(in srgb, var(--surface) 42%, transparent); }
.cal-day.is-picked.is-today::after { border-color: transparent; }

.cal-picked {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 18px 2px 10px; padding-top: 14px; border-top: 1px solid var(--hair-soft);
}
.cal-picked > span {
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.cal-today {
  min-height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--bg-sink); color: var(--ink-2);
  font-size: 13.5px; font-weight: 600;
  transition: transform .2s var(--quart);
}
.cal-today:active { transform: scale(.94); }
.cal-none { margin: 6px 2px; color: var(--muted); font-size: 15px; }

/* ── theme picker ───────────────────────────────────────────────────────── */
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: 10px; align-items: center;
  padding: 11px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1.5px solid var(--hair);
  text-align: left; touch-action: manipulation;
  transition: border-color .2s var(--quart), transform .2s var(--quart);
}
.theme:active { transform: scale(.97); }
.theme[aria-pressed='true'] { border-color: var(--accent); }
.theme-name { font-size: 14.5px; font-weight: 650; color: var(--ink); }
.theme-note {
  grid-column: 2; font-size: 11.5px; line-height: 1.3; color: var(--muted);
}
.swatch {
  grid-row: 1 / 3; display: flex; flex-direction: column;
  width: 26px; height: 26px; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--hair);
}
.swatch i { flex: 1; }

/* Each swatch shows its own theme's real colours, not the current one's:
   background, accent, then text. */
.sw-auto       i:nth-child(1){background:#F6F1E8} .sw-auto       i:nth-child(2){background:#C4562C} .sw-auto       i:nth-child(3){background:#1A1714}
.sw-paper      i:nth-child(1){background:#FFFFFF} .sw-paper      i:nth-child(2){background:#E03A2F} .sw-paper      i:nth-child(3){background:#0A0A0B}


/* ── focus mode ─────────────────────────────────────────────────────────── */
/* Progress first. A week of small wins, before anything is asked of him. */
.fx-won {
  margin: 6px 2px 20px; padding: 15px 18px; border-radius: var(--r);
  background: var(--accent-lo); color: var(--ink);
  font-size: 15px; font-weight: 600; letter-spacing: -.008em;
  animation: settle .5s var(--expo) backwards;
}
.fx-won b { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }

.fx-label {
  display: flex; align-items: center; gap: 12px; margin: 0 2px 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.fx-label::after { content: ''; flex: 1; height: 1px; background: var(--hair-soft); }
.fx-next { margin-bottom: 26px; }

/* The one late thing. Given room, so it reads as a decision and not a row. */
.fx-pile {
  padding: 20px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--sh-1);
  animation: riseIn .46s var(--expo) backwards;
}
.fx-when {
  font-size: 12px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--over); margin-bottom: 9px;
}
.fx-title {
  font-family: var(--serif); font-size: 23px; font-weight: 600; line-height: 1.2;
  letter-spacing: -.016em; color: var(--ink); overflow-wrap: anywhere;
}
.fx-proj {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 11px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.fx-proj i { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.fx-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.fx-act {
  flex: 1 0 auto; min-height: 46px; padding: 12px 15px; border-radius: 13px;
  background: var(--bg-sink); color: var(--ink);
  font-size: 14.5px; font-weight: 650; letter-spacing: -.006em;
  transition: transform .3s var(--quint), background .24s var(--quart);
}
.fx-act:active { transform: scale(.955); }
.fx-act.is-done { background: var(--ink); color: var(--bg); }
.fx-act.is-drop { background: none; color: var(--muted); flex: 0 0 auto; }

.fx-when.is-soon { color: var(--accent); }
.fx-pile.is-next { margin-bottom: 22px; }
.fx-loc { margin-top: 7px; font-size: 13.5px; color: var(--muted); }
.fx-quiet {
  padding: 22px 20px; border-radius: var(--r); background: var(--surface-2);
  color: var(--muted); font-size: 15px; text-align: center; margin-bottom: 22px;
}
/* the shape of the day, stated in one line before anything else is added to it */
.fx-today {
  margin: 0 2px 26px; padding: 13px 16px; border-radius: var(--r-sm);
  background: var(--bg-sink); color: var(--ink-2);
  font-size: 14px; letter-spacing: -.004em;
}
.fx-today b { color: var(--ink); font-weight: 700; }

.fx-rest { margin: 14px 2px 0; font-size: 13px; color: var(--muted); text-align: center; }

.fx-clear {
  display: grid; justify-items: center; gap: 4px; padding: 42px 20px;
  color: var(--done); animation: settle .5s var(--expo) backwards;
}
.fx-clear svg { width: 34px; height: 34px; margin-bottom: 8px; }
.fx-clear p { margin: 0; font-size: 16.5px; font-weight: 600; color: var(--ink); }
.fx-clear small { font-size: 13.5px; color: var(--muted); }

/* the switch that turns the whole front page over */
.modeswap {
  display: flex; align-items: flex-start; gap: 14px; width: 100%;
  padding: 15px 16px; border-radius: var(--r); text-align: left;
  background: var(--surface-2); border: 1.5px solid var(--hair);
  transition: border-color .24s var(--quart);
}
.modeswap[aria-pressed='true'] { border-color: var(--accent); }
.modeswap-txt { flex: 1; min-width: 0; }
.modeswap-txt b { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.modeswap-txt small {
  display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--muted);
}
.modeswap .knob {
  flex: none; width: 46px; height: 28px; border-radius: 999px; margin-top: 2px;
  background: var(--hair); position: relative;
  transition: background .28s var(--quart);
}
.modeswap .knob::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--surface); box-shadow: var(--sh-1);
  transition: transform .32s var(--quint);
}
.modeswap[aria-pressed='true'] .knob { background: var(--accent); }
.modeswap[aria-pressed='true'] .knob::after { transform: translateX(18px); }

/* ── notes and things to do ─────────────────────────────────────────────── */
.notes {
  margin-top: 6px; font-size: 14px; line-height: 1.45; color: var(--ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.step {
  display: flex; align-items: flex-start; gap: 9px;
  min-height: 30px; padding: 3px 0;
  font-size: 14.5px; line-height: 1.4; color: var(--ink-2);
  overflow-wrap: anywhere;
}
/* the box is its own target so a mis-tap opens the card rather than ticking */
.step .box {
  flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 6px;
  border: 1.5px solid var(--hair); background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
  touch-action: manipulation;
  transition: background .2s var(--quart), border-color .2s var(--quart), transform .2s var(--quart);
}
.step .box::after {
  content: ''; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid var(--surface); border-bottom: 2px solid var(--surface);
  transform: rotate(-45deg) scale(.4); opacity: 0;
  transition: opacity .18s var(--quart), transform .22s var(--quart);
}
.step .box:active { transform: scale(.86); }
.step.is-done .box { background: var(--done); border-color: var(--done); }
.step.is-done .box::after { opacity: 1; transform: rotate(-45deg) scale(1); }
.step.is-done { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--hair); }
.steps-count {
  margin-top: 5px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
}

/* in the editor a step can also be removed */
.steps.edit .step { align-items: center; }
.steps.edit .step-text { flex: 1; }
.step-x {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  font-size: 19px; line-height: 1; color: var(--faint);
  display: grid; place-items: center;
  transition: background .2s var(--quart), color .2s var(--quart);
}
.step-x:active { background: var(--bg-sink); color: var(--over); }

/* ── list ───────────────────────────────────────────────────────────────── */
main { flex: 1; padding: 4px 14px calc(var(--dock, 172px) + 24px); }

@keyframes settle { from { opacity: 0; transform: translateY(9px); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px) scale(.986); } }

.daymark {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 6px; padding: 8px 6px 8px 0;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  background: linear-gradient(to bottom, var(--bg) 62%, transparent);
  animation: settle .5s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 90ms);
}
.daymark::after { content: ''; flex: 1; height: 1px; background: var(--hair-soft); }
.daymark.is-today { color: var(--accent); }

/* ── the now line — where you are in the day ────────────────────────────── */
.now {
  position: relative; display: flex; align-items: center;
  height: 22px; margin: 6px 0;
  animation: nowIn .8s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 150ms);
}
.now::before {                       /* the rule itself, drawn from the dot outwards */
  content: ''; position: absolute; left: 20px; right: 4px; height: 1.5px;
  background: linear-gradient(to right, var(--accent), color-mix(in srgb, var(--accent) 18%, transparent));
  transform-origin: left center;
  animation: drawLine .9s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 220ms);
}
.now-dot {
  position: relative; z-index: 1; width: 9px; height: 9px; margin-left: 16px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.now-time {
  position: relative; z-index: 1; margin-left: auto; padding: 2px 9px;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
}
@keyframes nowIn { from { opacity: 0; } }
@keyframes drawLine { from { transform: scaleX(0); } }

/* ── cards ──────────────────────────────────────────────────────────────── */
.card-wrap {
  position: relative; margin: 7px 0; border-radius: var(--r); overflow: hidden;
}
.card-wrap.collapsing {
  height: 0 !important; margin: 0; opacity: 0;
  transition: height .38s var(--quint), margin .38s var(--quint), opacity .22s ease-out;
}

/* what sits under the card while you swipe */
.behind {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--on-accent);
  background: linear-gradient(90deg, var(--done) 50%, var(--accent) 50%);
  opacity: calc(var(--reveal, 0) * .95 + .05);
}
.behind .act { display: inline-flex; align-items: center; gap: 7px; }
.behind svg { width: 16px; height: 16px; }
.act-done  { transform: scale(calc(.86 + var(--reveal, 0) * .14)); transform-origin: left center; }
.act-later { transform: scale(calc(.86 + var(--reveal, 0) * .14)); transform-origin: right center; }
.card-wrap.armed .behind { opacity: 1; }

.card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 15px; background: var(--surface); border-radius: var(--r);
  box-shadow: var(--sh-1); border: 1px solid var(--hair-soft);
  touch-action: pan-y; will-change: transform;
  transition: transform .42s var(--quint), box-shadow .3s var(--quart), opacity .3s;
  animation: riseIn .58s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 110ms);
}
.card-wrap.swiping .card { transition: none; }
.card-wrap.swiping .card, .card-wrap.armed .card { box-shadow: var(--sh-2); }
.card.is-new { animation: stamp .62s var(--expo); }
@keyframes stamp {
  0%   { opacity: 0; transform: translateY(16px) scale(.96); }
  58%  { opacity: 1; transform: translateY(-2px) scale(1.008); }
  100% { transform: none; }
}

/* the project spine — colour without noise */
.card::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--spine, transparent); opacity: .6;
}
.card.urgent::before { background: var(--over); opacity: 1; }

/* time column */
/* One line above the title: qualifier left, time right. Replaces the fixed
   74px rail, which cost every card 90px of title width. */
.cap {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 5px; min-height: 15px;
}
.cap-l {
  font-family: var(--sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.cap-r {
  margin-left: auto;
  font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1;
  letter-spacing: -.012em; color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
  font-variation-settings: 'SOFT' 22, 'opsz' 30;
}
.cap-r i {
  font-family: var(--sans); font-style: normal; font-size: 10px; font-weight: 800;
  letter-spacing: .1em; color: var(--muted); margin-left: 3px;
}
.cap.is-over .cap-l, .cap.is-over .cap-r, .cap.is-over .cap-r i { color: var(--over); }

.body { flex: 1; min-width: 0; padding-top: 1px; }
.title {
  font-size: 16.5px; font-weight: 600; line-height: 1.33; letter-spacing: -.011em;
  color: var(--ink); overflow-wrap: anywhere;
}
.meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 6px; font-size: 12.5px; color: var(--muted); letter-spacing: -.002em;
}
.proj { color: var(--ink-2); font-weight: 500; }
.sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.flag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase;
}
.flag.rec  { background: var(--bg-sink); color: var(--muted); }
.flag.warn { background: var(--accent-lo); color: var(--accent); }

/* ── finished business ──────────────────────────────────────────────────── */
.donebar {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 44px; margin: 2px 0 4px; padding: 0 6px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em; color: var(--muted);
  transition: color .24s var(--quart);
}
.donebar:active { color: var(--ink); }
.donebar svg { width: 15px; height: 15px; transition: transform .34s var(--quint); }
.donebar.is-open svg { transform: rotate(180deg); }
.donebar::after { content: ''; flex: 1; height: 1px; background: var(--hair-soft); }

/* Reopened history is context, so it sits back further than a live card. */
.donebar.is-open ~ .card-wrap .card.done { opacity: .38; }

.card.done { opacity: .46; }
.card.done .title { text-decoration: line-through; text-decoration-color: var(--faint); }

/* the tick draws itself */
.check {
  position: relative;
  flex: none; width: 25px; height: 25px; margin-top: 1px; border-radius: 50%;
  border: 1.5px solid var(--hair); display: grid; place-items: center;
  transition: border-color .26s var(--quart), background .26s var(--quart), transform .3s var(--quint);
}
/* The circle stays small because it looks better small. The tappable area does
   not: a 25px target on a phone is a target you miss. */
.check::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 46px; height: 46px; transform: translate(-50%, -50%);
}
.check:active { transform: scale(.85); }
.check svg { width: 13px; height: 13px; color: var(--on-done); }
.check .tick {
  stroke-dasharray: 24; stroke-dashoffset: 24;
  transition: stroke-dashoffset .34s var(--quart) .04s;
}
.card.done .check { background: var(--done); border-color: var(--done); }
.card.done .check .tick { stroke-dashoffset: 0; }

/* ── empty ──────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 76px 32px; animation: settle .7s var(--expo) 120ms backwards; }
.empty svg { width: 50px; height: 50px; color: var(--faint); opacity: .55; margin-bottom: 18px; }
.empty p {
  margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 500;
  font-variation-settings: 'SOFT' 60, 'opsz' 40; color: var(--ink-2); letter-spacing: -.01em;
}
.empty small { display: block; margin-top: 8px; font-size: 13.5px; color: var(--muted); }

/* ── capture bar ────────────────────────────────────────────────────────── */
/* One fixed stack at the foot of the screen: capture on top, navigation
   under it, both inside the thumb's arc. --kb is the height the on-screen
   keyboard is currently covering, so the dock rides up instead of hiding
   behind it. */
.dock {
  position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 20;
  padding-bottom: calc(env(safe-area-inset-bottom) * var(--safe-on, 1));
  background: linear-gradient(to top, var(--bg) 62%, color-mix(in srgb, var(--bg) 0%, transparent));
  transition: bottom .22s var(--quart);
}
.bar {
  padding: 12px 14px 8px;
  animation: settle .6s var(--expo) 160ms backwards;
}
.bar-inner {
  display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 17px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 25px;
  box-shadow: var(--sh-1);
  transition: box-shadow .4s var(--expo), border-color .3s var(--quart), transform .4s var(--expo);
}
.bar-inner:focus-within {
  box-shadow: var(--sh-3); transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--hair));
}
#input {
  flex: 1; border: 0; outline: 0; background: none; resize: none;
  font-size: 16.5px; line-height: 1.42; letter-spacing: -.006em; padding: 13px 0; max-height: 132px;
}
#input::placeholder { color: var(--faint); }

.send {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--bg); display: grid; place-items: center;
  transition: transform .34s var(--quint), background .3s var(--quart), opacity .3s;
}
.send svg { width: 19px; height: 19px; transition: transform .3s var(--quint), opacity .2s; }
.send[disabled] { opacity: .28; transform: scale(.9); }
.send:not([disabled]):active { transform: scale(.87); }
.send.busy { background: var(--accent); }
.send.sent { background: var(--done); }
.send.sent svg { transform: rotate(-90deg) scale(.9); opacity: 0; }

/* live parse preview — the trust-builder */
.ghost {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 0 8px; max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .36s var(--expo), opacity .28s, margin .36s var(--expo);
}
.ghost.show { max-height: 48px; opacity: 1; margin: 10px 0 4px; }
.ghost b {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--hair-soft); color: var(--ink-2);
  white-space: nowrap; box-shadow: var(--sh-1);
  animation: chipIn .42s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.ghost b i { width: 7px; height: 7px; border-radius: 50%; }
.ghost b.key { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ghost b.dim { color: var(--muted); box-shadow: none; }
@keyframes chipIn { from { opacity: 0; transform: translateY(7px) scale(.94); } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--kb, 0px) + var(--dock, 172px) + 14px);
  transform: translate(-50%, 12px); z-index: 40;
  padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; box-shadow: var(--sh-2);
  opacity: 0; pointer-events: none;
  transition: opacity .26s, transform .42s var(--expo);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.has-undo {
  pointer-events: auto; padding: 7px 7px 7px 18px;
  display: flex; align-items: center; gap: 12px;
}
.toast-undo {
  padding: 8px 15px; border-radius: 999px; min-height: 36px;
  background: var(--bg); color: var(--ink);
  font-size: 13px; font-weight: 700; letter-spacing: -.005em;
  transition: transform .3s var(--quint);
}
.toast-undo:active { transform: scale(.93); }

/* ── sheets ─────────────────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,17,14,.4);
  backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .34s var(--quart);
}
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; box-shadow: var(--sh-3);
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 26px);
  transform: translateY(101%); transition: transform .46s var(--expo);
}
.sheet.show { transform: none; }
.grab { width: 38px; height: 4px; border-radius: 4px; background: var(--hair); margin: 6px auto 18px; }
.sheet h2 {
  margin: 0 0 18px; font-family: var(--serif); font-weight: 600; font-size: 23px;
  letter-spacing: -.017em; font-variation-settings: 'SOFT' 46, 'opsz' 40;
}
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--hair); background: var(--surface); outline: 0;
  font-size: 16px; transition: border-color .24s var(--quart), box-shadow .24s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 13px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  transition: background .24s var(--quart), color .24s, border-color .24s, transform .3s var(--quint);
}
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.row { display: flex; gap: 9px; margin-top: 22px; }
.btn {
  flex: 1; padding: 15px; border-radius: 14px; font-size: 15.5px; font-weight: 700;
  letter-spacing: -.008em; background: var(--ink); color: var(--bg);
  transition: transform .3s var(--quint), opacity .24s, background .24s;
}
.btn:active { transform: scale(.975); }
.btn.ghostbtn { background: var(--bg-sink); color: var(--ink-2); }
.btn.danger { background: none; color: var(--over); flex: 0 0 auto; padding-inline: 18px; }
a.btn { display: block; text-align: center; text-decoration: none; }

/* ── reading one item ───────────────────────────────────────────────────── */
.dt { padding-bottom: 2px; }
.dt-title {
  font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.16;
  letter-spacing: -.018em; color: var(--ink); margin: 0 0 12px; overflow-wrap: anywhere;
}
.dt-when {
  font-size: 15px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.dt-when.is-over { color: var(--over); }
.dt-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px;
  margin-top: 10px; font-size: 14px; color: var(--muted);
}
.dt-proj { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink-2); }
.dt-proj i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dt-notes {
  margin: 16px 0 0; padding: 13px 15px; border-radius: var(--r-sm);
  background: var(--bg-sink); font-size: 14.5px; line-height: 1.55; color: var(--ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.dt .steps { margin-top: 16px; }
.dt-row { margin-top: 24px; }
.dt-row2 { margin-top: 9px; }

.echo {
  margin: 7px 2px 0; font-size: 13px; font-weight: 600; color: var(--accent);
  letter-spacing: -.005em;
}

.hint { font-size: 12.5px; line-height: 1.65; color: var(--muted); margin: 10px 0 0; }
.hint b { color: var(--ink-2); font-weight: 600; }

.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--hair-soft);
}
.setting:last-of-type { border-bottom: 0; }
.setting .k { font-size: 15px; font-weight: 600; letter-spacing: -.008em; }
.setting .v { font-size: 12.5px; color: var(--muted); margin-top: 4px; word-break: break-all; }
.copy {
  padding: 9px 15px; border-radius: 999px; background: var(--bg-sink);
  font-size: 13px; font-weight: 700; transition: transform .3s var(--quint);
}
.copy:active { transform: scale(.94); }

/* ── lock ───────────────────────────────────────────────────────────────── */
.lock {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: var(--bg); padding: 32px;
}
.lock .box { width: 100%; max-width: 300px; text-align: center; animation: settle .8s var(--expo) backwards; }
.mark {
  width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 21px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  display: grid; place-items: center;
  box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--accent) 72%, transparent);
}
.lock h1 {
  font-family: var(--serif); font-weight: 600; font-size: 29px; margin: 0 0 7px;
  letter-spacing: -.02em; font-variation-settings: 'SOFT' 52, 'opsz' 50;
}
.lock p { margin: 0 0 26px; color: var(--muted); font-size: 14.5px; }
.lock input {
  width: 100%; text-align: center; letter-spacing: .52em; text-indent: .52em;
  font-size: 22px; font-family: var(--serif); padding: 16px; border-radius: 16px;
  border: 1px solid var(--hair); background: var(--surface); outline: 0;
  transition: border-color .24s var(--quart), box-shadow .24s;
}
.lock input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}
.lock .btn { margin-top: 14px; }
.lock .btn[disabled] { opacity: .35; }
.lock.bad .box { animation: shake .44s var(--quart); }
@keyframes shake {
  20% { transform: translateX(-8px); } 45% { transform: translateX(7px); }
  70% { transform: translateX(-4px); } 100% { transform: none; }
}

.hidden { display: none !important; }
.offline-pill {
  display: inline-flex; align-items: center; margin-left: 9px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); vertical-align: middle;
}

/* ── respect the system, and bigger screens ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}
@media (min-width: 620px) {
  #app { max-width: 580px; margin: 0 auto; }
  .bar { left: 50%; transform: translateX(-50%); width: 100%; max-width: 580px; }
  .sheet { max-width: 580px; margin: 0 auto; border-radius: 26px 26px 0 0; }
}
