/* Jisste. Phone first: one column with a tab bar; from 900px wide, a list beside the open chat (like chat apps on a computer). */
:root {
  --bg: #f7f2ec; --panel: #fffdfa; --ink: #1d1714; --muted: #6e625a; --line: #e9e0d5; --hover: #f3ebe2;
  --brand: #bf4d2b; --brand-ink: #ffffff; --brand-soft: #f7e2d9; --accent: #d89a00;
  --mine: #f5dccf; --theirs: #fffdfa; --wall: #eee6dc; --wall-dot: #e0d5c8; --tick: #bf4d2b; --agent: #0e7c86; --agent-soft: #dff3f4;
  --danger: #c4302b; --shadow: 0 1px 1px rgba(29, 23, 20, .08); --desk: #ebe3d8;
  --r: 14px; --tab-h: 62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #14100d; --panel: #1d1814; --ink: #f2ebe4; --muted: #a89a8f; --line: #30271f; --hover: #27201a;
  --brand: #ec7a54; --brand-ink: #1a0b05; --brand-soft: #3a2218; --accent: #f0bb3a;
  --mine: #58301f; --theirs: #27201a; --wall: #100c0a; --wall-dot: #1c1612; --tick: #f39b7b; --agent: #45c4cc; --agent-soft: #12343a; --danger: #ff6b66; --desk: #0b0907; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #14100d; --panel: #1d1814; --ink: #f2ebe4; --muted: #a89a8f; --line: #30271f; --hover: #27201a;
  --brand: #ec7a54; --brand-ink: #1a0b05; --brand-soft: #3a2218; --accent: #f0bb3a;
  --mine: #58301f; --theirs: #27201a; --wall: #100c0a; --wall-dot: #1c1612; --tick: #f39b7b; --agent: #45c4cc; --agent-soft: #12343a; --danger: #ff6b66; --desk: #0b0907; color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
a { color: var(--brand); }
[hidden] { display: none !important; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { height: 100%; display: flex; flex-direction: column; max-width: 100vw; overflow: hidden; }
.boot { margin: auto; display: grid; justify-items: center; gap: 10px; color: var(--muted); }
.mark { width: 64px; height: 64px; border-radius: 20px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font: 800 34px/1 var(--font); letter-spacing: -.04em; }

/* ---------- shell ---------- */
.shell { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.rail { display: none; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.main { display: none; min-height: 0; }
.shell.in-chat .side { display: none; }
.shell.in-chat .main { display: flex; }
@media (min-width: 900px) {
  .shell { grid-template-columns: 68px minmax(320px, 400px) minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: calc(14px + env(safe-area-inset-top, 0px)) 0 14px; background: var(--bg); border-right: 1px solid var(--line); }
  .rail .tab { width: 48px; height: 48px; border-radius: 14px; flex-direction: row; }
  .rail .tab span { display: none; }
  .rail .tab[aria-current="page"] { background: var(--brand-soft); }
  .rail .grow { flex: 1; }
  .side { border-right: 1px solid var(--line); }
  .shell.in-chat .side { display: flex; }
  .main { display: flex; }
  #chathead [data-act="close-chat"] { display: none; }
  #chathead { padding-left: 16px; }
  .tabbar { display: none !important; }
}

/* computers: the app sits in a fixed-width box in the middle of the screen, not stretched edge to edge */
@media (min-width: 1200px) {
  html { background: var(--desk); }
  body { background: var(--desk); padding: 20px; box-sizing: border-box; }
  .app { max-width: 1240px; margin: 0 auto; height: 100%; border-radius: 18px; border: 1px solid var(--line); background: var(--panel);
    box-shadow: 0 1px 2px rgba(29, 23, 20, .06), 0 18px 50px rgba(29, 23, 20, .12); }
}
@media (min-width: 1200px) and (min-height: 1000px) { body { padding: 36px 20px; } }

.top { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px)); min-height: 58px; background: var(--panel); }
.top h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; flex: 1; min-width: 0; }
.top h1.brand { color: var(--brand); font-size: 26px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); flex: none; }
.iconbtn:hover { background: var(--hover); }
.search { margin: 0 max(14px, env(safe-area-inset-right, 0px)) 8px max(14px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 22px; padding: 8px 14px; color: var(--muted); }
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; color: var(--ink); }
.scroll { flex: 1; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pad { padding: 4px max(14px, env(safe-area-inset-right, 0px)) 24px max(14px, env(safe-area-inset-left, 0px)); }

.tabbar { display: flex; border-top: 1px solid var(--line); background: var(--panel); padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; color: var(--muted); font-size: 12px; font-weight: 600; position: relative; border-radius: 12px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] svg.i { color: var(--brand); stroke-width: 2.2; }
.tab .dot { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-size: 11px; display: grid; place-items: center; }

.chips { display: flex; gap: 8px; padding: 0 max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px)); overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; padding: 6px 14px; border-radius: 18px; background: var(--bg); color: var(--muted); font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }

