@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-italic.woff2) format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jetbrains-mono.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --paper: #fbf8f2;
  --paper-2: #f4efe5;
  --sheet: #fffefb;
  --ink: #211c15;
  --ink-2: #5d5547;
  --ink-3: #736a5a;
  --line: rgba(33, 28, 21, .09);
  --line-2: rgba(33, 28, 21, .17);
  --tint: rgba(33, 28, 21, .045);
  --tint-2: rgba(33, 28, 21, .08);
  --sun: #c44510;
  --sun-ink: #b4430f;
  --sun-soft: rgba(226, 92, 34, .11);
  --sun-softer: rgba(226, 92, 34, .055);
  --on-sun: #fff9f1;
  --link: #255b90;
  --ok: #3c7a4d;
  --avatar-s: 42%;
  --avatar-bg-l: 86%;
  --avatar-fg-l: 26%;
  --shadow: 0 1px 2px rgba(33, 28, 21, .05), 0 12px 32px -16px rgba(33, 28, 21, .2);
  --shadow-pop: 0 2px 6px rgba(33, 28, 21, .08), 0 24px 56px -18px rgba(33, 28, 21, .3);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --measure: 800px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13110d;
    --paper-2: #0e0c09;
    --sheet: #1b1813;
    --ink: #f2eadb;
    --ink-2: #bcb29f;
    --ink-3: #8f8674;
    --line: rgba(242, 234, 219, .09);
    --line-2: rgba(242, 234, 219, .18);
    --tint: rgba(242, 234, 219, .05);
    --tint-2: rgba(242, 234, 219, .09);
    --sun: #ff9a4a;
    --sun-ink: #ffb27a;
    --sun-soft: rgba(255, 154, 74, .15);
    --sun-softer: rgba(255, 154, 74, .07);
    --on-sun: #1b0f05;
    --link: #93b9e6;
    --ok: #79bd8b;
    --avatar-s: 30%;
    --avatar-bg-l: 24%;
    --avatar-fg-l: 84%;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
    --shadow-pop: 0 2px 6px rgba(0, 0, 0, .5), 0 24px 56px -18px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #13110d;
  --paper-2: #0e0c09;
  --sheet: #1b1813;
  --ink: #f2eadb;
  --ink-2: #bcb29f;
  --ink-3: #8f8674;
  --line: rgba(242, 234, 219, .09);
  --line-2: rgba(242, 234, 219, .18);
  --tint: rgba(242, 234, 219, .05);
  --tint-2: rgba(242, 234, 219, .09);
  --sun: #ff9a4a;
  --sun-ink: #ffb27a;
  --sun-soft: rgba(255, 154, 74, .15);
  --sun-softer: rgba(255, 154, 74, .07);
  --on-sun: #1b0f05;
  --link: #93b9e6;
  --ok: #79bd8b;
  --avatar-s: 30%;
  --avatar-bg-l: 24%;
  --avatar-fg-l: 84%;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, .5), 0 24px 56px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
#root { height: var(--app-h, 100dvh); }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; border-radius: 4px; }
textarea:focus-visible, input:focus-visible { outline: none; }
h1, h2, h3, p { margin: 0; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--tint-2) transparent; overscroll-behavior: contain; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
kbd { font: 500 11px/1 var(--sans); padding: 3px 5px; border-radius: 5px; background: var(--tint); color: var(--ink-3); border: 1px solid var(--line); }

