/* Ventagram Web. Telegram's layout in the app's own colours. Light and dark by the system, or by a person's choice. */
:root {
  color-scheme: light dark;
  --primary: #1e96d6;
  --primary-strong: #0088cc;
  --primary-soft: rgba(30, 150, 214, 0.12);
  --on-primary: #ffffff;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --hover: rgba(112, 117, 121, 0.08);
  --active: #1e96d6;
  --active-text: #ffffff;
  --active-dim: rgba(255, 255, 255, 0.72);
  --text: #222222;
  --text-2: #5f6670;
  --text-3: #8d939b;
  --border: #e7e7e7;
  --chat-bg: #e6ebee;
  --bubble-in: #ffffff;
  --bubble-out: #effdde;
  --bubble-out-meta: #3c8a3b;
  --bubble-in-meta: #8d939b;
  --bubble-out-accent: #3c9e3b;
  --bubble-in-accent: #0088cc;
  --read: #3cb371;
  --good: #2e9e5b;
  --bad: #e53935;
  --bad-soft: rgba(229, 57, 53, 0.1);
  --warn-soft: #fff5d6;
  --warn-text: #7a5b00;
  --chip-bg: rgba(0, 0, 0, 0.32);
  --chip-text: #ffffff;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --bubble-radius: 15px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Armenian", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #5eb5f7;
    --primary-strong: #6ab2f2;
    --primary-soft: rgba(94, 181, 247, 0.16);
    --on-primary: #0e1621;
    --bg: #0e1621;
    --surface: #17212b;
    --surface-2: #242f3d;
    --hover: rgba(255, 255, 255, 0.05);
    --active: #2b5278;
    --active-text: #ffffff;
    --active-dim: rgba(255, 255, 255, 0.72);
    --text: #f5f5f5;
    --text-2: #8a9bb0;
    --text-3: #6d7f93;
    --border: #0e1621;
    --chat-bg: #0e1621;
    --bubble-in: #1e2c3a;
    --bubble-out: #2b5278;
    --bubble-out-meta: #b5c7da;
    --bubble-in-meta: #8a9bb0;
    --bubble-out-accent: #8cc8f5;
    --bubble-in-accent: #6ab2f2;
    --read: #8cc8f5;
    --good: #5fd08c;
    --warn-soft: #3a3115;
    --warn-text: #f0d68a;
    --chip-bg: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #5eb5f7;
  --primary-strong: #6ab2f2;
  --primary-soft: rgba(94, 181, 247, 0.16);
  --on-primary: #0e1621;
  --bg: #0e1621;
  --surface: #17212b;
  --surface-2: #242f3d;
  --hover: rgba(255, 255, 255, 0.05);
  --active: #2b5278;
  --active-text: #ffffff;
  --active-dim: rgba(255, 255, 255, 0.72);
  --text: #f5f5f5;
  --text-2: #8a9bb0;
  --text-3: #6d7f93;
  --border: #0e1621;
  --chat-bg: #0e1621;
  --bubble-in: #1e2c3a;
  --bubble-out: #2b5278;
  --bubble-out-meta: #b5c7da;
  --bubble-in-meta: #8a9bb0;
  --bubble-out-accent: #8cc8f5;
  --bubble-in-accent: #6ab2f2;
  --read: #8cc8f5;
  --good: #5fd08c;
  --warn-soft: #3a3115;
  --warn-text: #f0d68a;
  --chip-bg: rgba(255, 255, 255, 0.12);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.4);
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.35 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
[hidden] { display: none !important; }
.noscript { padding: 24px; text-align: center; }

