/* Co: his pages. Calm, big, one thing per screen. Light and dark follow the phone. */
:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1d1c1a; --soft: #6b6862; --faint: #a19d95; --line: #e6e2d9;
  --accent: #23614a; --accent-ink: #ffffff; --accent-soft: #e3efe8; --warn: #a15c07; --bad: #b4321f; --bad-soft: #f8e5e1;
  --good: #23614a; --shadow: 0 1px 2px rgba(30, 28, 24, .06), 0 6px 24px rgba(30, 28, 24, .06);
  --r: 20px; --tap: 60px; --pad: 20px; --nav: 68px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413; --card: #1e1e1c; --ink: #eeece6; --soft: #a3a097; --faint: #6f6c65; --line: #2d2c29;
    --accent: #5fbf93; --accent-ink: #0f1a14; --accent-soft: #1d2e25; --warn: #e3a149; --bad: #f07a66; --bad-soft: #3a211c;
    --good: #5fbf93; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; min-height: 100dvh; overflow-wrap: anywhere;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* layout */
#app { max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) var(--pad) calc(var(--nav) + env(safe-area-inset-bottom) + 24px); }
.single { max-width: 460px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 15vh) var(--pad) 40px; display: flex; flex-direction: column; gap: 14px; }
.top { display: flex; align-items: center; gap: 10px; min-height: 56px; margin-bottom: 6px; }
.top h1 { flex: 1; margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.01em; }
.top .back { width: 44px; height: 44px; margin-left: -10px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; text-decoration: none; }
.top .back svg { width: 26px; height: 26px; }
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; letter-spacing: -.015em; }
h2 { font-size: 15px; font-weight: 600; color: var(--soft); margin: 28px 0 10px; letter-spacing: .01em; }
.lead { font-size: 19px; color: var(--soft); margin: 0; }
.note { font-size: 15px; color: var(--soft); margin: 0; }
.quiet { color: var(--soft); }