/* ---- Shell ---- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100%; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--paper-2); border-right: 1px solid var(--line); }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }

.side-top { display: flex; align-items: center; gap: 6px; padding: 14px 12px 8px 16px; }
.team-btn { display: flex; align-items: center; gap: 6px; min-width: 0; font: 600 17px/1.2 var(--serif); letter-spacing: -.005em; padding: 4px 6px; margin-left: -6px; border-radius: 7px; }
.team-btn:hover { background: var(--tint); }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--tint-2); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--sun-ink); }

.nav { padding: 2px 8px 6px; display: grid; gap: 1px; }
.nav-item, .conv-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 6px 8px; border-radius: 8px; color: var(--ink-2); min-height: 32px; font-size: 14.5px;
}
.nav-item:hover, .conv-item:hover { background: var(--tint); color: var(--ink); }
.nav-item.on, .conv-item.on { background: var(--tint-2); color: var(--ink); }
.nav-item.primary { font-weight: 600; color: var(--ink); }
.nav-item .count { margin-left: auto; }
.nav-item kbd { margin-left: auto; }

.side-list { flex: 1; min-height: 0; padding: 6px 8px 10px; }
.side-label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 12px 8px 4px; }
.conv-item .glyph { width: 20px; flex: none; display: grid; place-items: center; color: var(--ink-3); }
.conv-item.unread { color: var(--ink); font-weight: 600; }
.conv-item.quiet:not(.unread):not(.on) { color: var(--ink-3); }
.conv-item.muted-conv { opacity: .62; }
.conv-item .name { flex: 1; min-width: 0; }
.count { font: 600 11.5px/18px var(--sans); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; text-align: center; background: var(--sun); color: var(--on-sun); }
.count.calm { background: var(--tint-2); color: var(--ink-2); }
.dot-unread { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); flex: none; margin-right: 4px; }

.me-wrap { display: flex; align-items: center; border-top: 1px solid var(--line); padding-right: 8px; }
.me-row { display: flex; align-items: center; gap: 9px; padding: 9px 4px 9px 12px; flex: 1; min-width: 0; text-align: left; }
.me-row:hover { background: var(--tint); }
.me-moon[aria-pressed="true"] { color: var(--sun-ink); }
.quiet-fold { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 10px; font-size: 13px; color: var(--ink-3); border-radius: 8px; }
.quiet-fold:hover { background: var(--tint); color: var(--ink); }
.quiet-fold[aria-expanded="true"] .i { transform: rotate(180deg); }
.me-row .who { min-width: 0; flex: 1; line-height: 1.25; }
.me-row .nm { font-weight: 600; font-size: 14px; }
.me-row .st { font-size: 12.5px; color: var(--ink-3); }

/* ---- Avatars ---- */
.av {
  --h: 30;
  position: relative; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  width: 36px; height: 36px; font: 600 14px/1 var(--serif); letter-spacing: -.01em;
  background: hsl(var(--h) var(--avatar-s) var(--avatar-bg-l));
  color: hsl(var(--h) 52% var(--avatar-fg-l));
}
.av img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.av.s20 { width: 20px; height: 20px; font-size: 9.5px; }
.av.s18 { width: 18px; height: 18px; font-size: 8.5px; }
.av.s26 { width: 26px; height: 26px; font-size: 11px; }
.av.bot { border-radius: 10px; background: var(--tint-2); color: var(--ink-2); }
.av.s20.bot, .av.s18.bot { border-radius: 6px; }
.av.on::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 28%; height: 28%; min-width: 7px; min-height: 7px;
  border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--paper-2);
}
.stack-avs { display: inline-flex; }
.stack-avs .av { box-shadow: 0 0 0 2px var(--paper); }
.stack-avs .av + .av { margin-left: -5px; }

/* ---- Headers ---- */
.head { display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-height: 58px; border-bottom: 1px solid var(--line); flex: none; }
.back-btn { display: none; }
.stack-mobile-head { display: none; }
.head-title { font: 600 19px/1.2 var(--serif); letter-spacing: -.008em; }
.head-sub { font-size: 13px; color: var(--ink-3); line-height: 1.3; }
.head-sub a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.head .sharp { color: var(--ink-3); font-family: var(--sans); font-weight: 500; margin-right: 1px; }

