/* KeepThePeeps — marshmallow palette, plum ink. Mobile first. */
@font-face { font-family: 'Bricolage'; src: url(/fonts/bricolage.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url(/fonts/figtree.woff2) format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  --ink: #231b2e;
  --ink-2: #6a5f7a;
  --line: #ebe3f2;
  --canvas: #fbf8fd;
  --surface: #ffffff;
  --sunk: #f3edf8;
  --accent: #d6336c;
  --accent-ink: #ffffff;
  --accent-soft: #ffe3ee;
  --chick: #ffd54a;
  --sky: #d4eaff;
  --lilac: #e6dcff;
  --good: #1f8a5b;
  --warn: #b45309;
  --shadow: 0 1px 2px rgba(35, 27, 46, 0.06), 0 8px 24px -8px rgba(35, 27, 46, 0.18);
  --dock-h: 72px;
  --r: 20px;
  --display: 'Bricolage', 'Figtree', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #f5effa; --ink-2: #b4a8c4; --line: #382d47; --canvas: #17101f; --surface: #211a2c; --sunk: #2a2137;
    --accent: #ff7aae; --accent-ink: #2a0a19; --accent-soft: #432034; --sky: #223a52; --lilac: #3a2f5c; --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --ink: #f5effa; --ink-2: #b4a8c4; --line: #382d47; --canvas: #17101f; --surface: #211a2c; --sunk: #2a2137;
  --accent: #ff7aae; --accent-ink: #2a0a19; --accent-soft: #432034; --sky: #223a52; --lilac: #3a2f5c; --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.12; margin: 0; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.good { color: var(--good); } .bad { color: var(--accent); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
#app { min-height: 100dvh; }
.page { max-width: 720px; margin: 0 auto; padding: 20px 18px calc(var(--dock-h) + 40px + env(safe-area-inset-bottom)); }
.page > * + * { margin-top: 22px; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.top .sub { margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 8px 8px 8px 0; color: var(--ink-2); font-weight: 600; min-height: 44px; }

.dock {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; gap: 4px; padding: 6px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow); border: 1px solid var(--line);
  width: min(440px, calc(100% - 24px));
}
.dock a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 0.7rem; font-weight: 650; transition: background 0.18s, color 0.18s; }
.dock a svg { width: 22px; height: 22px; }
.dock a[aria-current='page'] { background: var(--accent); color: var(--accent-ink); }
.dock .badge { position: absolute; }

@media (min-width: 900px) {
  .page { margin-left: calc(50% - 360px + 40px); padding-bottom: 60px; }
  .dock { left: 0; top: 0; bottom: 0; transform: none; flex-direction: column; justify-content: flex-start; width: 92px; border-radius: 0; border: 0; border-right: 1px solid var(--line); box-shadow: none; padding: 24px 10px; gap: 8px; background: var(--surface); }
  .dock a { flex: 0 0 auto; min-height: 64px; border-radius: 18px; }
}

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0; font-weight: 700; background: var(--accent); color: var(--accent-ink); text-decoration: none; transition: transform 0.12s, filter 0.12s; }
.btn:active { transform: scale(0.97); }
.btn:hover { filter: brightness(1.05); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: var(--sunk); color: var(--ink); text-decoration: none; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.accent { background: var(--accent-soft); color: var(--accent); }
.icon-btn.go { background: var(--accent); color: var(--accent-ink); }
.row-actions { display: flex; gap: 8px; }

.field { display: block; }
.field > span { display: block; font-size: 0.85rem; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.stack > * + * { margin-top: 14px; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 650; font-size: 0.9rem; white-space: nowrap; }
.chip[aria-pressed='true'], .chip.on { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 18px 8px; margin: 0 -18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--sunk); font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--sunk); padding: 4px; border-radius: 16px; gap: 4px; }
.seg button { border: 0; background: transparent; min-height: 44px; border-radius: 12px; font-weight: 700; font-size: 0.8rem; padding: 4px 2px; line-height: 1.15; color: var(--ink-2); }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- avatars ---------- */
.avatar { --h: 330; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; font-family: var(--display); font-weight: 800; font-size: 1.05rem; background: hsl(var(--h) 90% 88%); color: hsl(var(--h) 55% 24%); user-select: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .avatar { background: hsl(var(--h) 40% 26%); color: hsl(var(--h) 90% 86%); } }
:root[data-theme='dark'] .avatar { background: hsl(var(--h) 40% 26%); color: hsl(var(--h) 90% 86%); }
.avatar.lg { width: 84px; height: 84px; font-size: 1.9rem; }
.avatar.t1 { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.avatar.t2 { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--chick); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.person { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person .who { flex: 1; min-width: 0; text-decoration: none; color: inherit; display: block; }
.person .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .meta { font-size: 0.85rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .meta .late { color: var(--accent); font-weight: 700; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.date-row { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.date-row:last-child { border-bottom: 0; }
.date-pill { width: 52px; text-align: center; padding: 6px 0; border-radius: 14px; background: var(--chick); color: #3a2c00; font-family: var(--display); font-weight: 800; line-height: 1.1; flex: none; }
.date-pill small { display: block; font-size: 0.7rem; font-weight: 700; font-family: var(--body); }
.empty { text-align: center; padding: 36px 20px; border: 2px dashed var(--line); border-radius: var(--r); }
.empty p { color: var(--ink-2); }

/* ---------- spin: the memorable thing ---------- */
.spin { position: relative; display: flex; align-items: center; gap: 16px; width: 100%; padding: 18px 22px; border: 0; text-align: left; color: #3a2c00;
  background: var(--chick); border-radius: 58% 42% 52% 48% / 52% 56% 44% 48%; box-shadow: 0 14px 30px -14px rgba(255, 180, 0, 0.8), inset 0 -6px 0 rgba(0, 0, 0, 0.06); transition: transform 0.15s; }
.spin:active { transform: scale(0.97) rotate(-1deg); }
.spin .dice { width: 52px; height: 52px; border-radius: 16px; background: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12); }
.spin .dice svg { width: 30px; height: 30px; color: #3a2c00; }
.spin b { font-family: var(--display); font-size: 1.3rem; font-weight: 800; display: block; line-height: 1.1; }
.spin span { font-size: 0.9rem; opacity: 0.8; }
@media (prefers-reduced-motion: no-preference) {
  .spin { animation: wobble 7s ease-in-out infinite; }
  @keyframes wobble { 0%, 100% { border-radius: 58% 42% 52% 48% / 52% 56% 44% 48%; } 50% { border-radius: 46% 54% 44% 56% / 58% 46% 54% 42%; } }
  .sheet { animation: rise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
  .pop { animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
  @keyframes pop { from { transform: scale(0.4) rotate(-12deg); opacity: 0; } }
}

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--lilac); }
.banner.warn { background: var(--accent-soft); }
.banner .grow { flex: 1; min-width: 0; font-size: 0.92rem; }
.nudge { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--sky); text-decoration: none; color: inherit; }
.nudge .grow { flex: 1; }
.nudge b { display: block; }
.meter { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- sheet / toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 10, 30, 0.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: min(560px, 100%); max-height: 92dvh; overflow: auto; border-radius: 28px 28px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: -8px auto 14px; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 28px; } .sheet .grab { display: none; } }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--dock-h) + 28px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 14px; align-items: center; background: var(--ink); color: var(--canvas); padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); font-weight: 600; max-width: calc(100% - 32px); }
.toast button { background: none; border: 0; color: var(--chick); font-weight: 800; padding: 4px; }
@media (min-width: 900px) { .toasts { bottom: 30px; } }

/* ---------- search ---------- */
.search { position: relative; }
.search svg { position: absolute; left: 16px; top: 14px; width: 20px; height: 20px; color: var(--ink-2); pointer-events: none; }
.search .input { padding-left: 46px; border-radius: 999px; background: var(--sunk); border-color: transparent; }
.search kbd { position: absolute; right: 14px; top: 12px; font: 600 0.75rem var(--body); color: var(--ink-2); border: 1.5px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--surface); }
@media (hover: none) { .search kbd { display: none; } }
.fab { position: fixed; right: 20px; bottom: calc(var(--dock-h) + 30px + env(safe-area-inset-bottom)); z-index: 20; width: 58px; height: 58px; border-radius: 22px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(214, 51, 108, 0.6); }
.fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) { .fab { right: calc(50% - 360px - 40px); bottom: 30px; } }