.fab { position: absolute; right: max(18px, env(safe-area-inset-right, 0px)); bottom: 18px; width: 56px; height: 56px; border-radius: 18px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent); }
.sidebody { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- avatars ---------- */
.av { width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 18px; letter-spacing: -.02em; position: relative; }
.av.sm { width: 40px; height: 40px; font-size: 15px; }
.av.xs { width: 34px; height: 34px; font-size: 13px; }
.av.lg { width: 96px; height: 96px; font-size: 36px; }
.av.agent { border-radius: 30%; }
.av.agent::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%; background: var(--agent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 8.2l2 2 4-4.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; border: 2px solid var(--panel); }
.av.sm.agent::after, .av.xs.agent::after { width: 13px; height: 13px; background-size: 9px; }
.av.group { background: var(--muted) !important; }

/* ---------- lists ---------- */
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px max(14px, env(safe-area-inset-right, 0px)) 9px max(14px, env(safe-area-inset-left, 0px)); min-height: 72px; }
.row:hover, .row[aria-current="true"] { background: var(--hover); }
.row .mid { flex: 1; min-width: 0; display: grid; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: -10px; align-self: stretch; align-content: center; }
.row:last-child .mid { border-bottom: 0; }
.row .l1, .row .l2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row .name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.row .time { font-size: 12px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.row .time.new { color: var(--brand); font-weight: 600; }
.row .prev { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; font-size: 14px; }
.row .prev.typing { color: var(--brand); font-weight: 600; }
.row .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 1px 6px; border-radius: 6px; background: var(--agent-soft); color: var(--agent); flex: none; text-transform: uppercase; }
.tag.soon { background: var(--bg); color: var(--muted); }
.ticks { flex: none; color: var(--muted); display: inline-flex; }
.ticks.read { color: var(--tick); }
.ticks svg { width: 17px; height: 17px; }
.section { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 16px max(14px, env(safe-area-inset-right, 0px)) 6px max(14px, env(safe-area-inset-left, 0px)); }
.empty { text-align: center; color: var(--muted); padding: 48px 28px; display: grid; gap: 10px; justify-items: center; }
.empty h2 { color: var(--ink); font-size: 18px; margin: 0; }
.empty .big { width: 72px; height: 72px; border-radius: 24px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.empty .big svg.i { width: 36px; height: 36px; }

/* ---------- chat ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wall); }
.chat .top { gap: 6px; box-shadow: var(--shadow); z-index: 2; }
.chat .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; }
.chat .who .t { min-width: 0; }
.chat .who b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .who small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .who small.typing { color: var(--brand); font-weight: 600; }
.wall { flex: 1; overflow-y: auto; min-height: 0; padding: 10px max(10px, env(safe-area-inset-right, 0px)) 12px max(10px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 3px;
  background-image: radial-gradient(var(--wall-dot) 1.2px, transparent 1.3px); background-size: 22px 22px; overscroll-behavior: contain; }
.day { align-self: center; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 8px; margin: 10px 0 6px; box-shadow: var(--shadow); }
.notice { align-self: center; background: var(--panel); color: var(--muted); font-size: 12.5px; padding: 4px 12px; border-radius: 8px; margin: 4px 0; max-width: 90%; text-align: center; box-shadow: var(--shadow); }
.safe { align-self: center; background: var(--brand-soft); color: var(--ink); font-size: 12.5px; padding: 8px 12px; border-radius: 10px; margin: 4px 0 10px; max-width: 420px; text-align: center; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 560px); align-self: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg + .msg.first, .msg.first { margin-top: 6px; }
.bubble { background: var(--theirs); border-radius: 4px var(--r) var(--r) var(--r); padding: 6px 9px 6px 10px; box-shadow: var(--shadow); position: relative; min-width: 72px; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--mine); border-radius: var(--r) 4px var(--r) var(--r); }
.msg:not(.first) .bubble { border-radius: var(--r); }
.bubble .from { font-size: 13px; font-weight: 700; margin-bottom: 1px; display: flex; gap: 6px; align-items: center; }
.bubble .txt { white-space: pre-wrap; }
.bubble .meta { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); margin: 6px 0 -3px 10px; font-variant-numeric: tabular-nums; }
.bubble img.photo { display: block; max-width: 100%; width: 280px; max-height: 340px; object-fit: cover; border-radius: 10px; margin: 0 -4px 4px; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 2px 0; }
.voice button { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.voice .bar { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.voice .bar i { display: block; height: 100%; width: 0; background: var(--brand); }
.voice small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* agent cards: what agents send instead of long text */
.card { margin-top: 6px; display: grid; gap: 6px; }
.card .ct { font-weight: 700; }
.card .cl { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 3px; }
.card dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.card dt { overflow: hidden; text-overflow: ellipsis; }
.card dd { margin: 0; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.btns { display: grid; gap: 3px; margin-top: 3px; width: 100%; }
.btns.two { grid-template-columns: 1fr 1fr; }
.btns button, .btns a { background: var(--theirs); color: var(--brand); font-weight: 600; text-align: center; padding: 10px 8px; border-radius: 10px; box-shadow: var(--shadow); text-decoration: none; font-size: 14.5px; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; }
.btns button:hover, .btns a:hover { background: var(--hover); }
.btns button:disabled { opacity: .5; }

.composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.composer .box { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--panel); border-radius: 24px; padding: 4px 4px 4px 2px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: none; background: none; resize: none; max-height: 140px; padding: 8px 0; line-height: 1.35; }
.composer .iconbtn { width: 40px; height: 40px; color: var(--muted); }
.send { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.rec { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 24px; padding: 6px 8px 6px 16px; min-height: 48px; box-shadow: var(--shadow); }
.rec .dotr { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.rec b { flex: 1; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: .3; } }
.placeholder { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); background: var(--bg); padding: 24px; }
.placeholder .mark { margin: 0 auto 14px; }
.placeholder h2 { color: var(--ink); margin: 0 0 6px; }

/* ---------- feed ---------- */
.post { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 6px; margin-bottom: 10px; text-decoration: none; color: inherit; }
.post .ph { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.post .ph b { color: var(--ink); }
.post h3 { margin: 0; font-size: 16.5px; line-height: 1.3; }
.post p { margin: 0; color: var(--muted); font-size: 14.5px; }
.post .pf { display: flex; gap: 14px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.note { background: var(--brand-soft); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }

/* ---------- forms, sheets, settings ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field textarea { width: 100%; border: 1.5px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 14px; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 24px; background: var(--brand); color: var(--brand-ink); font-weight: 700; width: 100%; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.plain { background: none; color: var(--brand); }
.btn.danger { background: none; color: var(--danger); }
.btn:disabled { opacity: .55; }
.err { color: var(--danger); font-size: 14px; margin: -6px 0 12px; }
.set { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); min-height: 60px; }
.set:hover { background: var(--hover); }
.set .mid { flex: 1; min-width: 0; }
.set .mid small { display: block; color: var(--muted); font-size: 13px; }
.set svg.i { color: var(--muted); }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--brand); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.seg { display: inline-flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.me { display: grid; justify-items: center; gap: 6px; padding: 20px 16px 10px; text-align: center; }
.me h2 { margin: 6px 0 0; font-size: 22px; }
.me p { margin: 0; color: var(--muted); }
.keybox { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--bg); border-radius: 10px; padding: 10px; overflow-wrap: anywhere; user-select: all; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 max(14px, env(safe-area-inset-right, 0px)) 8px max(14px, env(safe-area-inset-left, 0px)); }
.picked button { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand); border-radius: 16px; padding: 4px 10px 4px 4px; font-weight: 600; font-size: 13px; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.check.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- welcome ---------- */
.welcome { flex: 1; overflow-y: auto; display: flex; flex-direction: column; background: var(--panel); }
.welcome .inner { width: 100%; max-width: 420px; margin: auto; padding: calc(28px + env(safe-area-inset-top, 0px)) max(22px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(22px, env(safe-area-inset-left, 0px)); display: grid; gap: 14px; }
.welcome h1 { font-size: 34px; letter-spacing: -.03em; margin: 8px 0 0; line-height: 1.1; }
.welcome .lead { color: var(--muted); font-size: 16.5px; margin: 0; }
.welcome .points { display: grid; gap: 10px; margin: 6px 0 10px; }
.welcome .points div { display: flex; gap: 12px; align-items: center; }
.welcome .points svg.i { color: var(--brand); }
.welcome .fine { color: var(--muted); font-size: 12.5px; text-align: center; margin: 0; }
.demo-bar { background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; text-align: center; padding: calc(4px + env(safe-area-inset-top, 0px)) 12px 4px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.demo-bar button { text-decoration: underline; font-weight: 700; color: #fff; }
.demo-bar + .shell .top, .demo-bar + .welcome .inner { padding-top: 10px; }

.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- reactions and the message menu ---------- */
.msg { position: relative; }
.msgmore { position: absolute; top: 2px; right: -34px; width: 30px; height: 30px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.msg.mine .msgmore { right: auto; left: -34px; }
.msgmore svg.i { width: 20px; height: 20px; }
@media (hover: hover) { .msg:hover .msgmore, .msgmore:focus-visible { opacity: 1; } }
@media (hover: none) { .msgmore { display: none; } }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: -6px 6px 2px; position: relative; z-index: 1; }
.react { display: inline-flex; align-items: center; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1px 7px; font-size: 14px; line-height: 20px; box-shadow: var(--shadow); }
.react b { font-size: 12px; color: var(--muted); font-weight: 600; }
.react.on { border-color: var(--brand); background: var(--brand-soft); }
.msg.deleted .txt { font-style: italic; color: var(--muted); }
.msg.flash .bubble { animation: flash 1.4s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet .scrim { position: absolute; inset: 0; background: rgba(20, 14, 10, .38); }
.sheet .panel { position: relative; width: min(100%, 440px); background: var(--panel); border-radius: 20px 20px 0 0; padding: 14px 0 calc(10px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); max-height: 85vh; overflow: auto; }
@media (min-width: 900px) { .sheet { align-items: center; } .sheet .panel { border-radius: 20px; } }
.quick { display: flex; justify-content: space-around; padding: 0 12px 10px; }
.quick button { width: 46px; height: 46px; border-radius: 50%; font-size: 26px; display: grid; place-items: center; background: var(--bg); }
.quick button svg.i { color: var(--muted); }
.pick emoji-picker, .emojipop emoji-picker { width: 100%; --border-size: 0; --background: var(--panel); --input-border-color: var(--line); --indicator-color: var(--brand); --outline-color: var(--brand); }
.pick emoji-picker { height: 320px; }
.emojipop { position: absolute; left: max(8px, env(safe-area-inset-left, 0px)); bottom: 64px; width: min(360px, calc(100% - 16px)); height: 360px; z-index: 20; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 34px rgba(0, 0, 0, .25); background: var(--panel); }
.emojipop emoji-picker { height: 100%; }
.chat { position: relative; }

/* ---------- search inside a chat ---------- */
.findbar { background: var(--panel); border-bottom: 1px solid var(--line); max-height: 50%; display: flex; flex-direction: column; }
.findbar .fb { display: flex; align-items: center; padding-top: 8px; }
.findbar .search { flex: 1; margin-right: 4px; margin-bottom: 8px; }
.hits { overflow: auto; }
.hit { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: baseline; width: 100%; text-align: left; padding: 9px 16px; border-top: 1px solid var(--line); }
.hit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.hit small { color: var(--muted); font-size: 12px; }
.nohit { color: var(--muted); padding: 4px 16px 12px; margin: 0; font-size: 14px; }
.lockt svg.i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.favt { color: var(--accent); display: inline-flex; }
.favt svg.i { width: 15px; height: 15px; fill: currentColor; stroke-width: 1.4; }
.filters { padding-top: 2px; }

/* ---------- calls ---------- */
.callmsg { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 4px 0; }
.callmsg .ci { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.callmsg.over .ci { background: var(--bg); color: var(--muted); }
.callmsg .ct { display: grid; flex: 1; font-weight: 600; }
.callmsg small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.callmsg .join { background: var(--brand); color: var(--brand-ink); border-radius: 18px; padding: 7px 16px; font-weight: 700; }
.callscreen { position: fixed; inset: 0; z-index: 80; background: #14100d; color: #fff; display: flex; flex-direction: column; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.callscreen header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.callscreen header b { font-size: 18px; display: block; }
.callscreen header small { color: #c2b5aa; font-variant-numeric: tabular-nums; }
.ctag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #f6c9b6; background: rgba(236, 122, 84, .2); padding: 5px 10px; border-radius: 14px; }
.ctag svg.i { width: 15px; height: 15px; }
.tiles { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 0 10px; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.tiles[data-n="2"] { grid-template-rows: 1fr 1fr; }
.tiles[data-n="3"], .tiles[data-n="4"] { grid-template-columns: 1fr 1fr; }
.tiles[data-n="5"], .tiles[data-n="6"], .tiles[data-n="7"], .tiles[data-n="8"], .tiles[data-n="9"] { grid-template-columns: repeat(3, 1fr); }
@media (orientation: landscape) { .tiles[data-n="2"] { grid-template-rows: 1fr; grid-template-columns: 1fr 1fr; } }
.tile { position: relative; background: #221f2d; border-radius: 18px; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.tile.screen { background: #000; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.screen video { object-fit: contain; }
.tile video.mirror { transform: scaleX(-1); }
.tile .av.lg { width: 96px; height: 96px; font-size: 36px; }
.tile.ringing .av { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--brand) 25%, transparent); } }
.tile.speaking { box-shadow: inset 0 0 0 3px var(--brand); }
.tname { position: absolute; left: 10px; bottom: 10px; font-size: 13px; background: rgba(0, 0, 0, .45); padding: 3px 9px; border-radius: 10px; }
.cctl { display: flex; justify-content: center; gap: 14px; padding: 16px 12px 20px; flex-wrap: wrap; }
.cctl button { width: 56px; height: 56px; border-radius: 50%; background: #33291f; color: #fff; display: grid; place-items: center; }
.cctl button[aria-pressed="false"] { background: #fff; color: #1d1814; }
.cctl button[data-call="share"][aria-pressed="false"] { background: #33291f; color: #fff; }
.cctl button[data-call="share"][aria-pressed="true"] { background: var(--brand); }
.cctl button.end { background: #e5484d; }
.tile.live > .av { visibility: hidden; }
.cctl button.flip { display: none; }
@media (hover: none) { .cctl button.flip { display: grid; } }
.ring { position: fixed; z-index: 70; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 20px)); display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #1d1814; color: #fff; border-radius: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); animation: drop .25s ease; }
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }
.ring .rt { flex: 1; display: grid; min-width: 0; }
.ring small { color: #c2b5aa; }
.ring button { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.ring .no { background: #e5484d; }
.ring .yes { background: #2fa84f; animation: pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .ring, .ring .yes, .tile.ringing .av, .msg.flash .bubble { animation: none; } }
/* a translated message, under the original */
.trans { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 15px; }
.trans small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.trans small svg { width: 13px; height: 13px; }
.trans.busy { color: var(--muted); }
/* photo safety: blurred while the phone checks it, hidden if it may be explicit */
.photobox { position: relative; }
.photobox.checking img, .photobox.hidden img { filter: blur(28px) saturate(.6); }
.photobox img { transition: filter .25s; }
.showphoto { position: absolute; inset: 0 -4px 4px; display: grid; place-items: center; padding: 16px; text-align: center; color: #fff; font-weight: 600; font-size: 14px; background: rgba(0, 0, 0, .35); border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .photobox img { transition: none; } }
/* replies, forwards, edits, stars */
.quote { display: block; width: calc(100% + 8px); margin: 2px -4px 6px; padding: 6px 10px; border-left: 3px solid var(--brand); border-radius: 8px; background: color-mix(in srgb, var(--brand) 9%, transparent); text-align: left; font-size: 13px; }
.quote b { display: block; color: var(--brand); font-size: 12.5px; }
.quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }
.fwd { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; font-style: italic; margin-bottom: 2px; }
.fwd svg { width: 13px; height: 13px; }
.meta .edited { margin-right: 4px; font-style: italic; }
.meta .mstar svg { width: 11px; height: 11px; margin-right: 3px; vertical-align: -1px; }
.composebar { display: flex; align-items: center; gap: 8px; margin: 0 10px -4px; padding: 8px 6px 8px 12px; background: var(--panel); border-radius: 14px 14px 0 0; border-left: 3px solid var(--brand); }
.composebar .cb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.composebar .cb > svg { width: 18px; height: 18px; color: var(--brand); flex: none; }
.composebar .cb span { min-width: 0; }
.composebar b { display: block; font-size: 13px; color: var(--brand); }
.composebar small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* files, contacts, polls, places */
.filecard { display: flex; align-items: center; gap: 10px; width: 260px; max-width: 100%; padding: 10px; margin: 0 -4px 4px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 6%, transparent); text-align: left; }
.filecard > svg { width: 26px; height: 26px; color: var(--brand); flex: none; }
.filecard > svg:last-child { width: 18px; height: 18px; color: var(--muted); }
.filecard span { flex: 1; min-width: 0; }
.filecard b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filecard small { color: var(--muted); font-size: 12px; }
.bubble video.photo { background: #000; }
.contactcard { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 4px 0 8px; }
.contactcard b { display: block; }
.contactcard small { color: var(--muted); font-size: 12px; word-break: break-all; }
.cardbtn { display: block; width: calc(100% + 8px); margin: 0 -4px 4px; padding: 8px; border-top: 1px solid var(--line); color: var(--brand); font-weight: 600; }
.poll { min-width: 240px; padding-bottom: 4px; }
.poll .pq { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.poll .pq svg { width: 16px; height: 16px; color: var(--brand); }
.poll .opt { position: relative; display: flex; align-items: center; width: 100%; margin: 0 0 6px; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line); overflow: hidden; text-align: left; }
.poll .opt.on { border-color: var(--brand); }
.poll .opt .bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--brand) 16%, transparent); transition: width .3s; }
.poll .opt .ot { position: relative; flex: 1; }
.poll .opt .oc { position: relative; font-weight: 700; color: var(--brand); }
.poll small { color: var(--muted); font-size: 12px; }
.place { width: 260px; max-width: 100%; margin: 0 -4px 4px; }
.place .map { height: 140px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 8%, transparent); z-index: 0; }
.place .pl { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-weight: 600; font-size: 14px; }
.place .pl svg { width: 15px; height: 15px; color: var(--brand); }
.place a { color: var(--brand); font-size: 13px; }
/* attach menu, poll form, chat picker */
.attach { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 14px 6px; padding: 18px 12px 8px; }
.attach > * { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.attach span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.attach span svg { width: 24px; height: 24px; }
.pollform, .picker { padding: 14px 16px 8px; }
.pollform h3, .picker h3 { margin: 0 0 10px; font-size: 17px; }
.pollopts { display: grid; gap: 8px; margin-bottom: 10px; }
.pollopts input { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.pollform .btn { width: 100%; margin-top: 8px; }
.picker .plist { max-height: min(55vh, 460px); overflow-y: auto; margin: 0 -16px; }
.picker .row[aria-pressed="true"] { background: var(--hover); }
.picker .chk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; }
.picker .row[aria-pressed="true"] .chk { background: var(--brand); border-color: var(--brand); color: #fff; }
.picker .chk svg { width: 14px; height: 14px; }
.picker .btn { width: 100%; margin-top: 10px; }
/* narrow phones: search moves into the chat's info screen so the name has room */
@media (max-width: 440px) { #chathead [data-act="find"] { display: none; } }
/* chat list: archived row, pinned and muted marks */
.archrow > svg { width: 22px; height: 22px; margin: 0 15px 0 13px; color: var(--muted); }
.rowi { display: inline-flex; color: var(--muted); margin-left: 4px; }
.rowi svg { width: 15px; height: 15px; }
.badge.quiet { background: var(--muted); }
/* report form, blocked people, a blocked chat */
.picker .fine { color: var(--muted); font-size: 13.5px; margin: -4px 0 10px; }
.set.radio { cursor: pointer; }
.set.radio input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0 14px 0 4px; flex: none; }
.btn.small { width: auto; padding: 6px 14px; font-size: 13px; margin-left: auto; }
.blockedbar { padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; color: var(--muted); font-size: 14px; background: var(--panel); border-top: 1px solid var(--line); }
.linkbtn { color: var(--brand); font-weight: 600; }

/* status updates: a strip of rings above the chat list, and a full-screen viewer */
.stories { display: flex; gap: 12px; overflow-x: auto; padding: 8px 14px 10px; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.stories::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 62px; flex: none; }
.story small { font-size: 12px; color: var(--muted); max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story .sring { display: grid; place-items: center; position: relative; width: 56px; height: 56px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); }
.story.new .sring { box-shadow: inset 0 0 0 2.5px var(--brand); }
.story .sring .av { width: 48px; height: 48px; border: 2px solid var(--panel); }
.story .plus { position: absolute; right: -1px; bottom: -1px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; border: 2px solid var(--panel); }
.story .plus svg { width: 13px; height: 13px; stroke-width: 3; }
.story:not(.add) .plus { display: none; }
.sttext { width: 100%; border: 0; border-radius: 14px; color: #fff; font-size: 20px; font-weight: 600; text-align: center; padding: 22px 14px; resize: none; }
.sttext::placeholder { color: rgba(255, 255, 255, .7); }
.swatches { display: flex; gap: 10px; margin: 10px 0; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .btn { margin-top: 0 !important; }
.story-view { position: fixed; inset: 0; z-index: 80; color: #fff; display: flex; flex-direction: column; }
.story-view .bars { display: flex; gap: 4px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 6px; position: relative; z-index: 2; }
.story-view .bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; position: relative; }
.story-view .bars i.done { background: #fff; }
.story-view .bars i.now::after { content: ""; position: absolute; inset: 0; background: #fff; transform-origin: left; animation: storybar 5s linear forwards; }
@keyframes storybar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .story-view .bars i.now::after { animation: none; transform: scaleX(1); opacity: .6; } }
.story-view header { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 14px; position: relative; z-index: 2; }
.story-view header .who { flex: 1; display: flex; flex-direction: column; min-width: 0; } .story-view header small { opacity: .8; }
.story-view .iconbtn { color: #fff; }
.story-view .stbody { flex: 1; display: grid; place-items: center; padding: 20px; min-height: 0; }
.story-view .stbody img, .story-view .stbody video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.story-view .stbody img.checking, .story-view .stbody img.hidden { filter: blur(28px); }
.sttextview { font-size: clamp(22px, 6vw, 34px); font-weight: 650; text-align: center; max-width: 640px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.story-view .tap { position: absolute; top: 80px; bottom: 70px; z-index: 1; }
.story-view .tap.prev { left: 0; width: 33%; } .story-view .tap.next { right: 0; width: 67%; }
.story-view footer { display: flex; align-items: center; gap: 8px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: rgba(0, 0, 0, .25); position: relative; z-index: 2; font-size: 14px; }
.story-view footer svg { width: 20px; height: 20px; } .story-view footer .linkbtn { margin-left: auto; color: #fff; font-weight: 700; }
.reckey { font: 600 18px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; background: var(--brand-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; text-align: center; word-spacing: .3em; user-select: all; }
.picker .row2 .btn { margin-top: 0; }

/* link a computer: the QR card beside the welcome on a computer, and the scanner on the phone */
.welcome.withlink { flex-direction: row; align-items: center; justify-content: center; gap: 40px; padding: 0 40px; }
.welcome.withlink .inner { margin: 0; }
.linkcard { width: 340px; flex: none; border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: grid; gap: 12px; }
.linkcard h2 { margin: 0; font-size: 19px; }
.linkcard ol { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.linkcard ol b { color: var(--ink); }
.qr { width: 220px; height: 220px; margin: 4px auto 0; display: grid; place-items: center; border-radius: 14px; overflow: hidden; background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.scanner .cam { position: relative; aspect-ratio: 1; max-height: 52vh; margin: 6px auto 12px; border-radius: 18px; overflow: hidden; background: #000; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.linkform { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.linkform input { min-height: 48px; border: 1px solid var(--line); border-radius: 24px; padding: 0 16px; background: var(--bg); text-transform: uppercase; }
.linkform input::placeholder { text-transform: none; }
.linkform .btn { width: auto; margin-top: 0 !important; }
@media (max-width: 899px) { .welcome.withlink { flex-direction: column; } }
.callline { display: inline-flex; align-items: center; gap: 5px; }
.callline svg { width: 16px; height: 16px; color: var(--agent); }
.callline.in svg { color: var(--brand); }
.pill { background: var(--brand); color: var(--brand-ink); font-weight: 700; border-radius: 16px; padding: 6px 14px; }
.gap { height: 10px; }
.fine.pad.intro { text-align: left; padding-bottom: 0; }
