@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn-arabic.woff2') format('woff2-variations');
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn-latin.woff2') format('woff2-variations');
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn-latin-ext.woff2') format('woff2-variations');
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --brand: #0e7c66;
  --brand-ink: #ffffff;
  --brand-soft: #e3f3ee;
  --bg: #ffffff;
  --bg-2: #f4f6f5;
  --chat-bg: #e8eeeb;
  --line: #e2e7e5;
  --ink: #12201c;
  --ink-2: #5d6b67;
  --ink-3: #8a9793;
  --out: #d9f2e8;
  --in: #ffffff;
  --danger: #d14343;
  --ok: #1f9d55;
  --read: #1a9fe0;
  --shadow: 0 1px 2px rgba(16, 32, 28, .08);
  --shadow-lg: 0 18px 50px rgba(16, 32, 28, .18);
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #2bb394;
    --brand-ink: #06231c;
    --brand-soft: #173a31;
    --bg: #131a18;
    --bg-2: #1a2320;
    --chat-bg: #0d1311;
    --line: #26322e;
    --ink: #e8efec;
    --ink-2: #a3b1ad;
    --ink-3: #75847f;
    --out: #1d4a3e;
    --in: #1d2724;
    --read: #5cc3f5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow-x: hidden; }
body {
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--brand); }
[hidden] { display: none !important; }
#app { height: 100dvh; }

.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[dir="rtl"] .flip-rtl, [dir="rtl"] .back .ic { transform: scaleX(-1); }
.ic.down { transform: rotate(-90deg); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; white-space: nowrap;
  transition: filter .15s, background .15s;
}
.btn .ic { width: 20px; height: 20px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--bg-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--ink-2);
  transition: background .15s, color .15s; flex: none;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.danger { color: var(--danger); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255, 255, 255, .15); }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.form-error { color: var(--danger); min-height: 1.5em; margin: 8px 0 0; font-size: 14px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 0; }