/* the one calm line of an empty screen */
.calm { min-height: 46vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; }
.calm p { font-size: 22px; color: var(--soft); margin: 0; }
.mark { width: 64px; height: 64px; border-radius: 22px; background: var(--accent); position: relative; margin-bottom: 4px; }
.mark::after { content: ""; position: absolute; inset: 20px; border-radius: 50%; border: 4px solid var(--accent-ink); }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap); padding: 0 22px;
  border: 0; border-radius: var(--r); background: var(--accent); color: var(--accent-ink); font-size: 19px; font-weight: 600;
  text-decoration: none; text-align: center; transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn.quiet { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.bad { background: var(--bad); color: #fff; }
.btn.wide { width: 100%; }
.btn.big { min-height: 76px; font-size: 24px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 24px; height: 24px; flex: none; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.link { background: none; border: 0; padding: 12px 4px; color: var(--soft); font-size: 16px; text-decoration: underline; text-underline-offset: 3px; }
form { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.number { font-size: 88px; font-weight: 700; letter-spacing: .06em; text-align: center; margin: 10px 0; }

/* cards on Now */
.cards { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.card.urgent { box-shadow: inset 0 0 0 2px var(--bad), var(--shadow); }
.card .t { font-size: 22px; font-weight: 650; line-height: 1.25; margin: 0; }
.card .b { color: var(--soft); margin: 0; white-space: pre-wrap; }
.card .meta { font-size: 14px; color: var(--faint); margin: 0; }
.card a.open { text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.card .go { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 18px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-weight: 600; text-decoration: none; border: 0; }
.card .go svg { width: 22px; height: 22px; }
.done-line { display: flex; align-items: center; gap: 10px; padding: 14px 4px; color: var(--soft); font-size: 16px; }
.done-line svg { width: 22px; height: 22px; color: var(--good); flex: none; }
.done-line.kept svg { color: var(--warn); }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--card); color: var(--soft); font-size: 15px; margin-bottom: 14px; box-shadow: inset 0 0 0 1.5px var(--line); }
.banner svg { width: 20px; height: 20px; flex: none; }

/* one card, full screen */
.ask { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.ask .t { font-size: 28px; font-weight: 700; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.ask .b { font-size: 18px; color: var(--soft); margin: 0; white-space: pre-wrap; }
.answers { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.option { display: flex; align-items: center; gap: 14px; min-height: var(--tap); padding: 14px 18px; border: 0; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); text-align: left; font-size: 18px; width: 100%; }
.option .tick { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); flex: none; display: grid; place-items: center; }
.option.on { box-shadow: inset 0 0 0 2.5px var(--accent); }
.option.on .tick { background: var(--accent); box-shadow: none; color: var(--accent-ink); }
.option .tick svg { width: 18px; height: 18px; }
.draft { background: var(--card); border-radius: 18px; padding: 18px; white-space: pre-wrap; font-size: 17px; line-height: 1.55; box-shadow: inset 0 0 0 1.5px var(--line); max-height: 52vh; overflow: auto; }
textarea, input[type=text], input[type=search], input.num {
  width: 100%; border: 0; border-radius: 18px; background: var(--card); padding: 16px 18px; font-size: 18px; line-height: 1.45;
  box-shadow: inset 0 0 0 1.5px var(--line); outline: none; resize: none;
}
textarea:focus, input:focus { box-shadow: inset 0 0 0 2.5px var(--accent); }
textarea.long { min-height: 46vh; }
.nums { display: flex; flex-direction: column; gap: 2px; background: var(--card); border-radius: 18px; padding: 6px 18px; box-shadow: inset 0 0 0 1.5px var(--line); }
.nums .n { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; border-bottom: 1px solid var(--line); }
.nums .n:last-child { border-bottom: 0; }
.nums .n span { color: var(--soft); }
.nums .n b { font-size: 22px; font-variant-numeric: tabular-nums; }
.nums input.num { width: 46%; text-align: right; padding: 10px 12px; font-size: 20px; font-weight: 700; }
.said { background: var(--accent-soft); color: var(--ink); border-radius: 18px; padding: 16px 18px; white-space: pre-wrap; }
.state { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--soft); min-height: 28px; }
.state svg { width: 22px; height: 22px; flex: none; }
.state.ok svg { color: var(--good); }
.state.kept svg { color: var(--warn); }

/* the bar at the bottom of a card or a list */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.dock > * { max-width: 600px; margin: 0 auto; }
.has-dock #app { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.has-dock nav.tabs { display: none; }

/* rank and pick */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: 16px; padding: 4px; box-shadow: inset 0 0 0 1.5px var(--line); }
.seg button { min-height: 46px; border: 0; background: none; border-radius: 12px; font-size: 16px; font-weight: 600; color: var(--soft); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.rows { display: flex; flex-direction: column; background: var(--card); border-radius: 20px; box-shadow: inset 0 0 0 1.5px var(--line); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); background: var(--card); position: relative; touch-action: pan-y; }
.row:last-child { border-bottom: 0; }
.row .pos { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 700; display: grid; place-items: center; flex: none; }
.row .pos.off { background: none; box-shadow: inset 0 0 0 2px var(--line); color: transparent; }
.row .tx { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 8px 0; font-size: 17px; }
.row .tx small { display: block; color: var(--soft); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .ic { width: 48px; height: 48px; border: 0; background: none; border-radius: 14px; display: grid; place-items: center; color: var(--soft); flex: none; }
.row .ic svg { width: 24px; height: 24px; }
.row .grip { touch-action: none; cursor: grab; }
.row.lift { z-index: 5; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); border-radius: 14px; }
.row.pick .tx { font-weight: 600; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; border-radius: 26px 26px 0 0; padding: 10px var(--pad) calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 6px; }
.sheet h3 { font-size: 24px; margin: 0; line-height: 1.25; }
.sheet .detail { white-space: pre-wrap; font-size: 17px; line-height: 1.55; }

/* drop */
.compose { display: flex; flex-direction: column; gap: 12px; }
.tools { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.tools .btn { padding: 0 12px; font-size: 17px; }
.rec { background: var(--bad) !important; color: #fff !important; box-shadow: none !important; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.att { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 16px; background: var(--card); border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--line); }
.att span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.where { display: flex; flex-direction: column; gap: 12px; }
.where .btn { justify-content: flex-start; text-align: left; min-height: 68px; }
.where .btn small { display: block; font-weight: 400; font-size: 14px; opacity: .75; }
.where .btn span { display: block; min-width: 0; }
.where .btn svg { width: 26px; height: 26px; }
.preview { background: var(--card); border-radius: 18px; padding: 16px 18px; color: var(--soft); white-space: pre-wrap; max-height: 24vh; overflow: auto; box-shadow: inset 0 0 0 1.5px var(--line); }

/* lists: library, running, me */
.list { display: flex; flex-direction: column; background: var(--card); border-radius: 20px; box-shadow: inset 0 0 0 1.5px var(--line); overflow: hidden; }
.item { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.item:last-child { border-bottom: 0; }
.item .ico { width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.item .ico svg { width: 24px; height: 24px; }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .tx small { display: block; color: var(--soft); font-size: 14px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .end { color: var(--faint); font-size: 14px; flex: none; }
.item button.end { border: 0; background: none; color: var(--bad); font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 6px; }
.item.blind .ico { background: var(--bad-soft); color: var(--bad); }
.para { background: var(--card); border-radius: 20px; padding: 16px 18px; box-shadow: inset 0 0 0 1.5px var(--line); display: flex; flex-direction: column; gap: 6px; }
.para b { font-size: 18px; line-height: 1.3; }
.para p { margin: 0; color: var(--soft); font-size: 15px; }
.para p.wait { color: var(--warn); }
.paras { display: flex; flex-direction: column; gap: 10px; }
.foot { margin-top: 30px; text-align: center; color: var(--faint); font-size: 13px; }

/* page view */
.pageview { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 10; }
.pageview .top { padding: calc(env(safe-area-inset-top) + 4px) 12px 0 var(--pad); margin: 0; }
.pageview .top h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pageview iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.sendbar { padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; gap: 10px; }

/* tabs */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs .in { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 640px; }
nav.tabs a { height: var(--nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--faint); font-size: 12.5px; font-weight: 600; position: relative; }
nav.tabs a svg { width: 26px; height: 26px; }
nav.tabs a.on { color: var(--ink); }
nav.tabs a .dot { position: absolute; top: 12px; left: calc(50% + 10px); width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 16px; max-width: calc(100% - 40px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 700px) { body { font-size: 18px; } }
