:root {
  color-scheme: dark;
  --bg: #080b0a;
  --panel: #101211;
  --panel-2: #171a19;
  --hover: #252a29;
  --line: #292e2d;
  --text: #f3f5f4;
  --muted: #9da6a3;
  --green: #00a884;
  --green-soft: #076b58;
  --red: #d84052;
}
* { box-sizing: border-box; }
html, body, #client-root { width: 100%; height: 100%; min-height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { border: 0; color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #39c9a9;
  outline-offset: 2px;
}
.boot-brand { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; background: #0b141a; color: #f1f5f3; letter-spacing: 2px; }
.boot-brand img { width: 96px; height: 96px; border-radius: 28px; box-shadow: 0 20px 50px #0008; }
.boot-brand strong { font-size: 15px; font-weight: 800; }
.icon { width: 21px; height: 21px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark { width: 43px; height: 43px; border-radius: 14px; box-shadow: 0 10px 32px #0004; }
.welcome-page { min-height: 100vh; min-height: 100dvh; overflow-y: auto; padding: max(44px, env(safe-area-inset-top)) 20px max(30px, env(safe-area-inset-bottom)); display: grid; place-items: center; background: radial-gradient(circle at 50% 14%, #173b32 0, transparent 24rem), radial-gradient(circle at 92% 85%, #36151b 0, transparent 23rem), #07100f; }
.welcome-shell { width: min(100%, 510px); text-align: center; }
.welcome-logo { width: 108px; height: 108px; border-radius: 30px; box-shadow: 0 24px 60px #0009, 0 0 0 1px #ffffff17; }
.welcome-eyebrow { display: block; margin: 20px 0 7px; color: #56d7b4; font-size: 9px; font-weight: 800; letter-spacing: 2.3px; }
.welcome-shell h1 { margin: 0; color: #f5f7f6; font-size: clamp(31px, 8vw, 43px); line-height: 1.05; letter-spacing: -1.7px; }
.welcome-lead { max-width: 440px; margin: 15px auto 23px; color: #98a9a4; font-size: 14px; line-height: 1.6; }
.welcome-steps { padding: 9px 18px; border: 1px solid #20352f; border-radius: 23px; text-align: left; background: #111b19d9; box-shadow: 0 20px 48px #0005; }
.welcome-steps > div { min-height: 72px; display: grid; grid-template-columns: 27px 34px 1fr; align-items: center; gap: 9px; }
.welcome-steps > div + div { border-top: 1px solid #283632; }
.welcome-steps > div > span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #071612; background: #4dd4ae; font-size: 11px; font-weight: 800; }
.welcome-steps i { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #67dabc; background: #193129; font-style: normal; }
.welcome-steps i .icon { width: 17px; height: 17px; }
.welcome-steps p { margin: 0; min-width: 0; }
.welcome-steps strong { display: block; color: #e7edeb; font-size: 13px; }
.welcome-steps small { display: block; margin-top: 2px; color: #8d9e99; font-size: 11px; line-height: 1.35; }
.welcome-start { width: 100%; min-height: 55px; margin-top: 18px; padding: 0 22px; border-radius: 17px; display: flex; align-items: center; justify-content: center; gap: 9px; color: #061711; background: #28c98c; box-shadow: 0 15px 35px #00a88425; font-size: 15px; font-weight: 800; transition: transform .15s, filter .15s; }
.welcome-start:hover { filter: brightness(1.08); }
.welcome-start:active { transform: translateY(1px); }
.welcome-start .icon { width: 18px; height: 18px; }
.welcome-trust { margin: 15px 0 0; display: flex; justify-content: center; align-items: center; gap: 7px; color: #82948e; font-size: 10px; }
.welcome-trust .icon { width: 14px; height: 14px; color: #54d5b2; }
.welcome-error { margin-top: 12px; color: #f09aa5; font-size: 11px; }
.welcome-install { width: 100%; min-height: 76px; margin-top: 24px; padding: 12px 16px; border: 1px solid #5b2931; border-radius: 18px; color: #e8edeb; background: #1a1516d9; text-align: left; display: grid; grid-template-columns: 34px 1fr 20px; align-items: center; gap: 10px; }
.welcome-install > span:first-child { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #ff6b78; background: #3b1d22; }
.welcome-install > span:first-child .icon, .welcome-install > .icon { width: 17px; height: 17px; }
.welcome-install strong { display: block; font-size: 13px; }
.welcome-install small { display: block; margin-top: 2px; color: #a99a9d; font-size: 10px; line-height: 1.35; }
.welcome-install:hover { border-color: #87404a; background: #24191b; }
.welcome-install[hidden] { display: none; }
.install-guide { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 20px; }
.install-guide-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; background: #030706d9; backdrop-filter: blur(8px); }
.install-guide-card { position: relative; width: min(100%, 390px); padding: 28px 24px 22px; border: 1px solid #334640; border-radius: 25px; color: #eef3f1; background: linear-gradient(155deg, #172522, #101817); box-shadow: 0 30px 90px #000d; text-align: center; }
.install-guide-card > img { width: 58px; height: 58px; border-radius: 18px; box-shadow: 0 12px 30px #0008; }
.install-guide-kicker { display: block; margin: 15px 0 7px; color: #57d8b7; font-size: 9px; font-weight: 800; letter-spacing: 1.7px; }
.install-guide-card h2 { margin: 0; font-size: 23px; line-height: 1.15; letter-spacing: -.6px; }
.install-guide-card > p { margin: 12px 0 18px; color: #9badaa; font-size: 12px; line-height: 1.55; }
.install-guide-card ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; text-align: left; }
.install-guide-card li { min-height: 50px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; border-radius: 13px; color: #cbd5d2; background: #ffffff08; font-size: 12px; line-height: 1.4; }
.install-guide-card li i { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: #62dbba; background: #1d3831; font-style: normal; }
.install-guide-card li .icon { width: 17px; height: 17px; }
.install-guide-done { width: 100%; min-height: 48px; margin-top: 19px; border-radius: 14px; color: #061711; background: #28c98c; font-weight: 800; }
.welcome-back { width: 100%; margin-top: 15px; padding: 8px; color: #91a49e; background: transparent; font-size: 11px; text-decoration: underline; }
.onboarding {
  min-height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at 14% 8%, #114037 0, transparent 25rem),
    radial-gradient(circle at 90% 92%, #3b1820 0, transparent 26rem),
    #0b141a;
  display: grid;
  place-items: center;
  padding: 34px 20px;
}
.connect-card {
  width: min(100%, 980px);
  min-height: 610px;
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  overflow: hidden;
  border: 1px solid #30424c;
  border-radius: 28px;
  background: #111b21e8;
  box-shadow: 0 34px 100px #0007;
  backdrop-filter: blur(18px);
}
.connect-story {
  position: relative;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(145deg, #18372fdd, #102029f2),
    repeating-radial-gradient(circle at 20% 20%, #fff 0 1px, transparent 1px 25px);
  border-right: 1px solid #30424c;
}
.story-brand { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 24px; font-weight: 700; letter-spacing: -.8px; }
.story-brand small { display: block; color: #8da49e; font-size: 10px; font-weight: 600; letter-spacing: 1.7px; margin-top: 2px; }
.connect-story h1 { max-width: 420px; font-size: clamp(34px, 4vw, 53px); line-height: 1.04; letter-spacing: -2.6px; margin: 60px auto 20px; text-align: center; }
.connect-story h1 span { color: #57d8b7; }
.connect-story > div > p { max-width: 420px; color: #a8babf; font-size: 15px; line-height: 1.8; margin-left: auto; margin-right: auto; text-align: center; }
.trust-list { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; color: #91a9a4; font-size: 11px; }
.trust-list span { display: flex; align-items: center; gap: 7px; }
.trust-list .icon { width: 15px; height: 15px; color: #57d8b7; }
.connect-form-panel { padding: 58px 52px; display: flex; flex-direction: column; justify-content: center; }
.step-label { display: inline-flex; align-items: center; gap: 8px; color: #53d3b2; text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: 1.7px; }
.step-label::before { content: ""; width: 24px; height: 1px; background: currentColor; }
.connect-form-panel h2 { font-size: 29px; line-height: 1.2; letter-spacing: -1px; margin: 16px 0 10px; }
.connect-form-panel > p, .pair-panel > p { color: var(--muted); line-height: 1.7; margin: 0 0 28px; }
.phone-form label { display: block; color: #c9d1d4; font-size: 12px; font-weight: 600; margin-bottom: 9px; }
.phone-input { position: relative; display: grid; grid-template-columns: 165px 1fr; background: #202c33; border: 1px solid #34444e; border-radius: 12px; overflow: visible; transition: border-color .15s, box-shadow .15s; }
.phone-input:focus-within { border-color: #3dc9a8; box-shadow: 0 0 0 3px #00a8841c; }
.phone-input select, .phone-input input { min-width: 0; height: 54px; border: 0; outline: 0; color: var(--text); background: transparent; }
.phone-input input { padding: 0 16px; font-size: 16px; letter-spacing: .35px; }
.phone-input input::placeholder { color: #667780; }
.country-native { display: none; }
.country-picker { position: relative; min-width: 0; border-right: 1px solid #34444e; }
.country-trigger { width: 100%; height: 54px; padding: 0 11px; border-radius: 11px 0 0 11px; color: #eff4f2; background: transparent; display: grid; grid-template-columns: 29px 1fr 15px; align-items: center; gap: 8px; text-align: left; }
.country-trigger:hover, .country-trigger[aria-expanded="true"] { background: #ffffff08; }
.country-trigger > span { min-width: 0; }
.country-trigger strong, .country-trigger small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-trigger strong { font-size: 13px; }
.country-trigger small { color: #8fa09a; font-size: 9px; }
.country-trigger > .icon { width: 15px; height: 15px; color: #8fa09a; transform: rotate(90deg); transition: transform .15s; }
.country-trigger[aria-expanded="true"] > .icon { transform: rotate(-90deg); }
.country-flag { width: 28px; height: 21px; border-radius: 5px; object-fit: cover; box-shadow: 0 0 0 1px #ffffff24; }
.country-menu { position: absolute; z-index: 40; top: calc(100% + 8px); left: -1px; width: min(330px, calc(100vw - 54px)); max-height: 286px; overflow-y: auto; padding: 7px; border: 1px solid #3b4944; border-radius: 14px; background: #17201e; box-shadow: 0 20px 55px #000c; }
.country-menu[hidden] { display: none; }
.country-menu button { width: 100%; min-height: 43px; padding: 7px 9px; border-radius: 9px; color: #eef3f1; background: transparent; display: grid; grid-template-columns: 29px 1fr auto; align-items: center; gap: 9px; text-align: left; }
.country-menu button:hover, .country-menu button:focus-visible { background: #293532; }
.country-menu button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.country-menu button strong { color: #7fd8bd; font-size: 11px; }
.form-hint { color: #6f828c; font-size: 11px; margin: 10px 2px 23px; }
.main-button { width: 100%; min-height: 50px; border-radius: 12px; background: var(--green); color: #071c17; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 9px; transition: transform .15s, filter .15s; }
.main-button:hover { filter: brightness(1.08); }
.main-button:active { transform: translateY(1px); }
.main-button .icon { width: 18px; height: 18px; }
.legal-note { display: flex; gap: 8px; align-items: flex-start; color: #71838c; font-size: 10px; line-height: 1.55; margin-top: 20px; }
.legal-note .icon { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 1px; }
.form-error { min-height: 19px; color: #f39aa6; font-size: 11px; margin-top: 13px; }
.pair-panel { text-align: center; }
.pair-panel .step-label { justify-content: center; }
.pair-brand { margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; gap: 10px; color: #f1f5f3; font-size: 17px; }
.pair-brand img { width: 42px; height: 42px; border-radius: 13px; box-shadow: 0 8px 24px #0007; }
.connect-logo-block { margin: 0 auto 7px; text-align: center; }
.connect-logo-block .welcome-logo { display: block; margin: 0 auto; }
.connect-logo-block .welcome-eyebrow { margin-bottom: 0; }
.pair-code { width: min(100%, 430px); margin: 25px auto 13px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pair-code-group { min-width: 0; flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.pair-character { display: grid; place-items: center; min-width: 0; height: 63px; border-radius: 12px; background: #242629; border: 1px solid #36393d; color: #e4e5e6; box-shadow: inset 0 1px #ffffff08, 0 8px 20px #0002; font: 750 28px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.pair-separator { flex: 0 0 auto; color: #9da1a5; font: 800 29px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.copy-code { margin: 0 auto 24px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; background: #202c33; border: 1px solid #35454e; color: #cbd7d8; font-size: 11px; font-weight: 700; transition: background .15s, border-color .15s, transform .15s; }
.copy-code:hover { background: #293941; border-color: #45606b; }
.copy-code:active { transform: scale(.98); }
.copy-code .icon { width: 16px; height: 16px; }
.pair-steps { text-align: left; display: grid; gap: 12px; margin: 0 0 25px; counter-reset: pair; }
.pair-steps div { display: flex; align-items: center; gap: 11px; color: #a8b7bc; font-size: 12px; }
.pair-steps div::before { counter-increment: pair; content: counter(pair); display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #173b33; color: #63dabc; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.pair-state { display: inline-flex; align-items: center; gap: 8px; color: #7ed8bf; font-size: 11px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #39c8a6; box-shadow: 0 0 0 0 #39c8a666; animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px #39c8a600; } 100% { box-shadow: 0 0 0 0 #39c8a600; } }
.retry-link { margin-top: 18px; color: #8da0a8; background: transparent; text-decoration: underline; font-size: 11px; }
.messenger { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(360px, 440px) 1fr; background: var(--bg); }
.chat-sidebar { min-width: 0; overflow: hidden; display: flex; flex-direction: column; background: #050505; border-right: 1px solid #1d1d1d; }
.sidebar-top { padding: 18px 18px 8px; background: #050505; }
.sidebar-head { min-height: 52px; padding: 0; background: transparent; display: flex; align-items: center; gap: 10px; }
.mini-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mini-brand img { width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 0 0 1px #ffffff18, 0 5px 18px #0007; }
.mini-brand strong { display: block; font-size: 17px; font-weight: 750; letter-spacing: -.35px; }
.mini-brand small { display: none; }
.online-dot { width: 6px; height: 6px; border-radius: 50%; background: #36c9a5; }
.sidebar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header-action { width: 48px; height: 48px; border-radius: 50%; background: #202020; color: #f5f5f5; border: 1px solid #353535; display: grid; place-items: center; transition: transform .15s, filter .15s; }
.header-action:hover { filter: brightness(1.15); }
.header-action:active { transform: scale(.96); }
.header-action.primary { color: #04160b; background: #20c766; border-color: #20c766; }
.header-action .icon { width: 25px; height: 25px; stroke-width: 2.1; }
.header-action.primary .icon { width: 29px; height: 29px; stroke-width: 2.5; }
.sidebar-title { margin: 20px 0 15px; color: #f7f7f7; font-size: 32px; line-height: 1; letter-spacing: -1.25px; font-weight: 780; }
.icon-button { width: 39px; height: 39px; border-radius: 50%; background: transparent; color: #aebac1; display: grid; place-items: center; }
.icon-button:hover { background: #ffffff0d; }
.search-wrap { padding: 0; border: 0; }
.search-box { height: 49px; border-radius: 25px; background: #202020; display: flex; align-items: center; gap: 11px; padding: 0 17px; color: #979797; }
.search-box .icon { width: 21px; height: 21px; stroke-width: 2.2; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; font-weight: 550; }
.search-box input::placeholder { color: #8d8d8d; opacity: 1; }
.chat-list { min-height: 0; overflow-y: auto; flex: 1; }
.chat-item { width: 100%; min-height: 86px; background: transparent; padding: 0 0 0 18px; display: flex; align-items: center; text-align: left; }
.chat-item:hover, .chat-item.active { background: #111; }
.chat-item-body { height: 86px; min-width: 0; flex: 1; padding: 15px 18px 12px 14px; border-bottom: 1px solid #242424; }
.chat-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-line strong { color: #f6f6f6; font-size: 16.5px; line-height: 1.2; font-weight: 730; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-line time { color: #8f8f8f; font-size: 14px; font-weight: 500; flex: 0 0 auto; }
.chat-preview { display: flex; align-items: center; gap: 5px; color: #929292; font-size: 14px; line-height: 1.25; margin-top: 5px; min-width: 0; }
.chat-preview span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-preview.deleted { color: #aeb7b4; font-style: italic; }
.chat-preview .icon { width: 17px; height: 17px; flex: 0 0 auto; }
.chat-preview .preview-check { display: inline-flex; color: #4fc3f7; flex: 0 0 auto; }
.chat-preview .preview-check .icon { width: 19px; }
.group-lock-icon { display: inline-flex; color: #e7b85a; flex: 0 0 auto; }
.group-lock-icon .icon { width: 15px; height: 15px; }
.deleted-preview-eye { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: url("/assets/deleted-message-eye.png?v=3") center / 64px 64px no-repeat; filter: drop-shadow(0 0 3px #ff2e4777); }
.deleted-preview-eye img { display: none; }
.avatar { width: 53px; height: 53px; border-radius: 50%; flex: 0 0 auto; position: relative; display: grid; place-items: center; overflow: hidden; background: linear-gradient(145deg, #3b5966, #223740); color: #d9e4e8; font-size: 14px; font-weight: 650; }
.avatar.small { width: 36px; height: 36px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #24353d; }
.sidebar-nav { position: relative; z-index: 999; min-height: 70px; margin: 0 8px 8px; padding: 6px 7px max(7px, env(safe-area-inset-bottom)); background: #000; border: 1px solid #303030; border-bottom-color: #000; border-radius: 27px; box-shadow: 0 8px 24px #0009; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; backdrop-filter: blur(18px); }
.sidebar-nav button { min-width: 0; border-radius: 24px; padding: 6px 2px 4px; color: #f1f1f1; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.sidebar-nav button:hover, .sidebar-nav button.active { background: #363636; }
.sidebar-nav .icon { width: 24px; height: 24px; stroke-width: 1.8; }
.sidebar-nav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 9px; font-weight: 650; }
.chat-stage { min-width: 0; display: flex; flex-direction: column; position: relative; background-color: #0b141a; background-image: radial-gradient(#3c4f5730 .7px, transparent .7px); background-size: 17px 17px; }
.empty-chat { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px; background: #111b21; border-bottom: 6px solid var(--green); }
.empty-chat-inner { max-width: 460px; }
.empty-illustration { width: 116px; height: 116px; border-radius: 38px; margin: 0 auto 28px; display: grid; place-items: center; color: #74cdb5; border: 1px solid #2c4c47; background: linear-gradient(145deg, #183a32, #16262d); }
.empty-illustration .icon { width: 54px; height: 54px; stroke-width: 1.2; }
.empty-chat h2 { margin: 0 0 13px; font-size: 29px; font-weight: 300; letter-spacing: -.8px; }
.empty-chat p { color: #8696a0; font-size: 13px; line-height: 1.7; }
.conversation-head { min-height: 62px; background: #101111; display: flex; align-items: center; gap: 10px; padding: 8px 16px; z-index: 2; border-bottom: 1px solid #202322; }
.conversation-title { min-width: 0; }
.conversation-title strong { display: block; font-size: 15px; font-weight: 730; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; letter-spacing: -.2px; }
.conversation-title small { color: #8f9794; font-size: 10px; }
.back-button { display: none; }
.conversation-actions { margin-left: auto; min-height: 42px; padding: 0 7px; border: 1px solid #343736; border-radius: 23px; background: #1c1e1d; display: flex; align-items: center; color: #f3f4f3; }
.conversation-actions span { width: 40px; height: 38px; display: grid; place-items: center; }
.conversation-actions span + span { border-left: 1px solid #343736; }
.conversation-actions .icon { width: 21px; height: 21px; stroke-width: 2; }
.message-list { flex: 1; min-height: 0; overflow-y: auto; padding: 28px max(28px, 7vw); display: flex; flex-direction: column; background-color: #07100e; background-image: linear-gradient(#04110d42, #04110d42), url("/assets/chat-wallpaper.png"); background-size: 520px 520px; background-repeat: repeat; }
.date-chip { align-self: center; background: #171a19; color: #f0f2f1; box-shadow: 0 2px 8px #0006; border-radius: 12px; padding: 8px 22px; font-size: 12px; font-weight: 700; margin: 4px 0 20px; }
.message-row { display: flex; align-items: flex-end; margin: 4px 0; }
.message-row.out { justify-content: flex-end; }
.message-stack { max-width: min(78%, 680px); display: flex; flex-direction: column; gap: 6px; }
.message-row.out .message-stack { align-items: flex-end; margin-left: auto; }
.message-cluster { max-width: min(78%, 680px); display: flex; align-items: center; gap: 12px; }
.message-stack .message-cluster { max-width: 100%; }
.message-row.out .message-cluster { flex-direction: row-reverse; margin-left: auto; }
.message-bubble { position: relative; max-width: 100%; min-width: 76px; padding: 9px 11px 6px; background: #282e2d; border-radius: 14px; box-shadow: 0 1px 2px #0006; font-size: 14px; overflow-wrap: anywhere; }
.message-row.out .message-bubble { background: var(--green-soft); }
.message-bubble.deleted { border-left: 3px solid #ff4054; background: #352428; }
.message-bubble p { margin: 0; white-space: pre-wrap; }
.group-sender { margin: 0 0 4px; color: #55d6b0; font-size: 11px; font-weight: 750; }
.message-bubble.sticker-bubble { min-width: 0; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
.message-row.out .message-bubble.sticker-bubble { background: transparent; }
.message-bubble.sticker-bubble .sticker-media { width: 104px; height: 104px; max-height: none; margin: 0; object-fit: contain; border-radius: 0; }
.message-bubble.sticker-bubble .message-meta { position: absolute; right: 2px; bottom: 2px; margin: 0; padding: 2px 5px; border-radius: 8px; color: #d8dedc; background: #101716cc; box-shadow: 0 1px 3px #0007; }
.message-bubble.deleted-placeholder-bubble { display: grid; grid-template-columns: minmax(0, auto) auto; align-items: end; gap: 12px; padding: 11px 12px 7px; }
.deleted-summary { min-width: 0; display: flex; align-items: center; gap: 7px; }
.deleted-summary > .icon { width: 17px; height: 17px; flex: 0 0 auto; color: #b9c0be; stroke-width: 1.8; }
.deleted-label { color: #d4d9d7; display: flex; align-items: center; line-height: 1.25; font-size: 13px; font-weight: 600; font-style: italic; white-space: nowrap; }
.message-bubble.deleted .deleted-label { color: #efb4bb; font-size: 11px; font-style: normal; }
.deleted-eye { position: relative; width: 38px; height: 38px; flex: 0 0 auto; overflow: hidden; border-radius: 50%; background-color: transparent; background-image: url("/assets/deleted-message-eye.png?v=3"); background-repeat: no-repeat; background-position: center; background-size: 120px 120px; display: grid; place-items: center; filter: drop-shadow(0 0 7px #ff2e47aa); transition: transform .16s, filter .16s; }
.deleted-eye:hover { transform: scale(1.08); filter: brightness(1.12); }
.deleted-eye img { display: none; }
.message-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.message-row.out .message-actions { flex-direction: row-reverse; }
.edit-history { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: #8ed5ff; background: #142d3b; border: 1px solid #32647f; box-shadow: 0 0 12px #1da1f233; transition: transform .16s, color .16s, background .16s; }
.edit-history:hover, .edit-history[aria-pressed="true"] { transform: scale(1.06); color: #e0f5ff; background: #1d5069; }
.edit-history .icon { width: 19px; height: 19px; stroke-width: 1.8; }
.original-message { max-width: min(92%, 520px); padding: 9px 11px 10px; border-radius: 11px; color: #dbe7eb; background: #14232b; border-left: 3px solid #59bde9; box-shadow: 0 1px 2px #0005; }
.message-row.out .original-message { border-left: 0; border-right: 3px solid #59bde9; background: #123a36; }
.original-message strong { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; color: #8ed5ff; font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.original-message strong .icon { width: 14px; height: 14px; }
.original-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; font-style: italic; }
.message-meta { display: flex; justify-content: flex-end; align-items: center; gap: 3px; color: #b4bcba; font-size: 10px; margin: 3px 0 0 18px; line-height: 1; }
.deleted-placeholder-bubble .message-meta { margin: 0; padding-bottom: 1px; }
.message-meta .icon { width: 15px; height: 15px; color: #4cc5f4; stroke-width: 2; }
.message-media { display: block; width: min(320px, 100%); max-height: 340px; object-fit: cover; border-radius: 6px; margin-bottom: 5px; }
.message-bubble.image-bubble { min-width: 0; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
.message-row.out .message-bubble.image-bubble { background: transparent; }
.message-bubble.image-bubble .message-media { margin: 0; border-radius: 14px; box-shadow: 0 2px 7px #0008; }
.message-bubble.image-bubble .attachment-name { width: max-content; max-width: min(300px, 68vw); margin: 5px 2px 0; padding: 4px 7px; border-radius: 8px; background: #161d1bcc; }
.message-bubble.image-bubble p { width: fit-content; max-width: 100%; margin: 5px 0 0; padding: 7px 9px; border-radius: 10px; background: #282e2d; box-shadow: 0 1px 2px #0005; }
.message-row.out .message-bubble.image-bubble p { background: var(--green-soft); }
.message-bubble.image-bubble .message-meta { width: max-content; margin: 4px 4px 0 auto; padding: 3px 6px; border-radius: 8px; color: #d8dedc; background: #101716cc; box-shadow: 0 1px 3px #0007; }
.attachment-name { max-width: 300px; display: flex; align-items: center; gap: 6px; color: #c6cecb; font-size: 10px; padding: 3px 2px 1px; }
.attachment-name .icon { width: 13px; height: 13px; flex: 0 0 auto; }
.attachment-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-card { width: min(330px, 70vw); display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; color: #edf2f0; background: #151b1a99; text-decoration: none; transition: background .16s, transform .16s; }
.document-card:hover { background: #111716d9; transform: translateY(-1px); }
.document-card > .icon { width: 18px; height: 18px; flex: 0 0 auto; color: #b8c7c2; }
.document-icon { width: 39px; height: 43px; flex: 0 0 auto; border-radius: 7px; display: grid; place-items: center; color: #fff; background: #dd3e45; }
.document-icon .icon { width: 22px; height: 22px; }
.document-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.document-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.document-copy small { color: #aeb9b6; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
audio { width: min(290px, 65vw); height: 38px; }
.media-fallback { color: #9fb0b6; display: flex; align-items: center; gap: 7px; padding: 8px; font-size: 11px; }
.compose-bar { position: relative; z-index: 999; min-height: 72px; background: #000; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid #1d201f; }
.compose-faux { flex: 1; height: 48px; border-radius: 25px; background: #292d2c; color: #8e9794; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; font-size: 12px; }
.compose-faux .icon { width: 20px; height: 20px; color: #d7dcda; }
.compose-action { width: 38px; height: 38px; flex: 0 0 auto; color: #f0f2f1; display: grid; place-items: center; }
.compose-action .icon { width: 25px; height: 25px; stroke-width: 1.9; }
.compose-plus .icon { width: 31px; height: 31px; stroke-width: 1.6; }
.compose-mic { width: 46px; height: 46px; border-radius: 50%; background: #f1f2f1; color: #101211; }
.compose-mic .icon { width: 25px; height: 25px; stroke-width: 2.2; }
.group-gate { position: absolute; inset: 0; z-index: 15; display: grid; place-items: center; padding: 24px; background: #050706c7; backdrop-filter: blur(7px); }
.group-gate-card { width: min(100%, 390px); padding: 30px 27px 24px; border: 1px solid #343b38; border-radius: 25px; text-align: center; background: linear-gradient(155deg, #1c211f, #101311); box-shadow: 0 28px 80px #000c; }
.group-gate-card > img { width: 55px; height: 55px; border-radius: 18px; box-shadow: 0 10px 28px #0008; }
.group-gate-kicker { display: block; margin: 16px 0 8px; color: #52d5a8; font-size: 9px; font-weight: 800; letter-spacing: 1.5px; }
.group-gate-card h2 { margin: 0; font-size: 23px; line-height: 1.15; letter-spacing: -.65px; }
.group-gate-card > p { margin: 13px 0 18px; color: #aeb8b4; font-size: 13px; line-height: 1.6; }
.group-gate-benefit { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border-radius: 13px; text-align: left; color: #cbd3d0; background: #ffffff08; font-size: 11px; line-height: 1.45; }
.group-gate-benefit .icon { width: 17px; height: 17px; flex: 0 0 auto; color: #e7b85a; margin-top: 1px; }
.group-gate-primary, .group-gate-secondary { width: 100%; min-height: 46px; border-radius: 23px; font-weight: 750; }
.group-gate-primary { margin-top: 20px; color: #06160f; background: #25d366; }
.group-gate-primary:hover { filter: brightness(1.08); }
.group-gate-secondary { margin-top: 6px; color: #b6c1bd; background: transparent; }
.group-gate-secondary:hover { background: #ffffff09; }
.list-empty { text-align: center; color: #7f929b; padding: 52px 26px; font-size: 12px; }
.loading { flex: 1; display: grid; place-items: center; color: #91a2aa; }
.loading::before { content: ""; width: 25px; height: 25px; border-radius: 50%; border: 2px solid #33454e; border-top-color: #4ed5b3; animation: spin .8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
#client-toast { position: fixed; z-index: 20; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #e9edef; color: #162127; border-radius: 9px; padding: 11px 16px; font-size: 12px; box-shadow: 0 12px 38px #0007; transition: .2s; }
#client-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
  .onboarding {
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }
  .connect-card {
    display: block;
    width: min(100%, 580px);
    min-height: calc(100dvh - 32px);
    border: 1px solid #30424c;
    border-radius: 28px;
    background: #111b21;
  }
  .connect-story { display: none; }
  .connect-form-panel {
    min-height: calc(100dvh - 34px);
    padding: clamp(38px, 8vh, 64px) 28px;
    border-radius: 27px;
    text-align: center;
  }
  .connect-form-panel > .step-label { align-self: center; }
  .phone-form { width: 100%; text-align: left; }
  html, body { overscroll-behavior: none; }
  .messenger { display: block; position: fixed; top: var(--app-top, 0px); right: 0; bottom: auto; left: 0; width: 100%; height: var(--app-height, 100dvh); min-height: 0; overflow: hidden; }
  /* Separate stacking contexts: a sidebar dock must never cover the open chat. */
  .chat-sidebar, .chat-stage { position: absolute; inset: 0; min-height: 0; isolation: isolate; }
  .chat-sidebar { z-index: 0; }
  .sidebar-top { padding: max(18px, env(safe-area-inset-top)) 17px 9px; }
  .sidebar-head { min-height: 51px; }
  .mini-brand img { width: 41px; height: 41px; }
  .mini-brand strong { font-size: 16px; }
  .header-action { width: 47px; height: 47px; }
  .sidebar-title { margin: 20px 0 16px; font-size: 33px; }
  .search-box { height: 49px; }
  .chat-item { min-height: 88px; padding-left: 17px; }
  .chat-item-body { height: 88px; padding-top: 15px; padding-right: 17px; }
  .avatar { width: 54px; height: 54px; }
  /* The dock itself paints the home-indicator area, without a second gap below. */
  .sidebar-nav { flex-shrink: 0; min-height: 0; margin-bottom: 0; padding: 6px 7px max(7px, env(safe-area-inset-bottom)); backdrop-filter: none; }
  .chat-stage { transform: translateX(100%); transition: transform .2s ease; z-index: 5; background: #080b0a; touch-action: pan-y; box-shadow: -12px 0 28px #0008; }
  .chat-stage.swiping { transition: none; }
  .messenger.chat-open .chat-stage { transform: translateX(0); }
  .conversation-head { min-height: calc(72px + env(safe-area-inset-top)); padding: max(12px, env(safe-area-inset-top)) 12px 10px; gap: 10px; }
  .back-button { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -4px; margin-right: 0; background: transparent; border: 0; color: #f4f5f4; }
  .back-button:hover { background: #ffffff0d; }
  .back-button .icon { width: 27px; height: 27px; stroke-width: 2.25; }
  .conversation-head .avatar.small { width: 48px; height: 48px; }
  .conversation-title strong { font-size: 18px; }
  .conversation-title small { display: none; }
  .conversation-actions { min-height: 48px; padding: 0 5px; border-radius: 26px; }
  .conversation-actions span { width: 39px; height: 43px; }
  .conversation-actions .icon { width: 24px; height: 24px; }
  .message-list { padding: 25px 14px 20px; }
  .message-row { margin: 6px 0; }
  .message-cluster { max-width: 94%; gap: 9px; }
  .message-stack { max-width: 94%; }
  .message-bubble { min-width: 82px; font-size: 17px; border-radius: 15px; padding: 11px 13px 8px; }
  .message-bubble.sticker-bubble { padding: 0; border-radius: 0; }
  .message-bubble.image-bubble { padding: 0; border-radius: 0; }
  .message-bubble.image-bubble .message-media { border-radius: 13px; }
  .message-bubble.sticker-bubble .sticker-media { width: 132px; height: 132px; }
  .message-bubble.deleted-placeholder-bubble { padding: 13px 14px 9px; gap: 11px; }
  .deleted-label { font-size: 13.5px; }
  .deleted-eye { width: 39px; height: 39px; background-size: 122px 122px; }
  .edit-history { width: 39px; height: 39px; }
  .edit-history .icon { width: 21px; height: 21px; }
  .date-chip { padding: 9px 25px; font-size: 14px; margin-bottom: 22px; }
  .message-meta { font-size: 11.5px; }
  .conversation-head { flex-shrink: 0; }
  .compose-bar { flex-shrink: 0; min-height: 0; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); gap: 8px; }
  /* Dialogs must remain above both footer controls and the conversation. */
  .group-gate { z-index: 1000; }
  .compose-faux { height: 50px; padding: 0 15px; font-size: 13px; }
  .compose-action { width: 38px; height: 42px; }
  .compose-action .icon { width: 27px; height: 27px; }
  .compose-plus .icon { width: 34px; height: 34px; }
  .compose-mic { width: 49px; height: 49px; }
  .group-gate { padding: 18px; }
  .group-gate-card { padding: 27px 22px 20px; border-radius: 23px; }
  .group-gate-card h2 { font-size: 21px; }
  #client-toast { width: calc(100% - 32px); text-align: center; bottom: 18px; }
}
@media (max-width: 390px) {
  .welcome-page { padding-left: 16px; padding-right: 16px; align-items: start; }
  .welcome-logo { width: 94px; height: 94px; border-radius: 27px; }
  .welcome-shell h1 { font-size: 30px; }
  .welcome-lead { font-size: 13px; margin-bottom: 19px; }
  .welcome-steps { padding-left: 14px; padding-right: 14px; }
  .welcome-steps > div { grid-template-columns: 25px 30px 1fr; min-height: 68px; gap: 8px; }
  .welcome-steps strong { font-size: 12.5px; }
  .welcome-start { min-height: 52px; }
  .onboarding {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }
  .connect-card {
    min-height: calc(100dvh - 24px);
    border: 1px solid #30424c;
    border-radius: 25px;
  }
  .connect-story { display: none; }
  .connect-form-panel {
    min-height: calc(100dvh - 26px);
    padding: 36px 20px;
    border-radius: 24px;
  }
  .phone-input { grid-template-columns: 150px 1fr; }
  .sidebar-top { padding-left: 14px; padding-right: 14px; }
  .sidebar-title { font-size: 31px; }
  .header-action { width: 44px; height: 44px; }
  .mini-brand img { width: 40px; height: 40px; }
  .chat-item { padding-left: 14px; }
  .chat-item-body { padding-left: 12px; padding-right: 14px; }
  .avatar { width: 51px; height: 51px; }
  .chat-line strong { font-size: 16px; }
  .chat-preview { font-size: 13.5px; }
  .sidebar-nav span { font-size: 8px; }
  .pair-code { gap: 5px; }
  .pair-code-group { gap: 4px; }
  .pair-character { height: 52px; border-radius: 10px; font-size: 22px; }
  .pair-separator { font-size: 22px; }
  .conversation-head { padding-left: 8px; padding-right: 9px; }
  .conversation-actions span { width: 36px; }
  .message-cluster { max-width: 97%; gap: 7px; }
  .message-stack { max-width: 97%; }
  .deleted-label { font-size: 13px; }
  .compose-faux span { display: none; }
  .compose-faux { min-width: 86px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