.center { text-align: center; }
.muted { color: var(--ink-2); }
.row { display: flex; gap: 10px; align-items: center; }
.row .input { flex: 1; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.label { margin: 4px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--ink-3); text-transform: uppercase; }
.chip { height: 34px; padding: 0 14px; border-radius: 99px; background: var(--bg-2); font-size: 14px; border: 1px solid transparent; }
.chip.on { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); font-weight: 600; }
.lang-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lang-bar.left { justify-content: flex-start; }
.badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--brand); color: var(--brand-ink);
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1;
}
.tag { flex: none; line-height: 1.4; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tag.soft { background: var(--bg-2); color: var(--ink-2); }
.empty { color: var(--ink-3); text-align: center; padding: 28px 20px; margin: 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; }
.spinner.light { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 18px; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--chat-bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border-radius: 22px; padding: 32px 24px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; }
.auth-logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto; }
.auth-card h1 { margin: 0; text-align: center; font-size: 26px; letter-spacing: .01em; }
.auth-card .tagline { margin: -10px 0 4px; text-align: center; }
.auth-form { display: grid; gap: 14px; margin-top: 6px; }
.auth-form h2 { margin: 0; font-size: 19px; }
.auth-form p { margin: -6px 0 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 380px 1fr; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--bg); }
.side-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.side-head h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 700; }
.me-btn { border-radius: 50%; }
.search-wrap { position: relative; margin: 0 12px 8px; }
.search-wrap .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search { width: 100%; height: 40px; border-radius: 12px; border: 0; background: var(--bg-2); padding-inline: 38px 12px; outline: none; }
.search::-webkit-search-cancel-button { display: none; }
.tabs { display: flex; gap: 6px; margin: 0 12px 8px; padding: 4px; background: var(--bg-2); border-radius: 12px; }
.tab { flex: 1; height: 34px; border-radius: 9px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab.on { background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
.tab .badge { min-width: 20px; height: 20px; font-size: 11px; }
.banner { display: flex; align-items: center; gap: 10px; margin: 0 12px 8px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); font-size: 13px; }
.banner > .ic { color: var(--brand); }
.banner span { flex: 1; }
.offline { position: fixed; top: 0; inset-inline: 0; z-index: 50; text-align: center; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); background: #b45309; color: #fff; font-size: 13px; }
.conv-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.conv { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 14px; color: inherit; text-decoration: none; }
.conv:hover { background: var(--bg-2); }
.conv.active { background: var(--brand-soft); }
.conv-av { position: relative; flex: none; }
.dot { position: absolute; bottom: 1px; inset-inline-end: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--ok); border: 2.5px solid var(--bg); }
.conv-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.conv-row { display: flex; align-items: center; gap: 8px; }
.conv-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 12px; color: var(--ink-3); flex: none; }
.conv-prev { flex: 1; min-width: 0; color: var(--ink-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.conv-prev.typing, .chat-sub.typing { color: var(--brand); }
.conv.unread .conv-time { color: var(--brand); font-weight: 600; }

.avatar { border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 600; overflow: hidden; flex: none; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .ic { width: 55%; height: 55%; }

.pane { min-width: 0; min-height: 0; background: var(--chat-bg); position: relative; }
.pane.drop::after { content: ''; position: absolute; inset: 10px; border: 2px dashed var(--brand); border-radius: 18px; pointer-events: none; }
.pane-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--ink-3); }
.pane-empty img { width: 84px; height: 84px; border-radius: 24px; opacity: .9; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100dvh; }
.chat-head {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line); min-height: 60px;
}
.chat-head .back { display: none; }
.chat-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: start; padding: 2px 4px; border-radius: 12px; }
.chat-id-text { min-width: 0; }
.chat-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub.on { color: var(--brand); }
.head-actions { display: flex; gap: 2px; }
.head-actions .icon-btn { color: var(--brand); }
.scroll-area { position: relative; flex: 1; min-height: 0; }
.scroller { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
.msgs { max-width: 860px; margin: 0 auto; padding: 12px 14px 8px; display: flex; flex-direction: column; gap: 3px; }
.jump { position: absolute; bottom: 14px; inset-inline-end: 16px; width: 42px; height: 42px; border-radius: 50%; background: var(--bg); box-shadow: var(--shadow-lg); display: grid; place-items: center; color: var(--ink-2); }
.day { align-self: center; margin: 10px 0 6px; }
.day span { display: inline-block; padding: 3px 12px; border-radius: 99px; background: color-mix(in srgb, var(--bg) 80%, transparent); font-size: 12px; color: var(--ink-2); box-shadow: var(--shadow); }

.msg { display: flex; margin-top: 6px; }
.msg.compact { margin-top: 0; }
.msg.out { justify-content: flex-end; }
.msg.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 3px var(--brand); } }
.bubble {
  position: relative; max-width: min(78%, 560px); padding: 7px 11px 6px; border-radius: 16px;
  background: var(--in); box-shadow: var(--shadow); overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
}
.msg.out .bubble { background: var(--out); }
.msg.in:not(.compact) .bubble { border-start-start-radius: 6px; }
.msg.out:not(.compact) .bubble { border-start-end-radius: 6px; }
.bubble .text { white-space: pre-wrap; display: inline; }
.bubble.deleted .text { font-style: italic; color: var(--ink-3); }
.sender { font-size: 13px; font-weight: 700; margin-bottom: 1px; }
.meta { float: inline-end; display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 10px; margin-top: 6px; margin-bottom: -2px; font-size: 11px; color: var(--ink-3); line-height: 1; position: relative; top: 3px; }
.meta .edited { font-style: italic; }
.tick { display: inline-flex; }
.tick .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.tick.read { color: var(--read); }
.tick.failed { color: var(--danger); }
.bubble.media { padding: 4px; }
.bubble.media .text { display: block; padding: 4px 7px 0; }
.bubble.media > .meta { margin: 4px 6px 2px; }
.bubble.media:not(:has(.text)) > .meta { position: absolute; bottom: 10px; inset-inline-end: 10px; margin: 0; top: auto; padding: 3px 7px; border-radius: 99px; background: rgba(0, 0, 0, .45); color: #fff; }
.bubble.media:not(:has(.text)) > .meta .tick.read { color: #9be0ff; }
.media-box { position: relative; max-width: 100%; border-radius: 12px; overflow: hidden; background: var(--bg-2); cursor: zoom-in; }
.media-box img, .media-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-box.video { cursor: default; background: #000; }
.media-wait { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .3); }
.quote {
  display: grid; text-align: start; gap: 0; width: 100%; padding: 5px 10px; margin: 2px 0 5px; border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 6%, transparent); border-inline-start: 3px solid var(--brand); font-size: 13px;
}
.quote strong { font-size: 12.5px; }
.quote span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 2px 0; }
.play { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.play .ic { width: 18px; height: 18px; stroke: none; }
.seek { flex: 1; accent-color: var(--brand); height: 4px; min-width: 100px; }
.atime { font-size: 12px; color: var(--ink-2); min-width: 34px; font-variant-numeric: tabular-nums; }
.file-row { display: flex; align-items: center; gap: 10px; text-align: start; min-width: 200px; padding: 2px 0; }
.file-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.file-info { display: grid; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.file-info small { color: var(--ink-3); }
.msg.sys { justify-content: center; margin: 8px 0; }
.call-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: var(--bg); box-shadow: var(--shadow); font-size: 13.5px; }
.call-pill .ic { width: 18px; height: 18px; color: var(--ok); }
.call-pill.missed .ic { color: var(--danger); }
.call-pill .meta { float: none; margin: 0; top: 0; }
.chat-empty { margin: auto; }

/* composer */
.composer-wrap { background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 0; max-width: 860px; margin: 0 auto; color: var(--brand); }
.reply-body { flex: 1; min-width: 0; display: grid; padding-inline-start: 10px; border-inline-start: 3px solid var(--brand); font-size: 13px; }
.reply-body span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; max-width: 860px; margin: 0 auto; }
.composer-input {
  flex: 1; min-height: 44px; max-height: 160px; resize: none; border: 0; outline: none; border-radius: 22px;
  background: var(--bg-2); padding: 10px 16px; line-height: 1.5; overflow-y: auto;
}
.composer .icon-btn { height: 44px; width: 44px; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; transition: transform .1s; }
.send-btn:active { transform: scale(.94); }
.composer.recording { align-items: center; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s ease-in-out infinite; margin-inline-start: 4px; }
@keyframes pulse { 50% { opacity: .3; } }
.rec-label { flex: 1; color: var(--ink-2); }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; margin-inline-end: 6px; }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(8, 16, 14, .45); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.sheet.show { opacity: 1; }
.sheet-panel {
  width: 100%; max-width: 440px; max-height: min(86dvh, 760px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px; box-shadow: var(--shadow-lg); transform: translateY(12px); transition: transform .2s;
}
.sheet-panel.wide { max-width: 560px; }
.sheet.show .sheet-panel { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px 20px; }
[dir="rtl"] .sheet-head { padding: 12px 20px 4px 12px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; }
.sheet-body { padding: 10px 20px 20px; overflow-y: auto; }
.dialog { display: grid; gap: 16px; }
.dialog p { margin: 0; font-size: 16px; }
.actions { display: grid; gap: 2px; margin: -4px -8px; }
.action { display: flex; align-items: center; gap: 14px; padding: 13px 12px; border-radius: 12px; text-align: start; font-size: 16px; }
.action:hover { background: var(--bg-2); }
.action .ic { color: var(--ink-2); }
.action.danger, .action.danger .ic { color: var(--danger); }
.people { display: grid; gap: 2px; margin: 0 -8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-align: start; width: 100%; }
.person:hover { background: var(--bg-2); }
.person-text { flex: 1; min-width: 0; display: grid; }
.person-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-text small { color: var(--ink-3); text-align: start; }
.person.accent { color: var(--brand); }
.round-ic { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); pointer-events: none; }
.profile-head { display: grid; justify-items: center; gap: 6px; }
.profile-name { font-size: 19px; font-weight: 700; }
.avatar-edit { position: relative; border-radius: 50%; }
.avatar-edit .cam { position: absolute; bottom: 0; inset-inline-end: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; border: 3px solid var(--bg); }
.avatar-edit .cam .ic { width: 16px; height: 16px; }
.card { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--bg-2); }
.card .input, .card .chip:not(.on) { background: var(--bg); }
.list-actions { gap: 0; padding: 6px; }
.list-btn { display: flex; align-items: center; gap: 14px; padding: 11px 10px; border-radius: 10px; text-align: start; }
.list-btn:hover { background: var(--bg); }
.list-btn .ic { color: var(--ink-2); }
.list-btn.danger, .list-btn.danger .ic { color: var(--danger); }
.ok-line { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ok); font-weight: 600; }
.invites { display: grid; gap: 6px; }
.invite { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 8px; border-radius: 12px; background: var(--bg); }
[dir="rtl"] .invite { padding: 6px 8px 6px 4px; }