/* ---- Message list ---- */
.app-frame { display: flex; flex-direction: column; height: 100%; }
.app-frame .shell { flex: 1; min-height: 0; }
.conv { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.list-box { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.stack-view { flex: 1; }
.list { flex: 1; min-height: 0; overflow-anchor: none; position: relative; }
.list-inner { max-width: var(--measure); margin: 0 auto; padding: 16px 20px 6px; min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.day { position: sticky; top: 0; z-index: 2; background: var(--paper); display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; padding: 6px 0; font: italic 500 14px/1 var(--serif); color: var(--ink-2); }
.day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.new-mark { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--sun-ink); }
.new-mark::after { content: ""; flex: 1; height: 1px; background: var(--sun); opacity: .5; }

.msg { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 11px; padding: 3px 8px; margin: 0 -8px; border-radius: 10px; }
.msg.first { margin-top: 12px; }
.msg:hover, .msg.acts-open { background: var(--tint); }
.msg.ping { background: var(--sun-softer); box-shadow: inset 2px 0 0 var(--sun); border-radius: 2px 10px 10px 2px; }
.msg.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 40% { background: var(--sun-soft); } 100% { background: transparent; } }
.msg .gutter-time { font-size: 10.5px; color: var(--ink-3); text-align: right; opacity: 0; line-height: 22px; white-space: nowrap; }
.msg:hover .gutter-time { opacity: 1; }
.msg .meta { display: flex; align-items: baseline; gap: 7px; line-height: 1.3; margin-bottom: 1px; }
.msg .author { font-weight: 600; font-size: 14.5px; }
button.author:hover { text-decoration: underline; text-underline-offset: 2px; }
.person-card { position: fixed; z-index: 60; width: 240px; padding: 14px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: 13px; box-shadow: var(--shadow-pop); animation: pop .1s var(--ease); }
.pc-name { font: 600 16px/1.25 var(--serif); margin-top: 8px; }
.pc-status { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.pc-meta { font-size: 12.5px; color: var(--ink-3); margin: 3px 0 10px; }
.msg .time { font-size: 12px; color: var(--ink-3); }
.tag { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line-2); padding: 0 4px; border-radius: 4px; line-height: 15px; }
.msg.bot-msg .body { color: var(--ink-2); font-size: 14px; }
.msg.bot-msg .author { font-weight: 500; color: var(--ink-2); }
.msg .edited { font-size: 11.5px; color: var(--ink-3); margin-left: 4px; }
.msg.pending { opacity: .55; }
.msg.failed .body { color: var(--sun-ink); }
.fail-note { font-size: 12.5px; color: var(--sun-ink); display: flex; gap: 10px; }
.fail-note button { text-decoration: underline; }
.deleted-note { font-style: italic; color: var(--ink-3); font-size: 14px; }

.body { overflow-wrap: anywhere; line-height: 1.5; }
.body p { margin: 0; white-space: pre-wrap; }
.body p + p, .body pre + p, .body blockquote + p, .body ul + p, .body ol + p { margin-top: 6px; }
.body pre { margin: 6px 0; padding: 10px 12px; border-radius: 9px; background: var(--tint); border: 1px solid var(--line); font: 13px/1.5 var(--mono); overflow-x: auto; white-space: pre; }
.body code { font: .88em/1.4 var(--mono); padding: 1px 5px; border-radius: 5px; background: var(--tint-2); }
.body pre code { padding: 0; background: none; font-size: 13px; }
.body blockquote { margin: 4px 0; padding-left: 11px; border-left: 2px solid var(--line-2); color: var(--ink-2); white-space: pre-wrap; }
.body ul, .body ol { margin: 4px 0; padding-left: 21px; }
.body a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 2px; }
.body.big-emoji { font-size: 32px; line-height: 1.25; }
.body.clamped { max-height: 340px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.show-more { font-size: 13px; font-weight: 600; color: var(--link); margin-top: 2px; }
.show-more:hover { text-decoration: underline; text-underline-offset: 2px; }
.mention { font-weight: 600; color: var(--ink); background: var(--tint-2); padding: 0 3px; border-radius: 4px; }
.mention.me { color: var(--sun-ink); background: var(--sun-soft); }
.chan-link { font-weight: 500; }
mark { background: var(--sun-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

.quotes { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.quote-card { display: block; width: 100%; max-width: 560px; text-align: left; padding: 8px 12px; border-left: 2px solid var(--line-2); border-radius: 0 9px 9px 0; background: var(--tint); font-size: 14px; }
.quote-card:hover { background: var(--tint-2); }
.quote-src { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 2px; flex-wrap: wrap; }
.quote-src b { font-weight: 600; }
.quote-text { color: var(--ink-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.img-file { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--tint); max-width: min(420px, 100%); }
.img-file img { display: block; width: 100%; height: auto; }
.video-file { display: block; max-width: min(480px, 100%); max-height: 360px; border-radius: 10px; background: #000; }
.audio-file { display: block; max-width: 100%; }
.viewer { margin: auto; max-width: 92vw; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: zoom-out; }
.viewer img { display: block; max-width: 92vw; max-height: 84vh; border-radius: 8px; object-fit: contain; }
.viewer figcaption { color: #f2eadb; font-size: 13.5px; }
.viewer figcaption a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.file-chip { display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--sheet); color: var(--ink); font-size: 13.5px; max-width: 320px; }
.file-chip:hover { background: var(--tint); text-decoration: none; }
.file-chip small { color: var(--ink-3); display: block; font-size: 12px; }

.rx-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; align-items: center; }
.rx { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 12px; font-size: 12.5px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink-2); }
.rx:hover { border-color: var(--line-2); }
.rx.me { background: var(--sun-soft); border-color: transparent; color: var(--sun-ink); font-weight: 600; }

/* Hover actions */
.acts { position: absolute; right: 8px; top: -13px; display: none; align-items: center; gap: 1px; padding: 2px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: 9px; box-shadow: var(--shadow); z-index: 3; }
.msg:hover > .acts, .msg:focus-within > .acts, .msg.acts-open > .acts { display: flex; }
.acts button { width: 28px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--ink-2); }
.acts button:hover { background: var(--tint-2); color: var(--ink); }
.acts .quick-rx { font-size: 14px; }

/* Threads */
.thread-bar { display: inline-flex; align-items: center; gap: 8px; margin-top: 5px; padding: 3px 9px 3px 5px; border-radius: 9px; font-size: 13px; color: var(--ink-2); max-width: 100%; border: 1px solid transparent; }
.thread-bar:hover { background: var(--sheet); border-color: var(--line-2); }
.thread-bar .n { font-weight: 600; color: var(--link); white-space: nowrap; }
.thread-bar.fresh .n { color: var(--sun-ink); }
.reply-line { display: flex; align-items: center; gap: 7px; margin: 3px 0 3px 19px; padding: 3px 8px 3px 26px; font-size: 13px; color: var(--ink-2); position: relative; border-radius: 8px; width: calc(100% - 19px); text-align: left; }
.reply-line::before { content: ""; position: absolute; left: 4px; top: -2px; width: 15px; height: 13px; border-left: 1.5px solid var(--line-2); border-bottom: 1.5px solid var(--line-2); border-bottom-left-radius: 8px; }
.reply-line:hover { background: var(--tint); }
.reply-line b { font-weight: 600; color: var(--ink); }
.reply-line .quote { color: var(--ink-3); white-space: nowrap; }
.reply-line.fresh b { color: var(--sun-ink); }
.thread { margin: 6px 0 8px 47px; border-left: 1.5px solid var(--line-2); padding-left: 12px; }
.thread.at-line { margin-left: 19px; }
.thread-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 2px; }
.thread-head button { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
.thread-quote { font-size: 13.5px; color: var(--ink-2); padding: 2px 0 6px; }
.thread .msg { grid-template-columns: 26px minmax(0, 1fr); column-gap: 9px; }
.thread .msg.first { margin-top: 8px; }
.thread .composer { margin: 8px 0 2px; }

.pill-new { position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 15px; background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-pop); }
.system-line { font-size: 13px; color: var(--ink-3); padding: 6px 0 6px 47px; }

/* ---- Composer ---- */
.composer-wrap { max-width: var(--measure); margin: 0 auto; width: 100%; padding: 4px 20px calc(10px + env(safe-area-inset-bottom)); position: relative; flex: none; }
.composer { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 14px; background: var(--sheet); box-shadow: var(--shadow); transition: border-color .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--sun) 55%, var(--line-2)); }
.composer.drag { border-color: var(--sun); background: var(--sun-softer); }
.composer .inner { display: flex; align-items: flex-end; gap: 2px; padding: 5px 6px; }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 0; background: transparent; outline: 0; padding: 6px 6px; line-height: 1.45; max-height: 240px; display: block; }
.composer textarea::placeholder { color: var(--ink-3); }
.send-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--tint-2); color: var(--ink-3); transition: background .12s, color .12s; flex: none; }
.send-btn.ready { background: var(--sun); color: var(--on-sun); }
.reply-to { display: flex; align-items: center; gap: 6px; padding: 6px 12px 0; font-size: 12.5px; color: var(--ink-3); }
.reply-to b { color: var(--ink-2); font-weight: 600; }
.reply-to button { margin-left: auto; color: var(--ink-3); }
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 5px 3px 9px; border-radius: 8px; background: var(--tint); font-size: 12.5px; max-width: 240px; }
.attach-chip.busy { opacity: .6; }
.attach-thumb { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; display: block; }
.attach-chip button { color: var(--ink-3); display: grid; place-items: center; }
.under { min-height: 20px; font-size: 12.5px; color: var(--ink-3); padding: 3px 6px 0; display: flex; gap: 12px; }
.under .quiet-note { color: var(--ink-2); }
.under .urgent-btn { color: var(--sun-ink); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; margin-left: 6px; }
.join-link { color: var(--link); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.typing-dots { display: inline-flex; gap: 2px; margin-right: 5px; vertical-align: middle; }
.typing-dots i { width: 3.5px; height: 3.5px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.suggest { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--sheet); border: 1px solid var(--line-2); border-radius: 11px; box-shadow: var(--shadow-pop); padding: 4px; max-height: 260px; overflow-y: auto; z-index: 20; }
.suggest button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border-radius: 7px; text-align: left; font-size: 14px; }
.suggest button.sel { background: var(--tint-2); }
.suggest small { color: var(--ink-3); margin-left: auto; font-size: 12px; }
.suggest .emo { font-size: 18px; width: 22px; text-align: center; }