.icon { width: 24px; height: 24px; fill: currentColor; flex: none; display: block; }
.icon.tiny { width: 16px; height: 16px; }
.icon.dim { color: var(--text-3); }
.icon.accent { color: var(--primary); }
.icon.official { color: #e2a516; }
.icon.read { color: var(--read); }
.icon.bad { color: var(--bad); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.good { color: var(--good); }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.center { text-align: center; }
.center-text { text-align: center; align-items: center; }
.accent-text { color: var(--primary-strong); }
.bad-text { color: var(--bad); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 15px; transition: background 0.15s, opacity 0.15s, transform 0.1s; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn.ghost { background: var(--surface-2); color: var(--primary-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--primary-soft); }
.btn.ghost.bad-text { color: var(--bad); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.wide { width: 100%; }
.btn.small { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text-2); flex: none; transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.link-btn { color: var(--primary-strong); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.link-btn.active { color: var(--text); font-weight: 600; }
.link-btn.bad { color: var(--bad); }
.chip { padding: 5px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-strong); font-size: 13px; font-weight: 600; white-space: nowrap; flex: none; }
.field { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); outline: none; transition: border 0.15s; }
textarea.field { height: auto; padding: 10px 14px; resize: none; }
select.field.small { width: auto; max-width: 56%; height: 34px; padding: 0 8px; border-radius: 9px; font-size: 13.5px; }
.field:focus { border-color: var(--primary); }
.field.code { text-align: center; font-size: 22px; letter-spacing: 6px; font-variant-numeric: tabular-nums; }
.field-error { color: var(--bad); font-size: 13.5px; min-height: 18px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
.spinner.small { width: 20px; height: 20px; border-width: 2px; }
.spinner.light { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-icon { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary-strong); }
.big-icon .icon { width: 36px; height: 36px; }

/* ------------------------------------------------------------------ sign in */
.login-page { height: 100%; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--surface-2); }
.login-card { width: 100%; max-width: 620px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-s); padding: 28px; display: flex; flex-direction: column; gap: 16px; margin: auto; }
.login-card.center { text-align: center; align-items: center; max-width: 420px; }
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }
.login-grid { display: grid; grid-template-columns: 230px 1fr; gap: 24px; align-items: center; }
.login-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.login-steps { margin: 0; padding-left: 22px; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; }
.login-text { color: var(--text-2); line-height: 1.45; }
.login-text.small { font-size: 13px; }
.qr-box { width: 230px; aspect-ratio: 1; border-radius: 16px; background: #ffffff; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--border); }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-center { display: flex; justify-content: center; }
.qr-left { color: var(--text-3); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.qr-link { display: flex; flex-direction: column; gap: 6px; }
.qr-link:empty { display: none; }
.qr-link-label { font-size: 13px; color: var(--text-2); }
.qr-link-row { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 10px; padding: 3px 3px 3px 12px; }
.qr-link-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px var(--mono); color: var(--text-2); }
.login-langs { display: flex; gap: 16px; justify-content: center; font-size: 13.5px; flex-wrap: wrap; }
.login-sms { font-size: 13.5px; color: var(--text-2); text-align: center; min-height: 18px; }
.notice { padding: 10px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-strong); font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn-text); }

