:root {
  --bg: #f5f6f2;
  --card: #ffffff;
  --ink: #16191a;
  --muted: #646b68;
  --line: #e2e5df;
  --accent: #2f6b4f;
  --accent-ink: #ffffff;
  --warn: #b0392c;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101412;
    --card: #1a1f1d;
    --ink: #e9ecea;
    --muted: #97a09c;
    --line: #2b322f;
    --accent: #6fc39a;
    --accent-ink: #0b130f;
    --warn: #ff8a7a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: 640px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 calc(80px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { padding: 16px 16px 8px; position: relative; }
h1 { font-size: 28px; margin: 0 0 12px; letter-spacing: -.02em; }
/* Title + the small "refreshing" spinner beside it (fixed size: no layout jump). */
.title-row { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.title-row h1 { margin: 0; }
.spinner {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; background: var(--card); }
.seg button {
  border: 0; background: transparent; min-height: 44px; min-width: 52px; padding: 0 14px;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.banner {
  margin: 8px 16px 0; padding: 10px 14px; border-radius: 10px;
  background: var(--warn); color: #fff; font-weight: 600;
}

/* The daily pass's today note at the top of Now (a <details>, so it collapses). */
.today {
  margin: 8px 12px 0; padding: 10px 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
}
.today[hidden] { display: none; }
.today summary {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  cursor: pointer; min-height: 24px;
}
.today-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; }

.list { list-style: none; margin: 8px 0 0; padding: 0 12px; }
/* Section headings: "New" / "Now" on the Now view, the kind groups on All. */
.group-head {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 16px 16px 0;
}
.list .group .group-head { margin: 16px 4px 0; }
.inbox .list { margin-top: 4px; }
.task {
  position: relative; margin: 8px 0; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); overflow: hidden;
  transition: opacity .25s ease, transform .25s ease, max-height .3s ease, margin .3s ease;
  max-height: 400px;
}
.task.leaving { opacity: 0; transform: translateX(30%); max-height: 0; margin: 0; border-width: 0; }
.task .slide {
  display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 0;
  touch-action: pan-y; background: var(--card); position: relative;
}
.task .slide.dragging { transition: none; }
.task .slide:not(.dragging) { transition: transform .2s ease; }
.task .swipe { position: relative; }
.task .swipe-hint {
  position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center;
  justify-content: flex-end; padding-right: 18px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600;
}
.check {
  flex: none; width: 52px; min-height: 52px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.check input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.main {
  flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 8px 4px;
  cursor: pointer; min-height: 52px;
}
.title { display: block; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; font-size: 13px; color: var(--muted); }
.badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px;
  border-radius: 99px; border: 1px solid var(--line);
}
.reason.urgent { color: var(--warn); font-weight: 600; }
.more {
  flex: none; width: 48px; min-height: 48px; border: 0; background: transparent;
  font-size: 22px; color: var(--muted); cursor: pointer; border-radius: 10px;
}
.snooze {
  display: flex; gap: 8px; padding: 0 12px 12px 52px; flex-wrap: wrap;
  scroll-margin-bottom: calc(84px + env(safe-area-inset-bottom));
}
.snooze span { width: 100%; font-size: 13px; color: var(--muted); }
.snooze button {
  min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--bg); cursor: pointer;
}

.empty { text-align: center; color: var(--muted); margin: 40px 16px; }

/* Full-screen message: "this device isn't paired" and the pairing page. */
.gate {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto; text-align: center;
}
.gate h1 { font-size: 22px; margin: 0; }
.gate p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.gate code { color: var(--ink); font-weight: 600; }

.detail {
  position: fixed; inset: 0; background: var(--bg); overflow-y: auto; z-index: 10;
  padding: env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto;
}
.detail-bar { padding: 8px 0; display: flex; align-items: center; gap: 8px; }
.detail h2 { font-size: 22px; margin: 4px 0; overflow-wrap: anywhere; }
.detail h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.body {
  white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 12px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.body:empty { display: none; }
.notes { list-style: none; padding: 0; margin: 0; }
.notes li { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; margin: 0 0 10px; }
.notes .when { font-size: 12px; color: var(--muted); }
.notes .text { white-space: pre-wrap; overflow-wrap: anywhere; }

.text-btn {
  border: 0; background: transparent; color: var(--accent); font-weight: 600;
  min-height: 44px; padding: 0 8px; cursor: pointer;
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 44px;
  background: var(--ink); color: var(--bg); border-radius: 12px;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast .text-btn { color: var(--bg); text-decoration: underline; margin: -10px -10px -10px 0; }

.add {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
  max-width: 640px; margin: 0 auto;
}
.add input {
  width: 100%; min-height: 48px; padding: 0 14px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.add input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* View switcher (Now · Projects · Arcs). */
.views { width: max-content; margin: 0 0 12px; }
.views button { min-width: 64px; }
.detail-meta-bits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.meta .link {
  border: 0; background: transparent; padding: 0 2px; color: var(--accent); font-weight: 600;
  font-size: inherit; cursor: pointer; text-decoration: underline; min-height: 32px;
}
.children { padding: 0; margin: 0; }
.child.closed .title { color: var(--muted); text-decoration: line-through; }

/* Notifications toggle (top right): bell on, crossed bell off. */
.notify-btn {
  position: absolute; top: 14px; right: 12px;
  background: none; border: 0; font-size: 20px; line-height: 1;
  padding: 8px; min-width: 40px; min-height: 40px; cursor: pointer; opacity: 0.8;
}
.notify-btn[aria-pressed="true"] { opacity: 1; }