.toast { position: fixed; z-index: 80; bottom: calc(90px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 10px); opacity: 0; transition: .25s; background: #1f2a27; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92); display: grid; place-items: center; }
.viewer img { max-width: 100%; max-height: 100dvh; object-fit: contain; }
.viewer-bar { position: absolute; top: max(8px, env(safe-area-inset-top)); inset-inline-end: 8px; display: flex; gap: 4px; z-index: 1; }

/* ---------- call ---------- */
.call { position: fixed; inset: 0; z-index: 70; background: radial-gradient(120% 90% at 50% 0%, #1d5a4c, #0b1714 70%); color: #fff; display: flex; flex-direction: column; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transition: opacity .3s; }
.call.is-voice .call-remote { width: 1px; height: 1px; }
.call.is-video.live .call-remote { opacity: 1; }
.call-local { position: absolute; z-index: 2; width: 110px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; top: max(16px, env(safe-area-inset-top)); inset-inline-end: 16px; background: #000; box-shadow: var(--shadow-lg); transform: scaleX(-1); }
.call.is-voice .call-local { display: none; }
.call-top { position: relative; z-index: 1; flex: 1; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 24px; text-align: center; }
.call.is-video.live .call-top { flex: none; align-content: start; justify-items: start; padding-top: max(18px, env(safe-area-inset-top)); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.call.is-video.live .call-avatar { display: none; }
.call-avatar { margin-bottom: 8px; border-radius: 50%; box-shadow: 0 0 0 8px rgba(255, 255, 255, .06), 0 0 0 18px rgba(255, 255, 255, .03); }
.call-name { font-size: 26px; font-weight: 700; }
.call-status, .call-timer { font-size: 15px; opacity: .85; font-variant-numeric: tabular-nums; }
.call.is-video.live { justify-content: space-between; }
.call-controls { position: relative; z-index: 1; display: flex; justify-content: center; gap: 22px; padding: 24px 16px; padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); }
.cbtn { display: grid; justify-items: center; gap: 6px; color: #fff; font-size: 12px; }
.cbtn .ic { width: 62px; height: 62px; padding: 18px; border-radius: 50%; background: rgba(255, 255, 255, .16); stroke-width: 1.8; box-sizing: border-box; }
.cbtn.off .ic { background: #fff; color: #10201b; }
.cbtn.red .ic { background: #e5484d; }
.cbtn.green .ic { background: #22a95e; }
.cbtn span { opacity: .9; }

/* ---------- responsive ---------- */
@media (max-width: 899px) {
  /* iOS zooms into inputs smaller than 16px on focus */
  input, textarea, .search, .composer-input, .input { font-size: 16px; }
  .shell { grid-template-columns: 1fr; }
  .pane { display: none; }
  body.in-chat .sidebar { display: none; }
  body.in-chat .pane { display: block; }
  .chat-head .back { display: inline-grid; }
  .sheet { align-items: flex-end; padding: 0; }
  .sheet-panel, .sheet-panel.wide { max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); transform: translateY(30px); }
  .bubble { max-width: 86%; }
  .msgs { padding: 10px 8px 6px; }
}
@media (min-width: 900px) and (max-width: 1100px) { .shell { grid-template-columns: 320px 1fr; } }

/* ================= phase 1 additions ================= */
/* manual theme switch */
:root[data-theme="dark"] {
  --brand: #2bb394; --brand-ink: #06231c; --brand-soft: #173a31; --bg: #131a18; --bg-2: #1a2320; --chat-bg: #0d1311;
  --line: #26322e; --ink: #e8efec; --ink-2: #a3b1ad; --ink-3: #75847f; --out: #1d4a3e; --in: #1d2724; --read: #5cc3f5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5); color-scheme: dark;
}
:root[data-theme="light"] {
  --brand: #0e7c66; --brand-ink: #ffffff; --brand-soft: #e3f3ee; --bg: #ffffff; --bg-2: #f4f6f5; --chat-bg: #e8eeeb;
  --line: #e2e7e5; --ink: #12201c; --ink-2: #5d6b67; --ink-3: #8a9793; --out: #d9f2e8; --in: #ffffff; --read: #1a9fe0;
  --shadow: 0 1px 2px rgba(16, 32, 28, .08); --shadow-lg: 0 18px 50px rgba(16, 32, 28, .18); color-scheme: light;
}
/* wallpapers (tinted so they work in light and dark) */
:root[data-wall="sand"] { --chat-bg: color-mix(in srgb, #e9dcc3 55%, var(--bg)); }
:root[data-wall="sky"]  { --chat-bg: color-mix(in srgb, #c9def2 55%, var(--bg)); }
:root[data-wall="rose"] { --chat-bg: color-mix(in srgb, #f0d3da 55%, var(--bg)); }
:root[data-wall="mint"] { --chat-bg: color-mix(in srgb, #cdebdc 60%, var(--bg)); }
:root[data-wall="dots"] .scroller { background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1.2px, transparent 1.4px); background-size: 18px 18px; }
.walls { display: flex; gap: 10px; flex-wrap: wrap; }
.wall { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: #e8eeeb; }
.wall[data-w="sand"] { background: #e9dcc3; } .wall[data-w="sky"] { background: #c9def2; } .wall[data-w="rose"] { background: #f0d3da; }
.wall[data-w="mint"] { background: #cdebdc; }
.wall[data-w="dots"] { background: #e8eeeb radial-gradient(#9aa7a3 1.2px, transparent 1.4px) 0 0 / 9px 9px; }
.wall.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.switch-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin-top: 2px; }
.switch-row span { display: grid; gap: 2px; }
.switch-row small { color: var(--ink-3); font-size: 13px; }
.list-btn .list-state { margin-inline-start: auto; color: var(--ink-3); }
.list-btn { width: 100%; }
.stack.tight { gap: 8px; }
.ic.tiny { width: 13px; height: 13px; stroke-width: 2.2; }

/* chat list flags & search */
.conv-flag { color: var(--ink-3); display: inline-flex; flex: none; }
.conv-flag .ic { width: 16px; height: 16px; }
.badge.muted { background: var(--ink-3); }
.search-results .conv { width: 100%; text-align: start; }
.label.pad { padding: 10px 10px 4px; }
.empty.small { padding: 10px; font-size: 14px; }

/* header extras */
.ttl-chip { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; padding: 1px 7px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; vertical-align: middle; }
.ttl-chip .ic { width: 12px; height: 12px; }
.pin-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--bg); border-bottom: 1px solid var(--line); color: var(--brand); }
.pin-bar > .ic { width: 18px; height: 18px; }
.pin-body { flex: 1; min-width: 0; display: grid; text-align: start; padding-inline-start: 10px; border-inline-start: 3px solid var(--brand); }
.pin-body strong { font-size: 12.5px; }
.pin-body span { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* bubbles: forwarded, scheduled, reactions */
.stackm { display: flex; flex-direction: column; max-width: min(78%, 560px); }
.msg.out .stackm { align-items: flex-end; }
.msg.in .stackm { align-items: flex-start; }
.stackm .bubble { max-width: 100%; }
.fwd { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-3); font-style: italic; margin-bottom: 2px; }
.fwd .ic { width: 14px; height: 14px; }
.msg.scheduled .bubble { opacity: .75; border: 1.5px dashed color-mix(in srgb, var(--brand) 60%, transparent); }
.sched { display: inline-flex; align-items: center; gap: 3px; color: var(--brand); font-weight: 600; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -4px; padding: 0 6px; position: relative; z-index: 1; }
.react { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; box-shadow: var(--shadow); }
.react.mine { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.react .n { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.react-bar { display: flex; justify-content: space-between; gap: 4px; padding: 4px 4px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.react-pick { width: 46px; height: 46px; border-radius: 50%; font-size: 26px; line-height: 1; transition: transform .1s, background .15s; }
.react-pick:hover, .react-pick.on { background: var(--brand-soft); }
.react-pick:active { transform: scale(1.2); }
.tick .progress, .media-wait .progress { font-size: 11px; font-weight: 700; margin-inline-start: 2px; color: #fff; }
.tick .progress { color: var(--ink-3); }
.media-wait { flex-direction: column; gap: 4px; }
.media-load { position: absolute; inset: 0; margin: auto; width: max-content; height: 44px; padding: 0 14px; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }

/* polls */
.bubble.card { min-width: 250px; }
.poll { display: grid; gap: 6px; min-width: 240px; padding: 2px 0 4px; }
.poll-q { font-weight: 700; font-size: 15.5px; }
.poll-sub { color: var(--ink-3); font-size: 12px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 5%, transparent); overflow: hidden; text-align: start; }
.poll-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: color-mix(in srgb, var(--brand) 22%, transparent); transition: width .3s; }
.poll-check { position: relative; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; flex: none; }
.poll-opt.on .poll-check { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.poll-check .ic { width: 13px; height: 13px; stroke-width: 3; }
.poll-label { position: relative; flex: 1; }
.poll-pct { position: relative; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }

/* location */
.loc-card { display: grid; width: 260px; max-width: 100%; color: inherit; text-decoration: none; margin: 0 0 2px; }
.loc-map { position: relative; height: 130px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 14%, var(--bg-2)); overflow: hidden; }
.loc-map img { position: absolute; left: 50%; top: 50%; width: 256px; height: 256px; transform: translate(-50%, -50%); }
.loc-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -85%); color: #e5484d; }
.loc-pin .ic { width: 34px; height: 34px; fill: #e5484d; stroke: #fff; stroke-width: 1.5; }
.loc-text { display: grid; padding: 8px 10px 0; }
.loc-text small { color: var(--brand); font-weight: 600; }

/* round video note */
.bubble.note { background: none; box-shadow: none; padding: 0; }
.note-box { position: relative; width: 220px; height: 220px; border-radius: 50%; overflow: hidden; background: #000; cursor: pointer; box-shadow: var(--shadow-lg); }
.note-box video { width: 100%; height: 100%; object-fit: cover; }
.note-box .media-wait, .note-box .media-load { border-radius: 50%; }
.note-time { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; }
.note-box.playing { box-shadow: 0 0 0 3px var(--brand), var(--shadow-lg); }
.bubble.note > .meta { float: none; display: flex; justify-content: flex-end; margin: 4px 6px 0; top: 0; }
.vn { position: fixed; inset: 0; z-index: 75; background: rgba(5, 12, 10, .92); display: grid; grid-template-rows: 1fr auto; color: #fff; }
.vn-stage { display: grid; place-items: center; align-content: center; gap: 14px; }
.vn-ring { --p: 0; width: min(78vw, 320px); aspect-ratio: 1; border-radius: 50%; padding: 6px; background: conic-gradient(#e5484d calc(var(--p) * 360deg), rgba(255, 255, 255, .15) 0); }
.vn-preview { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; transform: scaleX(-1); background: #000; }
.vn-time { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
.vn-bar { display: flex; align-items: center; justify-content: space-around; padding: 20px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.vn-rec { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; }
.vn-rec span { width: 54px; height: 54px; border-radius: 50%; background: #e5484d; transition: .2s; }
.vn.recording .vn-rec span { width: 26px; height: 26px; border-radius: 6px; }
.send-btn:disabled { opacity: .35; }

/* PIN lock */
.pin-screen { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: grid; justify-items: center; align-content: center; gap: 14px; padding: 24px; }
.pin-logo { width: 64px; height: 64px; border-radius: 18px; }
.pin-screen h2 { margin: 0; font-size: 19px; }
.pin-dots { display: flex; gap: 16px; margin: 6px 0; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-3); }
.pin-dots span.on { background: var(--brand); border-color: var(--brand); }
.pin-msg { min-height: 1.4em; margin: 0; color: var(--danger); font-size: 14px; }
.pin-keys { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.pin-key { width: 76px; height: 76px; border-radius: 50%; background: var(--bg-2); font-size: 28px; font-weight: 500; display: grid; place-items: center; }
.pin-key:active { background: var(--brand-soft); }
.pin-links { display: flex; gap: 20px; min-height: 40px; }
.link-btn { color: var(--brand); font-weight: 600; padding: 8px; }
.pin-screen.shake .pin-dots { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@media (max-width: 899px) { .stackm { max-width: 86%; } }

/* ================= bundle 1 ================= */
/* wallpapers: deep tints in dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-wall="sand"] { --chat-bg: #1c1a14; }
  :root:not([data-theme="light"])[data-wall="sky"]  { --chat-bg: #111a24; }
  :root:not([data-theme="light"])[data-wall="rose"] { --chat-bg: #21161a; }
  :root:not([data-theme="light"])[data-wall="mint"] { --chat-bg: #0f1d18; }
}
:root[data-theme="dark"][data-wall="sand"] { --chat-bg: #1c1a14; }
:root[data-theme="dark"][data-wall="sky"]  { --chat-bg: #111a24; }
:root[data-theme="dark"][data-wall="rose"] { --chat-bg: #21161a; }
:root[data-theme="dark"][data-wall="mint"] { --chat-bg: #0f1d18; }

.arch-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-radius: 12px; color: var(--ink-2); font-weight: 600; text-align: start; }
.arch-row:hover { background: var(--bg-2); }
.arch-row small { margin-inline-start: auto; color: var(--brand); font-weight: 700; }
.badge.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; }
.ic.star-on { color: #f5a623; fill: #f5a623; }
.person-name.missed { color: var(--danger); }
.call-line { display: inline-flex; align-items: center; gap: 4px; }
.ic.red { color: var(--danger); } .ic.green { color: var(--ok); }
.call-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: color-mix(in srgb, var(--ok) 14%, var(--bg)); border-bottom: 1px solid var(--line); color: var(--ok); font-weight: 600; }
.call-bar span { flex: 1; color: var(--ink); }
.tabs.in-sheet { margin: 0; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mg-cell { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--bg-2); }
.mg-cell img, .mg-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-badge { position: absolute; bottom: 6px; inset-inline-start: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.mg-badge .ic { width: 14px; height: 14px; stroke: none; }
.g-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 4px; border-radius: 12px; text-align: start; }
.g-row:hover { background: var(--bg-2); }
.gallery { min-height: 200px; }

/* group call */
.gcall { justify-content: space-between; }
.gc-top { padding: max(18px, env(safe-area-inset-top)) 20px 8px; text-align: center; }
.gc-status { opacity: .85; font-variant-numeric: tabular-nums; }
.gc-grid { flex: 1; display: grid; gap: 8px; padding: 8px; grid-template-columns: 1fr; grid-auto-rows: 1fr; min-height: 0; }
.gc-grid[data-n="2"] { grid-template-rows: 1fr 1fr; }
.gc-grid[data-n="3"], .gc-grid[data-n="4"] { grid-template-columns: 1fr 1fr; }
.gc-grid[data-n="5"], .gc-grid[data-n="6"] { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); }
@media (min-width: 900px) { .gc-grid[data-n="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; } .gc-grid[data-n="5"], .gc-grid[data-n="6"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; } }
.gc-tile { position: relative; border-radius: 18px; overflow: hidden; background: rgba(255, 255, 255, .07); display: grid; place-items: center; min-height: 0; }
.gc-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.gc-tile.has-video video { opacity: 1; }
.gc-tile.has-video .gc-av { display: none; }
.gc-tile.mine video { transform: scaleX(-1); }
.gc-name { position: absolute; bottom: 8px; inset-inline-start: 10px; padding: 2px 10px; border-radius: 99px; background: rgba(0, 0, 0, .45); font-size: 13px; }
.gc-ring { position: fixed; z-index: 72; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(94vw, 460px); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; background: #10201b; color: #fff; box-shadow: var(--shadow-lg); }
.gc-ring-text { flex: 1; display: grid; min-width: 0; }
.gc-ring-text span { opacity: .8; font-size: 13px; }
.cbtn.sm .ic { width: 48px; height: 48px; padding: 13px; }
.tags { display: inline-flex; gap: 6px; align-items: center; flex: none; }
.tag.ok, .tag.warn { display: inline-flex; align-items: center; padding: 3px 6px; }
.tag.ok svg, .tag.warn svg { width: 15px; height: 15px; }
.tag.ok { background: var(--brand-soft); color: var(--brand); }
.tag.warn { background: #fdecea; color: #c0392b; }
:root[data-theme="dark"] .tag.warn { background: #3a1f1d; color: #ff8a80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.warn { background: #3a1f1d; color: #ff8a80; } }

/* ================= Yari: familiar (WhatsApp-like) palette ================= */
:root, :root[data-theme="light"] {
  --brand: #008069; --brand-soft: #e7f5f0; --accent: #25d366;
  --out: #d9fdd3; --in: #ffffff; --read: #53bdeb;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand: #00a884; --brand-ink: #ffffff; --brand-soft: #103629; --bg: #111b21; --bg-2: #202c33; --line: #222d34; --ink: #e9edef; --ink-2: #aebac1; --ink-3: #8696a0; --out: #005c4b; --in: #202c33; --read: #53bdeb; } }
:root[data-theme="dark"] { --brand: #00a884; --brand-ink: #ffffff; --brand-soft: #103629; --bg: #111b21; --bg-2: #202c33; --line: #222d34; --ink: #e9edef; --ink-2: #aebac1; --ink-3: #8696a0; --out: #005c4b; --in: #202c33; --read: #53bdeb; }
:root:not([data-wall]) , :root[data-wall="default"] { --chat-bg: #efeae2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-wall]), :root:not([data-theme="light"])[data-wall="default"] { --chat-bg: #0b141a; } }
:root[data-theme="dark"]:not([data-wall]), :root[data-theme="dark"][data-wall="default"] { --chat-bg: #0b141a; }
/* subtle original pattern of tiny bubbles and dots on the default wallpaper */
:root:not([data-wall]) .scroller, :root[data-wall="default"] .scroller {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.045' stroke-width='1.6'%3E%3Cpath d='M14 18h22a5 5 0 015 5v9a5 5 0 01-5 5H24l-6 5v-5h-4a5 5 0 01-5-5v-9a5 5 0 015-5z'/%3E%3Ccircle cx='86' cy='28' r='6'/%3E%3Cpath d='M70 80l8-8 8 8-8 8z'/%3E%3Cpath d='M20 92c4-6 10-6 14 0'/%3E%3Ccircle cx='100' cy='96' r='2.5'/%3E%3Ccircle cx='58' cy='52' r='2'/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scroller { background-image: none; } }
:root[data-theme="dark"] .scroller { background-image: none !important; }
.msg.in .bubble, .msg.out .bubble { box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.tick .ic { width: 17px; height: 17px; }

/* ---------- sidebar: sections & bottom navigation ---------- */
.sidebar { position: relative; }
.section-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.section-body > .conv-list, .section-body > .discover, .section-body > .stories-page, .section-body > .calls-list { flex: 1; overflow-y: auto; }
.calls-list { padding: 0 8px 80px; }
.side-head .head-actions .icon-btn { color: var(--ink-2); }
.bottom-nav { display: flex; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
.nav-btn { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 8px 4px 9px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.nav-ic { position: relative; width: 56px; height: 30px; border-radius: 99px; display: grid; place-items: center; transition: background .15s; }
.nav-ic .ic { width: 22px; height: 22px; }
.nav-btn.on { color: var(--ink); }
.nav-btn.on .nav-ic { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--brand); }
.nav-ic .badge { position: absolute; top: -4px; inset-inline-end: 4px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; background: var(--accent); color: #0b1f17; }
.dot-new { position: absolute; top: 2px; inset-inline-end: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
@media (min-width: 900px) {
  .bottom-nav { order: -1; border-top: 0; border-bottom: 1px solid var(--line); padding: 0 6px; }
  .nav-btn { grid-auto-flow: column; gap: 6px; padding: 8px 4px; font-size: 13px; }
  .nav-ic { width: auto; height: auto; background: none !important; }
  .nav-btn.on { color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
  .nav-ic .badge { position: static; margin-inline-start: 4px; }
  .dot-new { top: -2px; inset-inline-end: -6px; }
}
.folders { background: none; padding: 0 12px; margin: 0 0 6px; gap: 8px; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.folders::-webkit-scrollbar { display: none; }
.folders .chip { flex: none; height: 32px; padding: 0 14px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; border: 0; }
.folders .chip.on { background: color-mix(in srgb, var(--accent) 22%, var(--bg)); color: var(--brand); }
.badge.sm { min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
.badge.at { background: var(--accent); color: #0b1f17; font-weight: 800; }
.conv .badge { background: var(--accent); color: #0b1f17; }
.conv .badge.muted { background: var(--ink-3); color: var(--bg); }
.conv.unread .conv-time { color: #1daa61; }
.conv-labels { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.label-chip { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.arch-row.accent { color: var(--brand); font-weight: 600; }
.arch-row.accent .badge { margin-inline-start: auto; }
.arch-row.back { font-weight: 700; }
.empty-start { display: grid; justify-items: center; gap: 12px; padding: 40px 16px; color: var(--ink-3); text-align: center; }
.avatar.self { background: #6ea8d6; color: #fff; }
.avatar.self .ic { width: 50%; height: 50%; }
.pane-empty strong { color: var(--ink); font-size: 22px; }
.e2e-note { display: inline-flex; align-items: center; gap: 4px; margin-top: 18px; font-size: 13px; }
.pad { padding-inline: 16px; }
.hint.pad, p.pad { margin: 6px 0; }
.local-time { color: var(--ink-3); }

/* floating action buttons (new chat, new status) */
.fab-col { position: absolute; bottom: 16px; inset-inline-end: 16px; display: grid; gap: 12px; justify-items: center; z-index: 3; }
.fab { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #0b1f17; display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0, 0, 0, .22); }
.fab.small { width: 42px; height: 42px; border-radius: 12px; background: var(--bg-2); color: var(--ink); }
.fab .ic { width: 24px; height: 24px; }
.stories-page { padding-bottom: 150px; position: relative; }

/* ---------- message bits ---------- */
.bubble .text b, .bubble .text strong { font-weight: 700; }
.bubble .text code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 1px 4px; border-radius: 4px; }
.bubble .text .bq { display: block; border-inline-start: 3px solid color-mix(in srgb, var(--ink) 25%, transparent); padding-inline-start: 8px; color: var(--ink-2); }
.spoiler { background: var(--ink-2); color: transparent; border-radius: 4px; cursor: pointer; transition: all .2s; }
.spoiler * { color: transparent !important; }
.spoiler.open { background: color-mix(in srgb, var(--ink) 8%, transparent); color: inherit; }
.spoiler.open * { color: inherit !important; }
.mention { color: #027eb5; font-weight: 600; }
.mention.me { background: color-mix(in srgb, #027eb5 14%, transparent); border-radius: 4px; padding: 0 2px; }
.bubble.sticker { background: transparent !important; box-shadow: none !important; padding: 0 2px; }
.bubble.sticker .text { font-size: 44px; line-height: 1.15; }
.bubble.sticker.e1 .text { font-size: 52px; }
.bubble.sticker.big .text { font-size: 110px; line-height: 1; }
.bubble.sticker > .meta { position: static; display: block; text-align: end; background: color-mix(in srgb, var(--bg) 80%, transparent); border-radius: 99px; padding: 1px 8px; width: max-content; margin-inline-start: auto; }
.link-card { display: block; margin: 4px 0 2px; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--ink) 6%, transparent); color: inherit; text-decoration: none; max-width: 360px; }
.link-card img { display: block; width: 100%; max-height: 180px; object-fit: cover; }
.lc-text { display: grid; gap: 2px; padding: 8px 10px; border-inline-start: 3px solid var(--brand); }
.lc-text small { color: var(--ink-3); font-size: 12px; }
.lc-text strong { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-text span { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.contact-card { display: grid; gap: 8px; min-width: 230px; padding: 4px 2px; }
.cc-top { display: flex; gap: 10px; align-items: center; }
.cc-top .person-text { display: grid; }
.event-card { display: grid; gap: 8px; min-width: 250px; max-width: 320px; padding: 4px 2px; }
.ev-head { display: flex; gap: 12px; align-items: center; }
.ev-head .person-text { display: grid; gap: 1px; min-width: 0; }
.ev-head small { color: var(--ink-2); display: inline-flex; align-items: center; gap: 2px; }
.ev-date { width: 50px; flex: none; border-radius: 10px; overflow: hidden; text-align: center; background: var(--bg); box-shadow: var(--shadow); display: grid; }
.ev-date small { background: #e53935; color: #fff; font-size: 10.5px; padding: 2px 0; font-weight: 700; justify-content: center; }
.ev-date strong { font-size: 20px; padding: 2px 0 4px; }
.ev-desc { margin: 0; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; }
.ev-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ev-actions .chip { height: 32px; }
.once-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 600; }
.once-pill.done { background: transparent; color: var(--ink-3); }
.once-pill .ic { width: 22px; height: 22px; }
.viewer.once .once-tag { display: inline-flex; align-items: center; gap: 6px; color: #fff; margin-inline-end: auto; font-weight: 600; }
.viewer.once video, .viewer.once img { -webkit-user-select: none; user-select: none; pointer-events: none; }
.quote.story { border-inline-start-color: #8e24aa; }
.msg.swipe-ready .bubble { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 40%, transparent); }
.msg .stackm { transition: none; }
.info-msg { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--out); }
.info-msg.old { background: var(--bg-2); }
.info-msg small { color: var(--ink-3); }
.fwd .ic { width: 14px; height: 14px; }

/* ---------- composer extras ---------- */
.input-wrap { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--bg); border-radius: 22px; }
.input-wrap .composer-input { background: transparent; }
.input-wrap .icon-btn { flex: none; color: var(--ink-3); }
.composer .icon-btn { color: var(--ink-2); }
.request-bar { padding: 14px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); text-align: center; display: grid; gap: 10px; }
.request-bar p { margin: 0; color: var(--ink-2); font-size: 14px; }
.row-center { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.preview-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg); border-top: 1px solid var(--line); }
.preview-bar > .ic { color: var(--brand); flex: none; }
.suggest { background: var(--bg); border-top: 1px solid var(--line); max-height: 240px; overflow-y: auto; padding: 4px 6px; }
.sg { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 10px; text-align: start; }
.sg.on, .sg:hover { background: var(--bg-2); }
.sg .person-text { display: grid; min-width: 0; }
.sg small { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round-ic.sm { width: 30px; height: 30px; }
.emoji-box { background: var(--bg); border-top: 1px solid var(--line); }
.emoji-panel { display: grid; grid-template-rows: auto auto 1fr; height: min(300px, 42dvh); }
.emoji-mode { display: flex; gap: 6px; padding: 8px 10px 0; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.etab { width: 36px; height: 32px; border-radius: 8px; font-size: 19px; flex: none; opacity: .65; }
.etab.on { opacity: 1; background: var(--bg-2); }
.emoji-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); padding: 6px 8px; align-content: start; }
.emoji-grid.stickers { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.emo { height: 42px; font-size: 26px; border-radius: 8px; }
.emo.big { height: 76px; font-size: 52px; }
.emo:hover { background: var(--bg-2); }

/* ---------- photo editor ---------- */
.editor { position: fixed; inset: 0; z-index: 80; background: #0b0f0e; color: #fff; display: grid; grid-template-rows: auto auto 1fr auto; padding-top: env(safe-area-inset-top); }
.ed-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; }
.ed-tools { display: flex; gap: 4px; }
.ed-tool { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: #cfd8d5; padding: 6px 10px; border-radius: 10px; }
.ed-tool.on { background: rgba(255, 255, 255, .14); color: #fff; }
.ed-palette { display: flex; justify-content: center; gap: 10px; padding: 4px 0 8px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5); }
.sw.on { outline: 3px solid #fff; outline-offset: 2px; }
.ed-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; touch-action: none; }
.ed-canvas { max-width: 100%; max-height: 100%; touch-action: none; }
.ed-crop { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); touch-action: none; cursor: move; }
.ed-crop .hd { position: absolute; width: 22px; height: 22px; border: 3px solid #fff; }
.ed-crop .nw { top: -4px; left: -4px; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.ed-crop .ne { top: -4px; right: -4px; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.ed-crop .sw { bottom: -4px; left: -4px; border-right: 0; border-top: 0; border-radius: 0; width: 22px; height: 22px; outline: 0; cursor: nesw-resize; }
.ed-crop .se { bottom: -4px; right: -4px; border-left: 0; border-top: 0; cursor: nwse-resize; }
.ed-bottom { display: flex; align-items: center; gap: 8px; padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.ed-caption { flex: 1; min-width: 0; height: 44px; border-radius: 22px; border: 0; padding: 0 16px; background: #1f2a27; color: #fff; font-size: 16px; outline: none; }
.ed-chip { height: 36px; min-width: 40px; padding: 0 10px; border-radius: 99px; border: 1.5px solid rgba(255, 255, 255, .5); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 2px; }
.ed-chip .ic { width: 18px; height: 18px; }
.ed-chip.on { background: #fff; color: #0b0f0e; border-color: #fff; }

/* ---------- status (stories) ---------- */
.st-row { padding: 10px 12px; }
.st-av { position: relative; display: grid; place-items: center; flex: none; }
.st-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.st-ring circle { fill: none; stroke: var(--ink-3); stroke-width: 4; stroke-linecap: round; }
.st-ring.new circle:not(.seen) { stroke: var(--accent); }
.st-viewer { position: fixed; inset: 0; z-index: 90; background: #000; color: #fff; display: grid; grid-template-rows: auto auto 1fr auto; padding-top: env(safe-area-inset-top); user-select: none; }
.st-bars { display: flex; gap: 4px; padding: 8px 10px 0; }
.st-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.st-bars i { display: block; height: 100%; background: #fff; }
.st-head { display: flex; align-items: center; gap: 10px; padding: 10px; }
.st-head .person-text { flex: 1; display: grid; }
.st-head small { color: rgba(255, 255, 255, .75); }
.st-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.st-stage img, .st-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.st-textcard { width: 100%; height: 100%; display: grid; place-items: center; padding: 30px; font-size: clamp(22px, 5vw, 34px); font-weight: 600; text-align: center; white-space: pre-wrap; line-height: 1.5; }
.st-caption { position: absolute; bottom: 16px; inset-inline: 16px; text-align: center; background: rgba(0, 0, 0, .45); padding: 8px 12px; border-radius: 12px; }
.st-foot { display: flex; align-items: center; gap: 8px; padding: 10px; padding-bottom: max(12px, env(safe-area-inset-bottom)); justify-content: center; }
.st-reply { flex: 1; height: 44px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .08); color: #fff; padding: 0 16px; font-size: 16px; outline: none; }
.st-views { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 600; padding: 8px 14px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
.send-btn.sm { width: 44px; height: 44px; }
.st-compose { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto 1fr; color: #fff; padding-top: env(safe-area-inset-top); transition: background .2s; }
.st-top { display: flex; justify-content: space-between; padding: 10px; }
.st-text-in { background: transparent; border: 0; outline: none; color: #fff; font-size: clamp(24px, 6vw, 36px); font-weight: 600; text-align: center; resize: none; padding: 30px; align-self: center; height: 60%; }
.st-text-in::placeholder { color: rgba(255, 255, 255, .6); }
.st-send { position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); inset-inline-end: 20px; }
.stories-strip[hidden] { display: none; }

/* ---------- discover ---------- */
.discover { padding-bottom: 24px; }
.dc-cities { display: grid; gap: 10px; padding: 0 12px; }
.dc-city { background: var(--bg-2); border-radius: 16px; padding: 12px 14px; display: grid; gap: 10px; }
.dc-row { display: flex; align-items: center; gap: 10px; }
.dc-name { flex: 1; min-width: 0; display: grid; }
.dc-name small { color: var(--ink-3); font-size: 12px; }
.dc-clock { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.dc-weather { display: grid; justify-items: center; min-width: 54px; }
.dc-wicon { font-size: 24px; line-height: 1; }
.dc-temp { font-weight: 700; }
.dc-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; }
.dc-day { display: grid; gap: 1px; font-size: 18px; }
.dc-day small { font-size: 11px; color: var(--ink-3); }
.dc-add { display: flex; align-items: center; justify-content: center; gap: 6px; height: 46px; border-radius: 14px; border: 1.5px dashed var(--line); color: var(--brand); font-weight: 600; }
.dc-credit { font-size: 11px; color: var(--ink-3); padding: 4px 16px 0; margin: 0; }
.dc-credit a { color: inherit; }
.dc-cal { margin: 0 12px; background: var(--bg-2); border-radius: 16px; padding: 4px 14px; }
.dc-cal-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.dc-cal-row:last-child { border-bottom: 0; }
.dc-cal-row small { color: var(--ink-3); }
.dc-services { display: grid; gap: 10px; padding: 0 12px; }
.dc-service { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--bg-2); color: inherit; text-decoration: none; border-inline-start: 4px solid var(--accent, var(--brand)); }
.dc-s-badge { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent, var(--brand)); color: #fff; font-weight: 800; font-size: 20px; flex: none; }
.dc-service .person-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.dc-service small { color: var(--ink-2); }
.dc-s-url { color: var(--brand) !important; font-size: 12px; }
.ic.rot180 { transform: rotate(180deg); }
[dir="rtl"] .ic.rot180 { transform: none; }
.promo-edit { display: grid; gap: 8px; }
.lang-tag { width: 34px; flex: none; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; }
.input.color { width: 54px; flex: none; padding: 4px; }
.input.auto { width: auto; flex: none; }

/* ---------- business ---------- */
.checklist { display: grid; gap: 4px; }
.cl-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); }
.cl-item input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.cl-item span { flex: 1; }
.cl-item.done span { text-decoration: line-through; color: var(--ink-3); }
.cl-progress { display: grid; gap: 4px; }
.cl-progress .bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.cl-progress .bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.cl-progress small { color: var(--ink-3); }
.input.notes { min-height: 260px; }
.report-row { display: grid; gap: 4px; padding: 8px; border-radius: 12px; background: var(--bg-2); }
.report-row > small { color: var(--ink-3); padding-inline: 8px; }
.tag.warn { background: #fdecea; color: #c0392b; }
.label-list { display: flex; flex-wrap: wrap; gap: 8px; }
.label-list .chip { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- contact info, encryption ---------- */
.avatar-big { border-radius: 50%; }
.about { margin: 4px 0 0; color: var(--ink-2); text-align: center; }
.quick-actions { display: flex; justify-content: center; gap: 10px; }
.qa { display: grid; justify-items: center; gap: 4px; min-width: 88px; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--line); color: var(--brand); font-size: 13px; font-weight: 600; }
.qa span { color: var(--ink); }
.safety .sn-digits { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; letter-spacing: .06em; line-height: 1.9; text-align: center; word-spacing: .4em; padding: 8px; background: var(--bg-2); border-radius: 12px; }
.e2e-hero { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: var(--brand-soft); color: var(--brand); }
.e2e-hero .ic { width: 30px; height: 30px; }
.rc-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; font-weight: 700; letter-spacing: .08em; text-align: center; padding: 16px 10px; border-radius: 14px; background: var(--bg-2); word-break: break-all; }
.center-col { justify-items: center; text-align: center; }
.search-wrap.in-sheet { margin: 0; }
.sheet-note { margin: 4px 8px 8px; color: var(--ink-2); font-size: 14px; }
.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- auth ---------- */
.auth-switch { text-align: center; margin: 4px 0 0; color: var(--ink-2); }
.link-btn.strong { font-weight: 700; color: var(--brand); }
.legal-links { text-align: center; font-size: 12px; color: var(--ink-3); margin: 0; }
.legal-links a { color: inherit; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin-top: 1px; }
.check-row a { color: var(--brand); }
.input.mono, input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .3em; text-align: center; }

@media (max-width: 899px) {
  .bubble.sticker.big .text { font-size: 96px; }
  .ed-tool span { display: none; }
}
@media (min-width: 900px) { .mobile-only { display: none !important; } }
.conv-list { padding-bottom: 90px; }
.audio .speed { flex: none; min-width: 38px; height: 26px; border-radius: 99px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink-2); }
.audio .speed.on { background: var(--brand); color: #fff; }
.cbtn.on { background: #fff; color: #111; }
body.blurred #app { filter: blur(24px); }
.e2e-banner { align-self: center; max-width: 440px; margin: 8px 12px 10px; padding: 7px 12px; border-radius: 10px; background: #fff5c4; color: #54656f; font-size: 12.5px; text-align: center; display: flex; gap: 6px; align-items: flex-start; box-shadow: var(--shadow); }
:root[data-theme="dark"] .e2e-banner { background: #182229; color: #ffd279; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .e2e-banner { background: #182229; color: #ffd279; } }
.e2e-banner .ic { flex: none; margin-top: 2px; }
.badge.dot { position: static; border: 0; }
.auth .lang-bar .chip { padding: 0 11px; font-size: 13px; height: 32px; }
.auth .lang-bar { flex-wrap: nowrap; gap: 6px; }