/* ---- The Stack ---- */
.stack-view { flex: 1; min-height: 0; }
.stack-col { max-width: 760px; margin: 0 auto; padding: 34px 24px 80px; }
.stack-title { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 4px; }
.stack-title h1 { font: 560 34px/1.1 var(--serif); letter-spacing: -.018em; flex: 1; }
.stack-sub { color: var(--ink-2); margin-bottom: 22px; font-size: 14.5px; }
.link-btn { color: var(--ink-3); font-size: 13.5px; }
.link-btn:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.tier { display: flex; align-items: center; gap: 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 26px 0 10px; }
.tier.for-you { color: var(--sun-ink); }
.tier::after { content: ""; flex: 1; height: 1px; background: var(--line); order: 1; }
.tier-clear { order: 2; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-3); padding: 2px 6px; border-radius: 6px; }
.tier-clear:hover { background: var(--tint-2); color: var(--ink); }

.card { position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); margin-bottom: 12px; transition: transform .22s var(--ease), opacity .18s, border-color .15s; }
.card.focus { border-color: var(--line-2); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--sun) 55%, transparent), var(--shadow); }
.card.leaving { opacity: 0; transform: translateX(-26px) scale(.985); }
.card.bot-card { box-shadow: none; background: transparent; border-style: dashed; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px 2px; }
.card-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; min-width: 0; color: var(--ink); }
.card-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-name .sharp { color: var(--ink-3); font-weight: 500; }
.card-count { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.card-msgs { padding: 0 14px 4px; }
.card-msgs .msg { margin: 0 -6px; padding: 2px 6px; }
.card-msgs .msg.first { margin-top: 8px; }
.gap-note { display: block; font-size: 12.5px; color: var(--ink-3); padding: 6px 0 0 47px; }
.gap-note:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.in-reply { font-size: 12.5px; color: var(--ink-3); margin-bottom: 1px; }
.in-reply b { font-weight: 600; color: var(--ink-2); }
.card-foot { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 12px; }
.card-foot .composer { flex: 1; min-width: 0; box-shadow: none; border-radius: 11px; background: transparent; }
.card-foot .composer .inner { padding: 2px 4px; }
.card-foot .composer textarea { padding: 5px 7px; font-size: 14.5px; }
.card-foot .send-btn { width: 26px; height: 26px; border-radius: 7px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px; border: 1px solid var(--line-2); background: var(--sheet); white-space: nowrap; }
a.btn { color: var(--ink); }
a.btn.primary { color: var(--on-sun); }
.btn:hover { background: var(--tint); text-decoration: none; }
.btn.primary { background: var(--sun); border-color: transparent; color: var(--on-sun); }
.btn.primary:hover { filter: brightness(1.06); background: var(--sun); }
.btn.danger { color: var(--sun-ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.done-btn { height: 36px; padding: 0 12px; gap: 8px; }
.later-btn { height: 36px; width: 36px; padding: 0; color: var(--ink-2); }
.done-btn kbd { background: transparent; }

.clear-state { text-align: center; padding: 11vh 20px 40px; }
.clear-state .mark { width: 64px; height: 64px; color: var(--ink-3); margin: 0 auto 18px; display: block; }
.clear-state h1 { font: 560 40px/1.1 var(--serif); letter-spacing: -.02em; margin-bottom: 8px; }
.clear-state p { color: var(--ink-2); }

.catchup { margin: 8px 0 2px; }
.catchup-go { display: inline-flex; align-items: center; gap: 6px; color: var(--sun-ink); font-weight: 600; }
.catchup-go:hover { color: var(--sun-ink); }
.catchup:has(.body) { padding: 10px 12px; border-radius: 10px; background: var(--tint); }
.catchup-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }

.first-run { padding-top: 6vh; }
.first-run h1 { font: 560 38px/1.1 var(--serif); letter-spacing: -.02em; margin-bottom: 8px; }
.first-run .lede { color: var(--ink-2); margin-bottom: 24px; }
.first-step { padding: 18px 0; border-top: 1px solid var(--line); }
.first-step h3 { font: 560 18px/1.25 var(--serif); margin: 0 0 3px; }
.first-step p { color: var(--ink-2); font-size: 14.5px; margin-bottom: 10px; }

.later-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.later-item.due { border-color: color-mix(in srgb, var(--sun) 45%, var(--line)); background: var(--sun-softer); }
.later-item .txt { flex: 1; min-width: 0; font-size: 14px; }
.later-item .src { font-size: 12.5px; color: var(--ink-3); }
.later-item .src b { color: var(--sun-ink); font-weight: 600; }
.later-item .snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.join-list { max-width: 460px; margin: 0 auto; }
.join-list .glyph { width: 20px; display: grid; place-items: center; }
.plain-link { font-weight: 600; }
.plain-link:hover { text-decoration: underline; text-underline-offset: 2px; }

.stack-tip { display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 11px; background: var(--sun-soft); font-size: 14px; margin-bottom: 8px; }
.stack-tip .grow { min-width: 0; }

.nudge { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; background: var(--tint); margin-bottom: 18px; font-size: 14px; }
.demo-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 7px 16px; font-size: 13.5px; background: var(--ink); color: var(--paper); flex: none; }
.demo-short { display: none; }
.demo-bar a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---- Find ---- */
.overlay { position: fixed; inset: 0; background: rgba(15, 12, 8, .32); z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.find { width: 620px; max-width: 100%; background: var(--sheet); border-radius: 16px; border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; }
.find-input { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.find-input input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; min-width: 0; }
.scope-chip { flex: none; padding: 3px 9px; border-radius: 8px; font-size: 12.5px; color: var(--ink-3); border: 1px solid var(--line-2); white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.scope-chip[aria-pressed="true"] { background: var(--sun-soft); color: var(--sun-ink); border-color: transparent; font-weight: 600; }
.find-results { padding: 6px; flex: 1; min-height: 0; }
.find-label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 9px 10px 3px; }
.find-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 9px; text-align: left; min-height: 36px; }
.find-item.sel { background: var(--tint-2); }
.find-item .glyph { width: 22px; display: grid; place-items: center; color: var(--ink-3); flex: none; }
.find-item small { color: var(--ink-3); font-size: 12.5px; }
.find-item .side-note { margin-left: auto; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.find-msg { align-items: flex-start; }
.find-msg .txt { min-width: 0; flex: 1; font-size: 14px; }
.find-msg .src { font-size: 12.5px; color: var(--ink-3); }
.find-msg .snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.find-empty { padding: 26px 14px; text-align: center; color: var(--ink-3); font-size: 14px; }
.ask-box { padding: 10px 10px 6px; }
.ask-answer { font-size: 15.5px; line-height: 1.5; margin: 4px 0 10px; }
.ask-cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px; border-radius: 5px; background: var(--sun-soft); color: var(--sun-ink); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }
.ask-cite:hover { background: var(--sun); color: var(--on-sun); }
.ask-sources { border-top: 1px solid var(--line); padding-top: 6px; }
.ask-sources .find-item:hover { background: var(--tint-2); }
.ask-n { flex: none; width: 22px; text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-3); padding-top: 1px; }
.find-tips { display: flex; flex-wrap: wrap; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.find-tips code { font: 12px var(--mono); color: var(--ink-2); }

/* ---- Menus, dialogs, toasts ---- */
.menu { position: fixed; z-index: 60; min-width: 190px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 5px; animation: pop .1s var(--ease); max-height: 80vh; overflow-y: auto; }
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 9px; border-radius: 8px; text-align: left; font-size: 14px; min-height: 32px; }
.menu button:hover, .menu button.sel { background: var(--tint-2); }
.menu button.danger { color: var(--sun-ink); }
.menu button .check { margin-left: auto; color: var(--sun-ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .menu-label { font-size: 12px; color: var(--ink-3); padding: 5px 9px 3px; }
.menu .menu-note { font-size: 12px; color: var(--ink-3); display: block; line-height: 1.3; }

.dialog { width: 520px; max-width: 100%; background: var(--sheet); border-radius: 16px; border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; max-height: 84vh; }
.dialog.wide { width: 640px; }
.dialog-head { display: flex; align-items: center; padding: 16px 18px 6px; }
.dialog-head h2 { font: 560 22px/1.2 var(--serif); letter-spacing: -.01em; flex: 1; }
.dialog-body { padding: 8px 18px 18px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 16px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.field small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--paper); }
.input:focus { border-color: var(--sun); outline: 0; }
select.input { padding-right: 6px; }
.section-h { font-weight: 600; margin: 18px 0 6px; font-size: 14.5px; }
.section-note { color: var(--ink-2); font-size: 13.5px; margin-bottom: 8px; }
.check-row { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--sun); margin: 0; }
.time-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.time-row .input { width: 146px; }
.seg { display: inline-flex; padding: 2px; background: var(--tint); border-radius: 9px; gap: 2px; }
.seg button { padding: 4px 11px; border-radius: 7px; font-size: 13.5px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.person-row .who { flex: 1; min-width: 0; line-height: 1.25; }
.person-row small { color: var(--ink-3); font-size: 12.5px; }
.copy-row { display: flex; gap: 6px; }
.photo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.similar { font-size: 13px; color: var(--ink-2); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.similar button { padding: 2px 8px; border-radius: 7px; background: var(--tint); font-weight: 500; }
.error-text { color: var(--sun-ink); font-size: 13.5px; margin: 6px 0; }
.progress { height: 6px; border-radius: 3px; background: var(--tint-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--sun); transition: width .2s; }

.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 70; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 11px; background: var(--ink); color: var(--paper); font-size: 14px; box-shadow: var(--shadow-pop); animation: toast .18s var(--ease); max-width: 90vw; }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }
.toast button { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; color: inherit; }