/* ------------------------------------------------------------------ the two columns */
.app { height: 100%; display: grid; grid-template-columns: minmax(300px, 420px) 1fr; }
.sidebar { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border-right: 1px solid var(--border); }
.main { min-width: 0; min-height: 0; display: flex; background: var(--chat-bg); }
.side-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex: none; }
.search-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 20px; background: var(--surface-2); color: var(--text-3); border: 1px solid transparent; transition: border 0.15s, background 0.15s; }
.search-box:focus-within { background: var(--surface); border-color: var(--primary); color: var(--primary); }
.search-box .icon { width: 20px; height: 20px; }
.search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-input::-webkit-search-cancel-button { cursor: pointer; }
.conn-state { padding: 4px 16px 8px; font-size: 13px; color: var(--text-3); text-align: center; flex: none; }
.e2e-banner { display: flex; gap: 10px; margin: 0 12px 8px; padding: 10px 12px; border-radius: 12px; background: var(--primary-soft); color: var(--text); font-size: 13.5px; flex: none; }
.e2e-banner .icon { width: 20px; height: 20px; color: var(--primary-strong); }
.e2e-banner.warn { background: var(--warn-soft); color: var(--warn-text); }
.e2e-banner.warn .icon { color: var(--warn-text); }
.e2e-banner-body { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.folders { display: flex; gap: 2px; padding: 0 8px; overflow-x: auto; flex: none; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.folders::-webkit-scrollbar { display: none; }
.folder { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; color: var(--text-2); font-weight: 500; white-space: nowrap; border-radius: 10px 10px 0 0; }
.folder:hover { background: var(--hover); }
.folder.active { color: var(--primary-strong); }
.folder.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.chat-rows { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 8px; }
.section-title { padding: 10px 10px 6px; color: var(--text-3); font-size: 13px; font-weight: 600; }
.chat-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; text-align: left; transition: background 0.12s; }
.chat-row:hover { background: var(--hover); }
.chat-row.active { background: var(--active); color: var(--active-text); }
.chat-row.active .chat-time, .chat-row.active .chat-preview, .chat-row.active .icon.dim { color: var(--active-dim); }
.chat-row.active .icon.read { color: var(--active-text); }
.chat-row.active .badge { background: var(--active-text); color: var(--active); }
.chat-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-top, .chat-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-weight: 600; }
.chat-time { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: var(--text-3); flex: none; }
.chat-preview { flex: 1; color: var(--text-2); font-size: 14px; }
.typing-text { color: var(--primary-strong); }
.chat-row.active .typing-text { color: var(--active-text); }
.badge { min-width: 22px; height: 22px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; background: var(--primary); color: var(--on-primary); font-size: 12.5px; font-weight: 600; flex: none; }
.badge.muted { background: var(--text-3); color: var(--surface); }
.badge.mention { background: var(--primary); }
.badge.small { min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
.list-empty { padding: 32px 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; color: var(--text-2); }
.list-empty h3 { color: var(--text); font-size: 17px; }

.avatar { position: relative; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; flex: none; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xs { width: 34px; height: 34px; font-size: 13px; }
.avatar.sm { width: 42px; height: 42px; font-size: 15px; }
.avatar.md { width: 52px; height: 52px; font-size: 18px; }
.avatar.lg { width: 60px; height: 60px; font-size: 21px; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }
.avatar.back { background: var(--surface-2); color: var(--text-2); }
.info-avatar { display: flex; justify-content: center; }
.skeleton { pointer-events: none; }
.shimmer { background: linear-gradient(90deg, var(--surface-2) 25%, var(--hover) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 12px; border-radius: 6px; width: 55%; }
.sk-line.wide { width: 80%; }

/* ------------------------------------------------------------------ the chat */
.main-empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.main-empty.inner { flex: none; padding: 32px 16px; }
.main-empty-chip { padding: 6px 14px; border-radius: 16px; background: var(--chip-bg); color: var(--chip-text); font-size: 14px; text-align: center; }
.chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chat-pane.dropping::after { content: ""; position: absolute; inset: 8px; border: 2px dashed var(--primary); border-radius: 16px; pointer-events: none; background: var(--primary-soft); }
.chat-head { display: flex; align-items: center; gap: 4px; height: 58px; padding: 0 8px 0 12px; background: var(--surface); box-shadow: var(--shadow-s); z-index: 3; flex: none; }
.back-btn { display: none; }
.head-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px; border-radius: 10px; text-align: left; }
.head-text { min-width: 0; flex: 1; }
.head-name { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 4px; }
.head-sub { font-size: 13.5px; color: var(--text-2); min-height: 18px; }
.head-sub.online { color: var(--primary-strong); }
.messages-wrap { flex: 1; min-height: 0; position: relative; display: flex; }
.messages { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 12px max(12px, calc((100% - 760px) / 2)) 8px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.msg-loading { display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; padding: 40px 16px; flex: 1; color: var(--text-2); text-align: center; }
.msg-loading.small { flex: none; padding: 8px; }
.date-sep, .sys-line, .unread-sep { display: flex; justify-content: center; margin: 10px 0; flex: none; }
.date-sep span, .sys-line span { padding: 3px 12px; border-radius: 12px; background: var(--chip-bg); color: var(--chip-text); font-size: 13px; font-weight: 500; text-align: center; display: inline-flex; align-items: center; gap: 4px; max-width: 85%; }
.date-sep { position: sticky; top: 0; z-index: 1; }
.bubble-text a.bot-command { color: var(--bubble-in-accent); text-decoration: none; }
.bubble-text a.bot-command:hover { text-decoration: underline; }
/* A chat background: kept still under the messages, the chips get a firmer backing so they read on any picture. */
.messages-wrap.has-bg { background-size: cover; background-position: center; background-repeat: no-repeat; }
.messages-wrap.has-bg .date-sep span, .messages-wrap.has-bg .sys-line span, .messages-wrap.has-bg .unread-sep span { background: rgba(0, 0, 0, 0.45); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.unread-sep { background: var(--surface); margin-left: calc(-1 * max(12px, calc((100% - 760px) / 2))); margin-right: calc(-1 * max(12px, calc((100% - 760px) / 2))); padding: 3px; color: var(--primary-strong); font-size: 13px; font-weight: 500; }

.msg-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; position: relative; flex: none; }
.msg-row.same-prev { margin-top: 2px; }
.msg-row.out { flex-direction: row-reverse; }
.msg-row.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 30% { filter: brightness(0.82); } }
.msg-col { display: flex; flex-direction: column; gap: 3px; max-width: min(78%, 560px); min-width: 0; }
.msg-row.out .msg-col { align-items: flex-end; }
.msg-avatar { width: 34px; flex: none; }
.msg-row.same-next .msg-avatar { visibility: hidden; }
.bubble { position: relative; background: var(--bubble-in); padding: 6px 10px 5px; border-radius: var(--bubble-radius); box-shadow: var(--shadow-s); min-width: 76px; max-width: 100%; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-row.in .bubble { border-bottom-left-radius: 5px; }
.msg-row.out .bubble { background: var(--bubble-out); border-bottom-right-radius: 5px; }
.msg-row.same-next.in .bubble { border-bottom-left-radius: var(--bubble-radius); }
.msg-row.same-next.out .bubble { border-bottom-right-radius: var(--bubble-radius); }
.msg-row.same-prev.in .bubble { border-top-left-radius: 5px; }
.msg-row.same-prev.out .bubble { border-top-right-radius: 5px; }
.bubble.failed { outline: 1px solid var(--bad); }
.bubble-name { font-weight: 600; font-size: 14px; margin-bottom: 1px; }
.msg-row.same-prev .bubble-name { display: none; }
.bubble-fwd { font-size: 13px; font-weight: 500; color: var(--bubble-in-accent); margin-bottom: 3px; }
.msg-row.out .bubble-fwd { color: var(--bubble-out-accent); }
.bubble-text { white-space: pre-wrap; line-height: 1.38; }
.bubble-text.muted { font-style: italic; }
.bubble-text a { color: var(--bubble-in-accent); text-decoration: underline; }
.msg-row.out .bubble-text a { color: var(--bubble-out-accent); }
.bubble-text code { font-family: var(--mono); font-size: 13.5px; background: var(--hover); padding: 0 4px; border-radius: 4px; }
.bubble-text .b { font-weight: 700; }
.bubble-text .i { font-style: italic; }
.bubble-text .u { text-decoration: underline; }
.bubble-text .s { text-decoration: line-through; }
.bubble-text .spoiler { background: var(--text-3); color: transparent; border-radius: 4px; transition: color 0.2s, background 0.2s; }
.bubble-text .spoiler:hover { background: transparent; color: inherit; }
.bubble-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; float: right; margin: 5px 0 -2px 10px; font-size: 11.5px; color: var(--bubble-in-meta); white-space: nowrap; user-select: none; }
.msg-row.out .bubble-meta { color: var(--bubble-out-meta); }
.msg-row.out .bubble-meta .status.read { color: var(--read); }
.bubble-meta .edited { font-style: italic; }
.bubble::after { content: ""; display: block; clear: both; }
.msg-more { align-self: center; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-3); background: var(--surface); box-shadow: var(--shadow-s); opacity: 0; transition: opacity 0.12s; flex: none; }
.msg-more .icon { width: 16px; height: 16px; }
@media (hover: hover) { .msg-row:hover .msg-more { opacity: 1; } .msg-more:focus-visible { opacity: 1; } }
.msg-row.post .msg-col { max-width: min(92%, 620px); }

.reply-quote { display: block; width: 100%; text-align: left; border-left: 3px solid var(--quote, var(--primary)); padding: 2px 8px; margin: 2px 0 4px; border-radius: 4px; background: var(--hover); min-width: 0; }
.reply-name { font-weight: 600; font-size: 13.5px; color: var(--quote, var(--primary)); }
.reply-text { font-size: 13.5px; color: var(--text-2); }
.closed-msg { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0; max-width: 340px; }
.closed-msg .icon { width: 20px; height: 20px; color: var(--text-3); margin-top: 1px; }
.closed-title { font-weight: 600; font-size: 14px; }
.closed-why { font-size: 13px; color: var(--text-2); }
.note-chip { padding: 6px 10px; border-radius: 10px; background: var(--hover); font-size: 13.5px; margin: 2px 0; display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.reaction { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--primary-soft); font-size: 14px; transition: background 0.12s, transform 0.1s; }
.reaction:active { transform: scale(0.94); }
.reaction .n { font-size: 12.5px; font-weight: 600; color: var(--primary-strong); }
.reaction.mine { background: var(--primary); }
.reaction.mine .n { color: var(--on-primary); }
.inline-kb, .reply-kb { display: flex; flex-direction: column; gap: 3px; }
.reply-kb:empty { display: none; }
.reply-kb { padding: 6px 0; }
.inline-row { display: flex; gap: 3px; }
.inline-btn { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 9px; background: var(--chip-bg); color: var(--chip-text); font-size: 14px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 4px; transition: opacity 0.12s; }
.inline-btn:hover { opacity: 0.85; }
.inline-btn.busy { opacity: 0.55; }
.reply-kb .inline-btn { background: var(--surface-2); color: var(--text); }

.media-box { margin: -2px -6px 4px; border-radius: 11px; overflow: hidden; position: relative; }
.media-box.image, .media-box.video { min-width: 220px; max-width: 420px; background: var(--hover); }
.media-box.file { margin: 0 0 2px; }
.media-open { display: block; width: 100%; }
.media-box img, .media-box video { display: block; width: 100%; max-height: 460px; object-fit: contain; }
.media-wait { display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; min-height: 150px; color: var(--text-2); width: 100%; padding: 12px; text-align: center; }
.media-wait.big .icon { width: 40px; height: 40px; }
.upload-state { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; }
.audio .upload-state, .media-box.file .upload-state { position: static; display: inline-block; margin-top: 4px; background: var(--hover); color: var(--text-2); }
.sticker { display: block; width: 180px; max-width: 100%; height: auto; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 4px; width: 100%; text-align: left; border-radius: 10px; min-width: 200px; }
.file-row.action:hover { background: var(--hover); }
.file-row.busy { opacity: 0.6; }
.file-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); flex: none; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 500; }
.file-size { font-size: 12.5px; color: var(--text-2); }
.audio { display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 2px 0 4px; }
.audio-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; flex: none; }
.audio-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.audio-bar { width: 100%; height: 4px; margin: 6px 0; accent-color: var(--primary); }
.audio-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.poll { display: flex; flex-direction: column; gap: 6px; min-width: 240px; padding: 2px 0; }
.poll-q { font-weight: 600; }
.poll-opt { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--hover); overflow: hidden; text-align: left; }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary-soft); }
.poll-text, .poll-n { position: relative; }
.poll-n { font-size: 13px; color: var(--text-2); }
.to-bottom { position: absolute; right: 16px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.to-bottom-badge { position: absolute; top: -6px; right: -2px; }

.bubble.media-only { padding: 3px; }
.bubble.media-only .media-box { margin: 0; border-radius: 12px; }
.bubble.media-only .bubble-meta { position: absolute; right: 9px; bottom: 9px; float: none; margin: 0; padding: 1px 7px; border-radius: 9px; background: rgba(0, 0, 0, 0.5); color: #fff; }
.msg-row.out .bubble.media-only .bubble-meta { color: #fff; }
.bubble.sticker-only { background: transparent !important; box-shadow: none; }
.notme-btn { margin-top: 6px; }

/* ------------------------------------------------------------------ the field to write in */
.composer-host { flex: none; padding: 6px max(12px, calc((100% - 760px) / 2)) max(10px, env(safe-area-inset-bottom)); }
.composer { display: flex; align-items: flex-end; gap: 4px; background: var(--surface); border-radius: 16px; padding: 3px 4px 3px 4px; box-shadow: var(--shadow-s); }
.composer-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; padding: 9px 6px; max-height: 180px; line-height: 1.35; }
.send-btn { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); flex: none; transition: background 0.12s, transform 0.1s; }
.send-btn:hover { background: var(--primary-strong); }
.send-btn:active { transform: scale(0.94); }
.send-btn .icon { width: 22px; height: 22px; }
.composer .chip { align-self: center; }
.composer-bar:empty { display: none; }
.composer-bar { margin-bottom: 4px; }
.bar-box { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-s); }
.bar-body { flex: 1; min-width: 0; border-left: 2px solid var(--primary); padding-left: 8px; }
.bar-title { color: var(--primary-strong); font-weight: 600; font-size: 13.5px; }
.bar-text { color: var(--text-2); font-size: 13.5px; }
.composer-note { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; text-align: center; padding: 12px 14px; border-radius: 14px; background: var(--surface); color: var(--text-2); font-size: 14px; box-shadow: var(--shadow-s); }

