/* EdenChat - soft garden theme: sage greens, warm cream, gentle shadows. */
:root {
  --green: #4f7f5b; --green-strong: #3b6648; --on-green: #fffdf8;
  --bg: #fbf9f3; --bg-2: #f4f0e6; --panel: #fffdf8; --hover: #f5f1e7; --active: #ebe6d8;
  --text: #2a332c; --text-2: #6f786e; --line: #e9e4d7;
  --wall: #f2eee2; --wall-2: #eae8d8;
  --in: #fffdf8; --out: #dcebd2; --out-quote: #cde0c2; --in-quote: #f3efe5;
  --tick: #9aa59a; --tick-read: #5f9fc4; --pill: #fffdf8; --pill-text: #6b756b;
  --chip: #f1ede2; --chip-on: #dcebd2; --chip-on-text: #33583e;
  --danger: #bf5540; --shadow: 0 1px 2px rgba(74, 82, 56, .10); --lift: 0 6px 22px rgba(74, 82, 56, .16);
  --overlay: rgba(42, 51, 44, .42); --ai: #8468b0;
  --r-bubble: 18px; --r-card: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --green: #84b98e; --green-strong: #9ccca4; --on-green: #12201a;
    --bg: #141a16; --bg-2: #1a221c; --panel: #1a221c; --hover: #212b24; --active: #2a362d;
    --text: #e7ebe0; --text-2: #94a194; --line: #27322a;
    --wall: #121813; --wall-2: #151d17;
    --in: #232d26; --out: #2f573c; --out-quote: #294d35; --in-quote: #1c2620;
    --tick: #8c9a8c; --tick-read: #7fbfe0; --pill: #212b24; --pill-text: #a3afa2;
    --chip: #232e26; --chip-on: #2b4a35; --chip-on-text: #d6ead0;
    --danger: #ea8f7b; --shadow: 0 1px 2px rgba(0, 0, 0, .35); --lift: 0 8px 26px rgba(0, 0, 0, .5);
    --overlay: rgba(0, 0, 0, .6); --ai: #b9a4e2;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: #027eb5; }
svg { width: 24px; height: 24px; flex: none; display: block; }
#app { height: 100vh; height: 100dvh; display: flex; }
.ib { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); flex: none; }
.ib:hover { background: var(--hover); }
.ib:focus-visible, .btn:focus-visible, .row:focus-visible, .chip:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- auth ---------- */
.auth { margin: auto; width: min(400px, 100%); padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; max-height: 100vh; max-height: 100dvh; overflow: auto; }
.auth img { width: 76px; height: 76px; align-self: center; }
.auth h1 { margin: 4px 0 0; text-align: center; font-size: 26px; color: var(--green-strong); }
.auth p { margin: 0; text-align: center; color: var(--text-2); font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--text-2); }
.field input { padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); font-size: 16px; color: var(--text); outline: none; }
.field input:focus { border-color: var(--green); }
.btn { padding: 13px 18px; border-radius: 24px; background: var(--green); color: var(--on-green); font-weight: 600; text-align: center; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: none; color: var(--green-strong); }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.danger { background: none; color: var(--danger); }
.btn.outline { background: none; color: var(--green-strong); border: 1px solid var(--line); }
.err { color: var(--danger); font-size: 14px; text-align: center; min-height: 19px; }