/* ---------- person detail ---------- */
.hero { display: flex; gap: 16px; align-items: center; }
.hero h1 { font-size: 1.7rem; }
.facts li, .timeline li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts li span, .timeline li div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.facts button.x { background: none; border: 0; color: var(--ink-2); padding: 6px; min-width: 36px; min-height: 36px; }
.timeline .dot { width: 34px; height: 34px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; flex: none; }
.timeline .dot svg { width: 16px; height: 16px; }
.inline-add { display: flex; gap: 8px; margin-top: 10px; }
.inline-add .input { flex: 1; }

/* ---------- chat ---------- */
.chatwrap { display: flex; flex-direction: column; min-height: calc(100dvh - var(--dock-h) - 150px); }
.bubbles { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.bubble { max-width: 86%; padding: 11px 16px; border-radius: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble.assistant { align-self: flex-start; background: var(--sunk); border-bottom-left-radius: 6px; }
.bubble .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bubble .acts .tag { background: var(--surface); }
.composer { position: sticky; bottom: calc(var(--dock-h) + 24px + env(safe-area-inset-bottom)); display: flex; gap: 8px; background: var(--canvas); padding: 8px 0; }
@media (min-width: 900px) { .composer { bottom: 12px; } }
.composer .input { border-radius: 999px; }
.typing i { display: inline-block; width: 8px; height: 8px; margin: 0 2px; border-radius: 50%; background: var(--ink-2); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------- plans ---------- */
.plans { display: grid; gap: 14px; }
@media (min-width: 760px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { border: 1.5px solid var(--line); border-radius: var(--r); padding: 20px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.plan.best { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.plan .price { font-family: var(--display); font-size: 2.2rem; font-weight: 800; line-height: 1; }
.plan .price small { font-size: 0.9rem; font-weight: 600; color: var(--ink-2); font-family: var(--body); }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.95rem; flex: 1; }
.plan li::before { content: '✓'; color: var(--good); font-weight: 800; margin-right: 8px; }
.lifetime { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--r); background: var(--chick); color: #3a2c00; }
.lifetime .grow { flex: 1; }
.lifetime .btn { background: #3a2c00; color: #fff; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; align-content: center; justify-items: center; padding: 24px 18px; gap: 24px; }
.auth .card { width: min(420px, 100%); }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 800; font-size: 1.7rem; letter-spacing: -0.04em; color: var(--ink); text-decoration: none; }
.tagline { font-size: 1.15rem; max-width: 22ch; text-align: center; font-family: var(--display); font-weight: 650; }

/* ---------- docs (privacy / terms / status) ---------- */
body.doc { background: var(--canvas); }
.docwrap { max-width: 680px; margin: 0 auto; padding: 32px 20px 80px; }
.docwrap h1 { margin-bottom: 8px; } .docwrap h2 { margin: 28px 0 8px; } .docwrap li { margin-bottom: 6px; }

.skeleton { height: 64px; border-radius: 16px; background: linear-gradient(90deg, var(--sunk), var(--line), var(--sunk)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 900px) { .spin { max-width: 560px; } }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.gbtn svg { flex: none; }

/* ---------- brand and delight ---------- */
.confetti { position: fixed; z-index: 80; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); animation: confetti 0.85s cubic-bezier(0.1, 0.8, 0.3, 1) forwards; }
@keyframes confetti { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 28px)) scale(0.4); opacity: 0; } }
.caught { display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-radius: var(--r); background: var(--sunk); }
.caught b { font-family: var(--display); font-size: 1.25rem; letter-spacing: -0.02em; }
.warmth { margin: 4px 0 0; }
.empty img { display: block; margin: 0 auto 14px; }
.dock-brand { display: none !important; }
@media (min-width: 900px) { .dock-brand { display: flex !important; flex: 0 0 auto !important; min-height: 48px !important; margin-bottom: 14px; } .dock-brand img { width: 52px; height: auto; } }
.spin b { font-size: 1.15rem; }
#view > .page { animation: page-in 0.24s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
.btn { white-space: nowrap; }

.btn svg { width: 18px; height: 18px; flex: none; }
.actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.actions .btn { flex-direction: column; gap: 4px; min-height: 64px; padding: 0 6px; border-radius: 20px; font-size: 0.82rem; }
.actions .btn svg { width: 22px; height: 22px; }
.facts li, .timeline li { align-items: center; }

/* ---------- triage: selection and shortcuts ---------- */
.selbox { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: transparent; display: grid; place-items: center; padding: 0; }
.selbox svg { width: 16px; height: 16px; }
.selbox[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + 22px + env(safe-area-inset-bottom)); z-index: 25; width: min(560px, calc(100% - 24px)); display: grid; gap: 8px; padding: 12px 14px; border-radius: 22px; background: var(--ink); color: var(--canvas); box-shadow: var(--shadow); }
.selbar[hidden] { display: none; }
.selbar .btn.ghost { color: var(--canvas); border-color: rgba(255, 255, 255, 0.35); }
.selbar .btn[disabled] { opacity: 0.4; }
.selinfo { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--chick); font-weight: 700; min-height: 32px; }
@media (min-width: 900px) { .selbar { bottom: 24px; } }
.key { margin-left: auto; font: 700 0.75rem var(--body); padding: 1px 7px; border-radius: 6px; border: 1.5px solid currentColor; opacity: 0.55; }
@media (hover: none) { .key { display: none; } }
.btn .key { margin-left: 8px; }
.btn.block { position: relative; }
.btn.block .key { position: absolute; right: 16px; margin: 0; }
.top .btn { align-self: center; }

/* clean-up steps */
.sortpage .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.sortpage .card h2 { font-size: 1.05rem; margin: 0; }