/* ------------------------------------------------------------------ over the page */
.modal-back, .menu-back { position: fixed; inset: 0; z-index: 50; }
.modal-back { display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.42); animation: fade 0.16s ease; }
.modal { width: 100%; max-width: 420px; max-height: calc(100% - 16px); overflow-y: auto; background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); animation: rise 0.18s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px) scale(0.98); } }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-text { color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal.viewer { max-width: min(96vw, 1200px); background: transparent; box-shadow: none; padding: 0; }
.viewer-btn { display: block; width: 100%; cursor: zoom-out; }
.viewer-btn img { display: block; max-width: 100%; max-height: 92vh; margin: 0 auto; object-fit: contain; border-radius: 8px; }
.menu-profile { display: flex; align-items: center; gap: 12px; }
.menu-name { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.menu-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.menu-row > .icon { color: var(--text-2); }
.menu-row > .muted { text-align: right; max-width: 55%; }
.menu-link { width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 10px; }
.menu-link:hover { background: var(--hover); }
.file-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.file-prev img { display: block; max-width: 100%; max-height: 260px; margin: 0 auto; border-radius: 10px; }
.menu { position: fixed; min-width: 210px; max-width: min(94vw, 340px); max-height: min(80vh, 420px); overflow-y: auto; padding: 6px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); animation: pop 0.12s ease; }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.menu-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; text-align: left; font-size: 14.5px; }
.menu-item:hover { background: var(--hover); }
.menu-item .icon { width: 20px; height: 20px; color: var(--text-2); }
.menu-item.danger, .menu-item.danger .icon { color: var(--bad); }
.react-bar { display: flex; gap: 2px; padding: 2px 2px 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.react-btn { width: 34px; height: 34px; border-radius: 50%; font-size: 19px; transition: transform 0.1s, background 0.1s; }
.react-btn:hover { background: var(--hover); transform: scale(1.12); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: 300px; max-width: 100%; }
.emoji-btn { aspect-ratio: 1; border-radius: 8px; font-size: 20px; }
.emoji-btn:hover { background: var(--hover); }
.toasts { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 10px 14px; border-radius: 12px; background: rgba(20, 28, 36, 0.92); color: #fff; font-size: 14px; box-shadow: var(--shadow); text-align: center; animation: drop 0.2s ease; transition: opacity 0.2s; }
.toast.out { opacity: 0; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
.toast.bad { background: #b3261e; }

/* ------------------------------------------------------------------ a phone */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .main { display: none; }
  .app.chat-open .sidebar { display: none; }
  .app.chat-open .main { display: flex; }
  .sidebar { border-right: 0; }
  .back-btn { display: inline-flex; }
  .chat-head { padding: 0 4px; }
  .msg-col { max-width: 86%; }
  .login-grid { grid-template-columns: 1fr; justify-items: center; }
  .login-side { width: 100%; }
  .qr-box { width: min(230px, 70vw); }
  .login-card { padding: 20px; }
  .login-card h1 { font-size: 20px; }
  .modal { max-width: 100%; }
}
@media (max-width: 360px) {
  .msg-col { max-width: 90%; }
  .media-box.image, .media-box.video { min-width: 180px; }
  .audio, .poll { min-width: 190px; }
  .file-row { min-width: 170px; }
  .avatar.md { width: 46px; height: 46px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Sign-in: the flag next to the country, and the new person's photo. */
.phone-country { display: flex; align-items: center; gap: 10px; }
.phone-country .field { flex: 1; min-width: 0; }
.phone-country.bad .field { border-color: var(--bad); color: var(--bad); }
.phone-flag { font-size: 26px; line-height: 1; }
.signup-photo { align-self: center; width: 96px; height: 96px; border-radius: 50%; border: 1px dashed var(--line, currentColor); background: transparent; color: inherit; cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 0; }
.signup-photo img { width: 100%; height: 100%; object-fit: cover; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