.emoji-pop { position: fixed; z-index: 60; width: 320px; max-width: calc(100vw - 16px); background: var(--sheet); border: 1px solid var(--line-2); border-radius: 13px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.emoji-pop input { border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 12px; outline: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); padding: 6px; max-height: 240px; overflow-y: auto; }
.emoji-grid button { aspect-ratio: 1; font-size: 20px; border-radius: 7px; display: grid; place-items: center; }
.emoji-grid button:hover, .emoji-grid button.sel { background: var(--tint-2); }

.status-bar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 30; padding: 4px 12px; border-radius: 13px; background: var(--ink); color: var(--paper); font-size: 13px; }

/* ---- Auth pages ---- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; height: 100%; }
.auth-card { width: 400px; max-width: 100%; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; font: 600 23px/1 var(--serif); letter-spacing: -.012em; color: var(--ink); margin-bottom: 26px; }
.wordmark:hover { text-decoration: none; }
.wordmark svg { width: 26px; height: 26px; border-radius: 6px; }
.auth h1 { font: 560 31px/1.12 var(--serif); letter-spacing: -.018em; margin-bottom: 6px; }
.auth .lede { color: var(--ink-2); margin-bottom: 22px; }
.auth form .btn { width: 100%; height: 42px; margin-top: 4px; }
.auth .alt { margin-top: 16px; color: var(--ink-2); font-size: 14px; }
.boot-msg { display: grid; place-items: center; height: 100%; color: var(--ink-3); }

/* ---- Phones ---- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); position: relative; overflow: hidden; }
  .side { position: absolute; inset: 0; z-index: 2; border-right: 0; background: var(--paper); transition: transform .2s var(--ease); }
  .shell.in-view .side { transform: translateX(-100%); visibility: hidden; transition: transform .2s var(--ease), visibility 0s .2s; }
  .main { position: absolute; inset: 0; background: var(--paper); }
  .back-btn { display: inline-grid; margin-left: -6px; }
  .demo-long { display: none; }
  .demo-short { display: inline; }
  .stack-mobile-head { display: flex; }
  .stack-title h1 { display: none; }
  .stack-title { justify-content: flex-end; min-height: 0; }
  .stack-title .link-btn { position: absolute; right: 14px; top: 16px; z-index: 3; }
  .head { padding: 8px 12px; min-height: 52px; }
  .nav-item, .conv-item { min-height: 42px; font-size: 16px; }
  .nav-item kbd { display: none; }
  .list-inner { padding: 12px 14px 4px; }
  .composer-wrap { padding: 4px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer textarea, .card-foot .composer textarea { font-size: 16px; }
  .stack-col { padding: 16px 12px 60px; }
  .stack-title h1 { font-size: 28px; }
  .acts { right: 4px; }
  .acts button { width: 36px; height: 34px; }
  .done-btn kbd { display: none; }
  .thread { margin-left: 16px; }
  .overlay { padding: 8px; }
  .find { max-height: calc(100dvh - 16px); }
  .input { font-size: 16px; }
  .find-tips { display: none; }
  .msg { grid-template-columns: 34px minmax(0, 1fr); }
  .card-head { padding: 10px 12px 2px; }
  .card-msgs { padding: 0 12px 4px; }
  .gap-note { padding-left: 45px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