/* ---------- shell ---------- */
.side { width: 100%; display: flex; flex-direction: column; background: var(--panel); position: relative; min-width: 0; }
.pane { display: none; flex: 1; min-width: 0; flex-direction: column; background: var(--wall); position: relative; }
body.chat-open .side { display: none; }
body.chat-open .pane { display: flex; }
@media (min-width: 800px) {
  .side { width: 400px; flex: none; border-right: 1px solid var(--line); }
  body.chat-open .side { display: flex; }
  .pane { display: flex; }
  .back { display: none !important; }
  .fab { display: none !important; }
}
.side-top { display: flex; align-items: center; padding: 10px 8px 6px 16px; gap: 2px; }
.side-top h1 { flex: 1; margin: 0; font-size: 23px; font-weight: 700; color: var(--green-strong); letter-spacing: -.2px; }
@media (prefers-color-scheme: dark) { .side-top h1 { color: var(--text); } }
.searchpill { margin: 4px 12px 8px; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px; border-radius: 24px; background: var(--chip); color: var(--text-2); }
.searchpill svg { width: 20px; height: 20px; }
.searchpill input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; }
.searchpill input::placeholder, .composer textarea::placeholder { color: var(--text-2); }
.chips { display: flex; gap: 8px; padding: 0 12px 8px; }
.chip { padding: 6px 13px; border-radius: 18px; background: var(--chip); color: var(--text-2); font-size: 14px; }
.chip.on { background: var(--chip-on); color: var(--chip-on-text); font-weight: 500; }
.banner { padding: 8px 16px; background: #fff3c4; color: #5b4a00; font-size: 14px; text-align: center; }
.nudge { display: flex; align-items: center; gap: 12px; margin: 2px 12px 8px; padding: 10px 6px 10px 12px; border-radius: 14px; background: var(--chip-on); color: var(--chip-on-text); }
.nudge .ico { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: var(--on-green); display: grid; place-items: center; flex: none; }
.nudge .ico svg { width: 20px; height: 20px; }
.nudge .grow { flex: 1; min-width: 0; text-align: left; }
.nudge b { display: block; font-size: 15px; }
.nudge .grow span { font-size: 13px; opacity: .85; }
.nudge .ib { color: inherit; }
.list { flex: 1; overflow-y: auto; padding-bottom: 88px; }
.row { display: flex; align-items: center; gap: 13px; padding: 0 16px; width: 100%; text-align: left; min-height: 72px; }
.row:hover { background: var(--hover); }
.row.sel { background: var(--active); }
.row .mid { flex: 1; min-width: 0; padding: 12px 0; }
.row .l1, .row .l2 { display: flex; align-items: center; gap: 6px; }
.row .name { flex: 1; min-width: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .time { font-size: 12px; color: var(--text-2); flex: none; }
.row.unread .time { color: var(--green-strong); font-weight: 600; }
.row .prev { flex: 1; min-width: 0; font-size: 14.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.row .prev span { overflow: hidden; text-overflow: ellipsis; }
.row .prev svg { width: 17px; height: 17px; }
.badge { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: var(--green); color: var(--on-green); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.row .muted svg { width: 17px; height: 17px; color: var(--text-2); }
.empty-list { padding: 40px 28px; text-align: center; color: var(--text-2); }
.fab { position: absolute; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 16px; background: var(--green); color: var(--on-green); display: grid; place-items: center; box-shadow: 0 4px 10px rgba(0, 0, 0, .25); }

.av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 18px; flex: none; position: relative; user-select: none; }
.av.s { width: 40px; height: 40px; font-size: 15px; }
.av.xs { width: 28px; height: 28px; font-size: 12px; }
.av svg { width: 55%; height: 55%; }
.av .aib { position: absolute; right: -3px; bottom: -3px; background: var(--ai); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 7px; border: 2px solid var(--panel); line-height: 1.2; }
.c0 { background: #6f9f7a; } .c1 { background: #7b9bc2; } .c2 { background: #cf9763; } .c3 { background: #c08aa4; }
.c4 { background: #978cc4; } .c5 { background: var(--ai); } .c6 { background: #6ba6a6; } .c7 { background: #b5a15b; } .cg { background: #a3b19f; }
.n0 { color: #4f8a5e; } .n1 { color: #5a80b0; } .n2 { color: #b9793d; } .n3 { color: #ad6a8c; }
.n4 { color: #7d70b5; } .n5 { color: var(--ai); } .n6 { color: #4a8f8f; } .n7 { color: #998539; }
.aitag { display: inline-block; background: var(--ai); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 6px; vertical-align: 1px; margin-left: 5px; letter-spacing: .3px; }

/* ---------- chat pane ---------- */
.pane-empty { margin: auto; text-align: center; color: var(--text-2); padding: 30px; max-width: 420px; }
.pane-empty img { width: 84px; opacity: .9; }
.pane-empty h2 { color: var(--text); font-weight: 400; font-size: 26px; margin: 16px 0 8px; }
.chat-top { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 4px; background: var(--panel); min-height: 60px; border-bottom: 1px solid var(--line); z-index: 2; }
@media (min-width: 800px) { .chat-top { padding-left: 14px; } }
.chat-top .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; text-align: left; padding: 3px 4px; border-radius: 8px; }
.chat-top .t1 { font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-top .t2 { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-top .t2.busy { color: var(--green-strong); }
.chat-top .txt { min-width: 0; }
.findbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 2; }
.findbar input { flex: 1; min-width: 0; height: 38px; border-radius: 20px; border: 0; outline: 0; background: var(--chip); padding: 0 16px; }
.results { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: var(--panel); overflow-y: auto; z-index: 1; }
.results .hit { display: block; width: 100%; text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.results .hit:hover { background: var(--hover); }
.results .meta { font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.results .txt { font-size: 15px; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.results .none { padding: 30px; text-align: center; color: var(--text-2); }
.msgs-wrap { flex: 1; min-height: 0; position: relative; }
.msgs {
  position: absolute; inset: 0; overflow-y: auto; padding: 8px 0 6px; overflow-anchor: none;
  background-color: var(--wall);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220' fill='none' stroke='%23000' stroke-opacity='.05' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 46c0-14 9-23 27-24 0 17-8 27-21 27-2 0-4-1-6-3zM26 50c5-9 12-15 20-20'/%3E%3Cpath d='M150 30l8 14h-16zM150 44v8'/%3E%3Ccircle cx='96' cy='70' r='7'/%3E%3Cpath d='M96 54v-6M96 92v-6M80 70h-6M118 70h-6M85 59l-4-4M111 85l-4-4M85 81l-4 4M111 55l-4 4'/%3E%3Cpath d='M170 110c0-14 9-23 27-24 0 17-8 27-21 27-2 0-4-1-6-3zM172 114c5-9 12-15 20-20'/%3E%3Cpath d='M30 130h30v22H30zM26 130l19-14 19 14M41 152v-10h8v10'/%3E%3Cpath d='M110 150c8-10 20-10 28 0-8 10-20 10-28 0zM124 144v12'/%3E%3Cpath d='M70 196c0-8 6-14 14-14s14 6 14 14zM84 182v-8M78 176l6-4 6 4'/%3E%3Cpath d='M176 176l10 10M186 176l-10 10M181 172v18M172 181h18'/%3E%3C/svg%3E");
  background-size: 300px;
}
@media (prefers-color-scheme: dark) { .msgs { background-image: none; } }
.more { display: block; margin: 4px auto 8px; }
.day, .sys { display: flex; justify-content: center; padding: 6px 12px; }
.day span, .sys span { background: var(--pill); color: var(--pill-text); font-size: 12.5px; padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow); text-align: center; max-width: 88%; }
.unread-mark { display: flex; justify-content: center; padding: 6px; }
.unread-mark span { background: var(--pill); color: var(--pill-text); font-size: 12.5px; padding: 5px 14px; border-radius: 16px; box-shadow: var(--shadow); }
.m { display: flex; padding: 1px 4.5%; gap: 6px; position: relative; }
@media (max-width: 799px) { .m { padding: 1px 10px; } }
.m.first { margin-top: 9px; }
.m.out { justify-content: flex-end; }
.m.flash .b { animation: flash 1.6s; }
@keyframes flash { 0%, 60% { filter: brightness(.82); } 100% { filter: none; } }
.b { max-width: min(78%, 560px); min-width: 78px; background: var(--in); border-radius: 8px; padding: 6px 8px 7px 9px; box-shadow: var(--shadow); position: relative; overflow-wrap: anywhere; font-size: 15.2px; }
@media (max-width: 799px) { .b { max-width: 86%; } }
.m.out .b { background: var(--out); }
.m.first.in .b { border-top-left-radius: 0; }
.m.first.out .b { border-top-right-radius: 0; }
.m.first .b::before { content: ""; position: absolute; top: 0; width: 8px; height: 12px; background: inherit; }
.m.first.in .b::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.m.first.out .b::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.b .sender { font-size: 13.2px; font-weight: 600; margin-bottom: 2px; }
.b .text { white-space: pre-wrap; }
.b .text::after { content: ""; display: inline-block; width: 62px; height: 1px; }
.m.out .b .text::after { width: 78px; }
.b .foot { float: right; margin: -12px 0 -4px 6px; position: relative; top: 4px; display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-2); height: 16px; }
.m.out .b .foot { color: color-mix(in srgb, var(--text) 55%, transparent); }
.b .foot svg { width: 17px; height: 17px; color: var(--tick); }
.b .foot svg.read { color: var(--tick-read); }
.b .foot svg.wait { width: 13px; height: 13px; }
.b.gone .text { font-style: italic; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.b.gone .text svg { width: 16px; height: 16px; }
.b .failed { color: var(--danger); font-size: 12.5px; display: flex; align-items: center; gap: 4px; margin-top: 3px; clear: both; }
.b .failed svg { width: 15px; height: 15px; }
.b .quote { display: block; width: 100%; text-align: left; background: var(--in-quote); border-left: 4px solid var(--green); border-radius: 6px; padding: 5px 9px; margin-bottom: 4px; font-size: 13.5px; }
.m.out .b .quote { background: var(--out-quote); }
.b .quote b { display: block; font-size: 13px; }
.b .quote span { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.b.media { padding: 3px; }
.b.media .sender { padding: 3px 6px 1px; }
.b.media .text { padding: 4px 6px 2px; }
.b.media .foot.over { position: absolute; right: 8px; bottom: 7px; top: auto; margin: 0; float: none; color: #fff; background: rgba(0, 0, 0, .35); padding: 1px 6px; border-radius: 9px; height: 18px; }
.b.media .foot.over svg { color: #fff; }
.b.media .foot.over svg.read { color: var(--tick-read); }
.b.media .foot:not(.over) { margin-right: 5px; }
.pic { display: block; border-radius: 6px; overflow: hidden; background: var(--bg-2); max-width: 100%; }
.pic img { min-width: 150px; min-height: 90px; }
.pic img, .b video { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 6px; }
.b video { background: #000; object-fit: contain; }
.voice { display: flex; align-items: center; gap: 8px; width: min(270px, 62vw); padding: 2px 0 12px; }
.voice .pp { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.voice .pp svg { width: 30px; height: 30px; }
.voice .track { flex: 1; height: 28px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.voice .bar { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text-2) 35%, transparent); position: relative; }
.voice .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); border-radius: 2px; }
.voice .fill::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); }
.voice .dur { position: absolute; left: 58px; bottom: 5px; font-size: 11px; color: var(--text-2); }
.voice .note { font-size: 11px; }
.doc { display: flex; align-items: center; gap: 10px; background: var(--in-quote); border-radius: 6px; padding: 10px; text-decoration: none; color: inherit; min-width: 220px; margin-bottom: 3px; }
.m.out .doc { background: var(--out-quote); }
.doc .ic { width: 38px; height: 44px; border-radius: 5px; background: var(--green); color: #fff; display: grid; place-items: center; }
.doc .nm { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.doc .sz { font-size: 12px; color: var(--text-2); }
.cite { display: inline-flex; align-items: center; background: color-mix(in srgb, var(--ai) 16%, transparent); color: var(--ai); font-size: 12px; font-weight: 600; padding: 0 6px; border-radius: 8px; margin: 0 1px; vertical-align: 1px; line-height: 1.5; }
.cite.bad { background: none; color: var(--text-2); text-decoration: line-through; cursor: default; }
.receipt { clear: both; margin-top: 7px; padding-top: 6px; border-top: 1px solid color-mix(in srgb, var(--text-2) 25%, transparent); font-size: 11.5px; color: var(--text-2); line-height: 1.4; }
.menu-btn { position: absolute; top: 2px; right: 2px; width: 26px; height: 22px; border-radius: 6px; display: none; place-items: center; color: var(--text-2); background: inherit; }
.menu-btn svg { width: 18px; height: 18px; }
@media (hover: hover) { .b:hover .menu-btn { display: grid; } }
.to-bottom { position: absolute; right: 14px; bottom: 14px; width: 42px; height: 42px; border-radius: 50%; background: var(--panel); color: var(--text-2); box-shadow: 0 1px 4px rgba(0, 0, 0, .3); display: grid; place-items: center; z-index: 1; }
.to-bottom .badge { position: absolute; top: -7px; right: -3px; }

/* ---------- composer ---------- */
.replybar { display: flex; align-items: center; gap: 6px; padding: 7px 8px 0 10px; background: transparent; }
.replybar .quote { flex: 1; min-width: 0; background: var(--panel); border-left: 4px solid var(--green); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; }
.replybar .quote b { display: block; }
.replybar .quote span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.composer .box { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--panel); border-radius: 24px; min-height: 48px; padding: 0 4px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; padding: 13px 8px 12px 14px; max-height: 130px; line-height: 1.35; }
.composer .box .ib { width: 44px; height: 48px; }
.composer .go { width: 48px; height: 48px; border-radius: 50%; background: var(--green); color: var(--on-green); display: grid; place-items: center; flex: none; }
.composer .rec { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 24px; min-height: 48px; padding: 0 6px 0 16px; box-shadow: var(--shadow); }
.composer .rec .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.composer .rec .t { flex: 1; font-variant-numeric: tabular-nums; }
.composer .rec .hint { color: var(--text-2); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; scroll-behavior: auto !important; } }

/* ---------- popovers, sheets, viewer ---------- */
#layer:empty { display: none; }
.scrim { position: fixed; inset: 0; z-index: 20; }
.scrim.dim { background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; }
.pop { position: fixed; z-index: 21; background: var(--panel); border-radius: 12px; box-shadow: 0 4px 18px rgba(0, 0, 0, .28); padding: 6px 0; min-width: 190px; max-width: 86vw; }
.pop button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 11px 18px; font-size: 15.5px; }
.pop button:hover { background: var(--hover); }
.pop button svg { width: 21px; height: 21px; color: var(--text-2); }
.pop button.danger, .pop button.danger svg { color: var(--danger); }
.sheet { background: var(--panel); width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
@media (min-width: 800px) {
  .scrim.dim { align-items: center; }
  .sheet { width: 460px; height: auto; max-height: 88dvh; border-radius: 14px; overflow: hidden; }
}
.sheet-top { display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-bottom: 1px solid var(--line); min-height: 58px; }
.sheet-top h2 { margin: 0; font-size: 19px; font-weight: 500; flex: 1; }
.sheet-body { overflow-y: auto; flex: 1; padding-bottom: 20px; }
.sec { padding: 14px 18px 4px; font-size: 13.5px; color: var(--green-strong); font-weight: 600; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 18px 12px; text-align: center; }
.hero .av { width: 92px; height: 92px; font-size: 34px; }
.hero h3 { margin: 6px 0 0; font-size: 22px; font-weight: 500; }
.hero p { margin: 0; color: var(--text-2); }
.card { margin: 10px 14px; padding: 13px 14px; border-radius: 12px; background: var(--bg-2); font-size: 14.5px; line-height: 1.45; }
.card.ai { border-left: 4px solid var(--ai); }
.card b { display: block; margin-bottom: 3px; }
.card ul { margin: 6px 0 0; padding-left: 18px; }
.card .acts { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.item { display: flex; align-items: center; gap: 13px; padding: 9px 18px; width: 100%; text-align: left; min-height: 58px; }
button.item:hover { background: var(--hover); }
.item .grow { flex: 1; min-width: 0; }
.item .n { font-size: 16px; }
.item .d { font-size: 13px; color: var(--text-2); }
.item .ico { width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: var(--on-green); display: grid; place-items: center; flex: none; }
.item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); }
.form { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.code { font: 700 26px/1 ui-monospace, Consolas, monospace; letter-spacing: 3px; text-align: center; padding: 14px; background: var(--bg); border-radius: 10px; user-select: all; }
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .94); display: flex; flex-direction: column; color: #fff; }
.viewer .bar { display: flex; align-items: center; gap: 8px; padding: 8px; }
.viewer .bar .ib { color: #fff; }
.viewer .bar .ib:hover { background: rgba(255, 255, 255, .12); }
.viewer .bar div { flex: 1; min-width: 0; }
.viewer .bar small { display: block; opacity: .7; }
.viewer img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #323739; color: #fff; padding: 10px 18px; border-radius: 22px; font-size: 14.5px; z-index: 40; max-width: 88vw; text-align: center; }

/* ---------- motion and finish ---------- */
:root { --ease: cubic-bezier(.2, .8, .2, 1); }
.ib, .row, .chip, .btn, .item, .pop button, .composer .go, .fab { transition: background-color .15s, transform .12s var(--ease), opacity .15s; }
.btn:active, .composer .go:active, .fab:active, .chip:active { transform: scale(.96); }
.ib:active { background: var(--active); }
.row:active, button.item:active { background: var(--active); }
@keyframes pane-in { from { transform: translateX(28px); opacity: 0; } }
@keyframes sheet-in { from { transform: translateX(100%); } }
@keyframes modal-in { from { transform: translateY(12px) scale(.98); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { transform: scale(.92); opacity: 0; } }
@keyframes msg-in { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@keyframes toast-in { from { transform: translate(-50%, 12px); opacity: 0; } }
@media (max-width: 799px) {
  body.chat-open .pane { animation: pane-in .22s var(--ease); }
  .sheet { animation: sheet-in .26s var(--ease); }
}
@media (min-width: 800px) { .sheet { animation: modal-in .2s var(--ease); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); } }
.scrim.dim { animation: fade-in .18s; }
.pop { animation: pop-in .14s var(--ease); transform-origin: top right; }
.viewer { animation: fade-in .18s; }
.toast { animation: toast-in .2s var(--ease); }
.m.new .b { animation: msg-in .22s var(--ease); transform-origin: bottom left; }
.m.new.out .b { transform-origin: bottom right; }
.to-bottom { animation: pop-in .16s var(--ease); }
.badge { animation: pop-in .18s var(--ease); }
.side-top, .chat-top, .sheet-top { padding-top: max(6px, env(safe-area-inset-top)); }
.side-top { padding-top: max(10px, env(safe-area-inset-top)); }
.list, .msgs, .sheet-body, .results { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text-2) 45%, transparent) transparent; -webkit-overflow-scrolling: touch; }
.m, .row, .item { -webkit-touch-callout: none; }
.b .text { user-select: text; }
@media (hover: none) { .b { user-select: none; -webkit-user-select: none; } .b .text { user-select: none; -webkit-user-select: none; } }
::selection { background: color-mix(in srgb, var(--green) 35%, transparent); }

/* message options stay reachable by keyboard; failed messages get real buttons */
.menu-btn { display: grid; opacity: 0; }
.b:hover .menu-btn, .menu-btn:focus-visible { opacity: 1; }
@media (hover: none) { .menu-btn { pointer-events: none; } }
.b .failed { flex-wrap: wrap; row-gap: 2px; }
.b .failed button { color: inherit; font-weight: 600; text-decoration: underline; margin-left: 8px; padding: 4px 0; }

/* ---------- reactions, typing, attachments, loading ---------- */
.m.has-rx { margin-bottom: 16px; }
.b .rx { clear: both; display: flex; gap: 4px; margin: 4px 0 -20px; position: relative; flex-wrap: wrap; }
.b .rx button { display: inline-flex; align-items: center; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1px 7px; font-size: 15px; line-height: 1.5; box-shadow: var(--shadow); }
.b .rx button.on { border-color: var(--green); background: var(--chip-on); }
.b .rx button span { font-size: 12px; color: var(--text-2); }
.pop .rxbar { display: flex; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop .rxbar button { width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 24px; display: grid; place-items: center; }
.pop .rxbar button.on { background: var(--chip-on); }
.row .typing { color: var(--green-strong); }
.loading { height: 100%; display: grid; place-items: center; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--text-2) 30%, transparent); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: spin 2s linear infinite !important; } }
.sheet.attach { background: #0b141a; color: #e9edef; }
.sheet.attach .sheet-top { border-color: transparent; }
.sheet.attach .sheet-top .ib { color: #e9edef; }
.sheet.attach .sheet-body { display: flex; padding: 0; }
.attach-list { margin: auto; width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 10px 14px; }
.attach-list img, .attach-list video { max-width: 100%; max-height: 58dvh; border-radius: 8px; object-fit: contain; }
.attach-list .doc { background: #202c33; color: #e9edef; min-width: min(320px, 100%); }
.sheet.attach .composer { padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
@media (min-width: 800px) { .sheet.attach { width: 560px; } }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.linkbox { padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; word-break: break-all; user-select: all; }
.form .d { font-size: 13px; color: var(--text-2); }

/* moving between sheets does not replay the slide-in; captions keep their time inside the bubble */
.sheet.swap, .scrim.dim:has(.sheet.swap) { animation: none; }
.b.media .foot:not(.over) { top: 0; margin: -12px 5px 2px 6px; }
.b.media .text { padding-bottom: 4px; }

/* ---------- soft garden shapes ---------- */
@media (prefers-color-scheme: dark) {
  .n0 { color: #8fc79b; } .n1 { color: #9dbbe0; } .n2 { color: #e0b184; } .n3 { color: #dba9c2; }
  .n4 { color: #b6acdf; } .n6 { color: #8fc7c7; } .n7 { color: #d3c078; }
  .av:not(.c5) { filter: saturate(.85) brightness(.92); }
}
body { letter-spacing: .005em; }
.side { background: var(--bg); }
.side-top h1 { color: var(--green-strong); font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.side-top h1::before { content: ""; width: 26px; height: 26px; flex: none; background: url(/icon.svg) center / contain no-repeat; border-radius: 8px; }
.searchpill, .findbar input { background: var(--chip); border-radius: 16px; }
.chip { border-radius: 14px; }
.row { border-radius: 16px; margin: 1px 8px; width: calc(100% - 16px); padding: 0 10px; min-height: 70px; }
.badge { background: var(--green); }
.fab { border-radius: 22px; box-shadow: var(--lift); }
.nudge { border-radius: 18px; }
.chat-top, .findbar { background: color-mix(in srgb, var(--panel) 92%, transparent); border-bottom-color: var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.msgs { background-image: radial-gradient(120% 80% at 50% 0%, var(--wall-2), transparent 70%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240' fill='none' stroke='%234f7f5b' stroke-opacity='.11' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M28 52c0-16 10-26 30-27 0 19-9 30-23 30-3 0-5-1-7-3zM30 56c6-10 13-17 22-22'/%3E%3Cpath d='M168 40c8-12 22-12 30 0-8 12-22 12-30 0zM183 33v14'/%3E%3Cpath d='M104 96c0-9 7-16 16-16 0 9-7 16-16 16zM104 96c0-9-7-16-16-16 0 9 7 16 16 16zM104 96v20'/%3E%3Cpath d='M190 132c0-16 10-26 30-27 0 19-9 30-23 30-3 0-5-1-7-3zM192 136c6-10 13-17 22-22'/%3E%3Cpath d='M40 150c6-4 14-4 20 0M50 146v-12M44 138l6-6 6 6'/%3E%3Ccircle cx='132' cy='170' r='5'/%3E%3Cpath d='M132 158v-5M132 187v-5M120 170h-5M149 170h-5M123.5 161.5l-3.5-3.5M144 182l-3.5-3.5M123.5 178.5L120 182M144 158l-3.5 3.5'/%3E%3Cpath d='M70 214c0-9 7-16 16-16 0 9-7 16-16 16zM70 214c0-9-7-16-16-16 0 9 7 16 16 16z'/%3E%3Cpath d='M196 206c5-8 14-8 19 0-5 8-14 8-19 0z'/%3E%3C/svg%3E"); background-size: auto, 320px; }
@media (prefers-color-scheme: dark) { .msgs { background-image: radial-gradient(120% 80% at 50% 0%, var(--wall-2), transparent 70%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240' fill='none' stroke='%2384b98e' stroke-opacity='.07' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M28 52c0-16 10-26 30-27 0 19-9 30-23 30-3 0-5-1-7-3zM30 56c6-10 13-17 22-22'/%3E%3Cpath d='M168 40c8-12 22-12 30 0-8 12-22 12-30 0zM183 33v14'/%3E%3Cpath d='M104 96c0-9 7-16 16-16 0 9-7 16-16 16zM104 96c0-9-7-16-16-16 0 9 7 16 16 16zM104 96v20'/%3E%3Cpath d='M190 132c0-16 10-26 30-27 0 19-9 30-23 30-3 0-5-1-7-3zM192 136c6-10 13-17 22-22'/%3E%3Cpath d='M70 214c0-9 7-16 16-16 0 9-7 16-16 16zM70 214c0-9-7-16-16-16 0 9 7 16 16 16z'/%3E%3C/svg%3E"); background-size: auto, 320px; } }
.day span, .sys span, .unread-mark span { border-radius: 12px; background: color-mix(in srgb, var(--pill) 88%, transparent); }
.b { border-radius: var(--r-bubble); padding: 7px 10px 8px 12px; }
.m.first.in .b { border-top-left-radius: 6px; }
.m.first.out .b { border-top-right-radius: 6px; }
.m.first .b::before { display: none; }
.b.media { padding: 4px; }
.pic, .pic img, .b video { border-radius: 14px; }
.b .quote, .replybar .quote, .doc { border-radius: 12px; }
.b .quote, .replybar .quote { border-left-color: var(--green); }
.composer .box, .composer .rec { border-radius: 26px; box-shadow: var(--shadow); }
.composer .go { box-shadow: var(--shadow); }
.to-bottom { box-shadow: var(--lift); }
.pop { border-radius: 18px; box-shadow: var(--lift); padding: 8px 0; }
.sheet { background: var(--bg); }
.card { border-radius: var(--r-card); background: var(--panel); border: 1px solid var(--line); }
.card.ai { border-left: 4px solid var(--ai); }
.field input { border-radius: 14px; background: var(--panel); }
.btn { border-radius: 26px; }
.item .ico { background: var(--chip-on); color: var(--chip-on-text); }
.code, .linkbox { border-radius: 14px; }
.toast { background: #2f3a32; border-radius: 18px; box-shadow: var(--lift); }
.banner { background: #f4e9c4; color: #5d4c12; border-radius: 14px; margin: 0 12px 8px; }
@media (prefers-color-scheme: dark) { .banner { background: #3b3520; color: #ecd98f; } }
a { color: #3f7fa6; }
@media (prefers-color-scheme: dark) { a { color: #8cc3e6; } }
.auth { position: relative; }
body:has(.auth), .pane:has(.pane-empty) { background: radial-gradient(90% 60% at 50% 0%, var(--chip-on), transparent 70%), var(--bg); }
.auth img, .pane-empty img { border-radius: 24px; box-shadow: var(--lift); }
.pane-empty h2 { color: var(--green-strong); font-weight: 600; }
@media (min-width: 800px) {
  .side { border-right-color: var(--line); }
  .sheet { border-radius: 22px; }
}
.b .rx button { border-radius: 14px; }
.voice .fill, .voice .fill::after { background: var(--green); }
.doc .ic { background: var(--green); border-radius: 10px; }

/* ---------- calls ---------- */
.call { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: space-between; color: #f3f6ee;
  background: radial-gradient(90% 60% at 50% 12%, #5c8f69, transparent 70%), linear-gradient(#2f4a37, #1b2a20); padding: max(48px, env(safe-area-inset-top)) 20px calc(34px + env(safe-area-inset-bottom)); animation: fade-in .2s; }
.call .who { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; z-index: 1; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.call .who .av { width: 112px; height: 112px; font-size: 40px; box-shadow: 0 0 0 10px rgba(255, 255, 255, .08), 0 0 0 22px rgba(255, 255, 255, .05); margin-bottom: 14px; }
.call .name { font-size: 26px; font-weight: 600; }
.call .status { font-size: 16px; opacity: .9; font-variant-numeric: tabular-nums; }
.call .remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.call.with-video .remote { opacity: 1; }
.call.with-video .who .av { display: none; }
.call.with-video { justify-content: space-between; }
.call .local { position: absolute; right: 16px; bottom: calc(128px + env(safe-area-inset-bottom)); width: 104px; height: 150px; object-fit: cover; border-radius: 18px; box-shadow: var(--lift); transform: scaleX(-1); background: #1b2a20; z-index: 1; }
.call .controls { display: flex; gap: 22px; z-index: 1; padding: 12px 22px; border-radius: 40px; background: rgba(20, 30, 23, .45); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.cbtn { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; transition: transform .12s, background-color .15s; }
.cbtn:active { transform: scale(.94); }
.cbtn svg { width: 28px; height: 28px; }
.cbtn.off { background: #f3f6ee; color: #23352a; }
.cbtn.red { background: #cf5a45; }
.cbtn.green { background: #5fae72; }
.cbtn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* the phone keyboard never covers the bottom of a sheet */
@media (max-width: 799px) { .sheet { height: var(--vvh, 100dvh); } .scrim.dim { align-items: flex-start; } }
.b .text, .composer textarea { unicode-bidi: plaintext; text-align: start; }

/* ---------- group calls ---------- */
.call.group { justify-content: flex-start; gap: 14px; padding-top: max(22px, env(safe-area-inset-top)); }
.call.group .who .name { font-size: 20px; }
.call.group .tiles { flex: 1; min-height: 0; width: 100%; max-width: 1100px; display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; z-index: 1; }
.call.group .tiles[data-count="1"] { grid-template-columns: 1fr; }
.call.group .tiles[data-count="2"] { grid-template-columns: 1fr; }
@media (min-width: 800px) { .call.group .tiles { grid-template-columns: repeat(3, 1fr); } .call.group .tiles[data-count="2"], .call.group .tiles[data-count="4"] { grid-template-columns: repeat(2, 1fr); } }
.tile { position: relative; border-radius: 20px; overflow: hidden; background: rgba(255, 255, 255, .08); display: grid; place-items: center; min-height: 0; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.tile.has-video video { opacity: 1; }
.tile.me video { transform: scaleX(-1); }
.tile .av { width: 84px; height: 84px; font-size: 30px; }
.tile.has-video .av { display: none; }
.tile .label { position: absolute; left: 10px; bottom: 8px; padding: 2px 10px; border-radius: 12px; background: rgba(20, 30, 23, .55); font-size: 13px; }
.tile.connecting { opacity: .6; }
.tile.connecting::after { content: "Connecting…"; position: absolute; top: 10px; left: 0; right: 0; text-align: center; font-size: 13px; }
.ib.live { color: var(--on-green); background: var(--green); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--green) 25%, transparent); } }
.row .prev svg + .typing { margin-left: 2px; }

/* the hidden attribute must win over any display rule */
[hidden] { display: none !important; }

/* photos as avatars */
.av.pic-av { background: var(--chip); overflow: hidden; }
.av.pic-av img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.hero .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* message formatting */
.b .text strong { font-weight: 650; }
.b .text code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; background: color-mix(in srgb, var(--text) 9%, transparent); padding: 1px 5px; border-radius: 6px; }
.b .text code.block { display: block; white-space: pre-wrap; padding: 7px 9px; margin: 3px 0; border-radius: 10px; }
.b .text .q { display: block; border-left: 3px solid var(--green); padding-left: 9px; color: var(--text-2); }

/* room for a 12-hour time beside the last line */
.h12 .b .text::after { width: 88px; }
.h12 .m.out .b .text::after { width: 106px; }

/* a message marked as a decision */
.b .decision { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; color: var(--chip-on-text); background: var(--chip-on); border-radius: 10px; padding: 1px 9px 1px 5px; margin-bottom: 4px; }
.b .decision svg { width: 14px; height: 14px; }
.m.out .b .decision { background: color-mix(in srgb, var(--panel) 55%, transparent); }

/* must-read notices and waiting messages */
.b.notice { border: 1.5px solid #d9a441; background: #fff7e2; max-width: min(86%, 560px); }
.m.out .b.notice { background: #fbf0cf; }
@media (prefers-color-scheme: dark) { .b.notice, .m.out .b.notice { background: #33301f; border-color: #a5852f; } }
.b .must { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: #8a5a00; margin-bottom: 4px; }
@media (prefers-color-scheme: dark) { .b .must { color: #e8c56b; } }
.b .must svg { width: 15px; height: 15px; }
.notice-foot { clear: both; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 7px; border-top: 1px solid color-mix(in srgb, #d9a441 45%, transparent); }
.notice-foot .who-read { font-size: 13px; color: var(--text-2); text-decoration: underline; padding: 4px 0; }
.noticebar { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 14px; background: #fbf0cf; color: #5d4300; font-size: 14px; border-bottom: 1px solid #e6cf8e; }
@media (prefers-color-scheme: dark) { .noticebar { background: #33301f; color: #ecd98f; border-color: #57491f; } }
.noticebar svg { width: 19px; height: 19px; }
.noticebar span { flex: 1; }
.badge.must-badge { background: #d9a441; color: #3b2a00; }
.b .waiting { clear: both; display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.b .waiting svg { width: 14px; height: 14px; }
.field textarea { padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); font: inherit; font-size: 16px; color: var(--text); outline: none; resize: vertical; width: 100%; }
.form textarea:focus { border-color: var(--green); }

.b.media .waiting, .b.media .failed { padding: 4px 6px 2px; }

/* ---------- shared location ---------- */
.doc.loc { align-items: flex-start; }
.doc.loc a { display: inline-block; margin-top: 4px; font-size: 13.5px; font-weight: 600; color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.doc.loc .nm, .doc.loc .sz { display: block; }
.card .place .doc { margin: 0 0 8px; background: var(--bg); min-width: 0; }
.card .hint { font-size: 13px; color: var(--text-2); }

/* a right-to-left message: the time takes its own line instead of sitting over the first words */
.b .text:dir(rtl) ~ .foot { margin-top: 0; top: 0; }

/* an edited message says so next to its time */
.foot .edited { font-style: italic; opacity: .85; }
.form textarea { width: 100%; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line, #ccd); background: transparent; color: inherit; resize: vertical; }

/* what was said in a voice message, written out; and the link from a message to its ClickUp task */
.b .heard { margin: 4px 2px 2px; font-size: 14px; line-height: 1.4; color: var(--text-2); font-style: italic; max-width: 300px; overflow-wrap: anywhere; }
.b .tasklink { display: inline-flex; align-items: center; gap: 5px; margin: 5px 2px 0; padding: 3px 10px 3px 7px; border-radius: 12px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: inherit; text-decoration: none; }
.b .tasklink svg { width: 15px; height: 15px; }
a.taskrow { color: inherit; text-decoration: none; }
.b:has(.heard) .voice { position: relative; }
.b:has(.heard) .voice .dur { bottom: -3px; }
.b .heard { margin: 6px 2px 0; padding-bottom: 14px; }

/* pull the chat list down to refresh */
.list-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; overflow: hidden; }
.list { overscroll-behavior-y: contain; transition: transform .28s cubic-bezier(.2, .8, .2, 1); will-change: transform; }
.ptr { position: absolute; left: 50%; top: 0; z-index: 3; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; pointer-events: none;
  background: var(--panel); color: var(--text-2); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(30, 45, 35, .16);
  opacity: 0; transform: translate(-50%, -46px) scale(.6); transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s, color .15s, background .15s; }
.ptr svg { width: 22px; height: 22px; }
.ptr.ready, .ptr.busy { color: #fff; background: var(--green); border-color: transparent; }
.ptr.busy svg { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .list, .ptr { transition: none; } .ptr.busy svg { animation-duration: 1.6s; } }

/* "Who are you?": choosing your profile from the team link */
.who-list { display: flex; flex-direction: column; gap: 8px; max-height: min(46vh, 420px); overflow-y: auto; padding: 2px; margin: 0 -2px; }
.who-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--line); font: inherit; font-size: 17px; color: var(--text); text-align: left; transition: border-color .15s, background .15s, transform .1s; }
.who-row:active { transform: scale(.985); }
.who-row[aria-pressed="true"] { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--panel)); font-weight: 600; }
.who-row svg { width: 18px; height: 18px; color: var(--text-2); }
.card .linkbox { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 13.5px; overflow-wrap: anywhere; user-select: all; }
.who-row .grow { flex: 1; min-width: 0; }

/* ---- the one-to-one call: labelled controls, a small picture to drag or swap, minimise ---- */
.call video.stage { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; opacity: 1; pointer-events: none; transform: none; box-shadow: none; right: auto; bottom: auto; z-index: 0; }
.call video.pip { position: absolute; inset: auto; width: 108px; height: 156px; object-fit: cover; border-radius: 18px; opacity: 1; background: #1c2a20; box-shadow: 0 10px 28px rgba(0, 0, 0, .4), 0 0 0 1.5px rgba(255, 255, 255, .22); z-index: 3; pointer-events: auto; touch-action: none; cursor: grab; transform: none; transition: top .25s, left .25s, right .25s, bottom .25s; }
.call video.mirror { transform: scaleX(-1); }
.call[data-pip="tr"] video.pip { top: calc(78px + env(safe-area-inset-top)); right: 16px; }
.call[data-pip="tl"] video.pip { top: calc(78px + env(safe-area-inset-top)); left: 16px; }
.call[data-pip="br"] video.pip { bottom: calc(236px + env(safe-area-inset-bottom)); right: 16px; }
.call[data-pip="bl"] video.pip { bottom: calc(236px + env(safe-area-inset-bottom)); left: 16px; }
.call video[hidden] { display: none !important; }
.call .ctop { position: absolute; left: 14px; top: calc(14px + env(safe-area-inset-top)); z-index: 4; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(20, 30, 23, .42); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.call .ctop svg { width: 22px; height: 22px; }
.call .controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; width: min(340px, calc(100% - 28px)); padding: 18px 14px 14px; border-radius: 30px; background: rgba(18, 27, 21, .62); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); z-index: 2; margin-bottom: max(6px, env(safe-area-inset-bottom)); }
.call.ringing .controls { grid-template-columns: repeat(2, 1fr); width: min(280px, calc(100% - 28px)); }
.cctl { display: flex; flex-direction: column; align-items: center; gap: 7px; color: #f3f6ee; font-size: 13px; }
.cctl .dot { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .15); transition: transform .12s, background-color .15s; }
.cctl .dot svg { width: 26px; height: 26px; }
.cctl:active .dot { transform: scale(.93); }
.cctl.off .dot { background: #f3f6ee; color: #23352a; }
.cctl.red .dot { background: #cf5a45; }
.cctl.green .dot { background: #5fae72; }
.cctl:focus-visible .dot { outline: 3px solid #fff; outline-offset: 3px; }
.call.ringing .who .av { animation: ring-pulse 1.8s ease-out infinite; }
@keyframes ring-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .28), 0 0 0 0 rgba(255, 255, 255, .16); } 100% { box-shadow: 0 0 0 22px rgba(255, 255, 255, 0), 0 0 0 44px rgba(255, 255, 255, 0); } }
@media (prefers-reduced-motion: reduce) { .call.ringing .who .av { animation: none; } }
/* minimised: a bar at the top, so the chat underneath can be used during the call */
.call.mini { inset: 0 0 auto 0; height: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.call.mini video, .call.mini .who .av { display: none !important; }
.call.mini .who { flex-direction: row; align-items: baseline; gap: 10px; text-align: left; min-width: 0; }
.call.mini .name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call.mini .status { font-size: 14px; white-space: nowrap; }
.call.mini .controls { display: block; width: auto; padding: 0; margin: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.call.mini .cctl .lbl { display: none; }
.call.mini .cctl .dot { width: 42px; height: 42px; }
.call.mini .cctl .dot svg { width: 20px; height: 20px; }
.call .controls .cctl.red:last-child { grid-column: 2; }
.call.ringing .controls .cctl.red, .call.mini .controls .cctl.red { grid-column: auto; }
/* while a call is minimised, the app moves down so its own top bar is not covered */
body:has(.call.mini) .side, body:has(.call.mini) .pane { padding-top: calc(58px + env(safe-area-inset-top)); }

/* ---- the attach panel ---- */
.agrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 6px; padding: 18px 12px 22px; }
.atile { display: flex; flex-direction: column; align-items: center; gap: 8px; font: inherit; font-size: 13.5px; color: var(--text); }
.atile .dot { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); box-shadow: 0 6px 14px rgba(30, 45, 35, .14); transition: transform .12s; }
.atile:active .dot { transform: scale(.93); }
.atile .dot svg { width: 27px; height: 27px; }
.atile.t1 .dot { background: #4f7f5b; } .atile.t2 .dot { background: #3f6f8f; } .atile.t3 .dot { background: #6a62a8; } .atile.t4 .dot { background: #2f8f7a; }
.atile.t5 .dot { background: #8a6a4a; } .atile.t6 .dot { background: #c08a2e; } .atile.t7 .dot { background: #b85c4a; }
.popt .ptext small { display: block; font-size: 12px; font-weight: 400; color: var(--text-2); }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optlist { display: flex; flex-direction: column; gap: 8px; }
/* ---- a poll ---- */
.poll { min-width: min(280px, 68vw); display: flex; flex-direction: column; gap: 7px; padding: 2px 0 4px; }
.poll .ptitle { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 3px; font-size: 16px; }
.poll .ptitle svg { width: 19px; height: 19px; flex: none; margin-top: 2px; color: var(--green-strong); }
.popt { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: color-mix(in srgb, var(--panel) 70%, transparent); font: inherit; color: inherit; text-align: left; overflow: hidden; }
.popt .bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--green) 20%, transparent); transition: width .3s; }
.popt .ptext { position: relative; flex: 1; overflow-wrap: anywhere; }
.popt .pn { position: relative; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); }
.popt.on { border-color: var(--green); font-weight: 600; }
.popt.on .bar { background: color-mix(in srgb, var(--green) 34%, transparent); }
.poll .pfoot { font-size: 12.5px; color: var(--text-2); }
/* ---- an event ---- */
.event { min-width: min(290px, 68vw); display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; padding: 2px 0 4px; }
.event .edate { width: 54px; height: 58px; border-radius: 14px; background: var(--green); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.event .edate span { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .9; }
.event .edate b { font-size: 24px; }
.event .ebody b { display: block; font-size: 16px; overflow-wrap: anywhere; }
.event .ewhen, .event .ewho { font-size: 13.5px; color: var(--text-2); }
.event .echoices { grid-column: 1 / -1; display: flex; gap: 6px; }
.echo { flex: 1; padding: 8px 6px; border-radius: 999px; border: 1.5px solid var(--line); background: color-mix(in srgb, var(--panel) 70%, transparent); font: inherit; font-size: 14px; color: inherit; display: flex; align-items: center; justify-content: center; gap: 6px; }
.echo span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.echo.on { border-color: var(--green); background: color-mix(in srgb, var(--green) 20%, var(--panel)); font-weight: 600; }
/* ---- a shared contact ---- */
.contactcard b { display: block; overflow-wrap: anywhere; }
.contactcard a { color: var(--green-strong); font-size: 14.5px; }
/* ---- a call in the chat ---- */
.callrow { display: flex; padding: 3px 10px; }
.callrow.out { justify-content: flex-end; }
.callcard { display: flex; align-items: center; gap: 12px; min-width: 232px; padding: 9px 14px 9px 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); font: inherit; color: var(--text); text-align: left; box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.callrow.out .callcard { background: var(--bubble-out, color-mix(in srgb, var(--green) 16%, var(--panel))); }
.callcard .ico { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--green) 16%, var(--panel)); color: var(--green-strong); flex: none; }
.callcard .ico svg { width: 21px; height: 21px; }
.callcard .grow { display: flex; flex-direction: column; flex: 1; }
.callcard .grow span { font-size: 13.5px; color: var(--text-2); }
.callcard .ctime { font-size: 11px; color: var(--text-2); align-self: flex-end; }
.callcard.missed .ico { background: color-mix(in srgb, #cf5a45 16%, var(--panel)); color: #b94a37; }
.callcard.missed .grow span { color: #b94a37; }
/* group calls use the same named controls */
.call.group .controls { grid-template-columns: repeat(3, 1fr); }
.call.group .controls .cctl.red:last-child { grid-column: auto; }

/* ---- tagging people with @ ---- */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.composer { position: relative; }
.tag-list { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 6; max-height: 264px; overflow-y: auto; padding: 6px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(30, 45, 35, .18); }
.tag-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 12px; font: inherit; font-size: 16px; color: var(--text); text-align: left; }
.tag-opt.on, .tag-opt:active { background: color-mix(in srgb, var(--green) 14%, var(--panel)); }
.tag-opt .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-opt small { color: var(--text-2); font-size: 12.5px; }
.b .mention { color: var(--green-strong); font-weight: 600; }
.b .mention.me { background: color-mix(in srgb, var(--green) 24%, transparent); border-radius: 6px; padding: 0 4px; margin: 0 -1px; }
.b.tagged { box-shadow: inset 3px 0 0 var(--green), 0 1px 1px rgba(0, 0, 0, .05); }
.badge.at-badge { background: var(--panel); color: var(--green-strong); border: 1.5px solid var(--green); font-weight: 700; }
