/* node-4 Chat: the look of docs/mockups (desktop.html, mobile.html). Golos Text — SIL OFL 1.1. */
@font-face { font-family: 'Golos Text'; font-weight: 400 700; font-display: swap; src: url(fonts/golos-text-400-700-cyrillic.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-weight: 400 700; font-display: swap; src: url(fonts/golos-text-400-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f4f6fa; --panel: #ffffff; --line: #e3e7ee; --ink: #121826; --muted: #5b6474; --faint: #8b93a1;
  --accent: #2563eb; --accent-ink: #fff; --accent-soft: #e8efff; --mine: #2563eb; --mine-ink: #fff; --theirs: #ffffff;
  --hover: #f0f3f8; --ok: #16a34a; --warn: #b45309; --danger: #dc2626; --badge: #e5484d; --read: #bfe3ff;
  --shadow: 0 10px 30px rgba(15, 23, 42, .16);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131b; --panel: #151b25; --line: #253041; --ink: #e8edf5; --muted: #a3adbd; --faint: #7c8696;
    --accent: #4f86ff; --accent-soft: #1c2a45; --mine: #2f6bf0; --theirs: #1b2330; --hover: #1b2330;
    --ok: #34c06a; --warn: #f0b04a; --danger: #f26b6b; --read: #bfe3ff; --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131b; --panel: #151b25; --line: #253041; --ink: #e8edf5; --muted: #a3adbd; --faint: #7c8696;
  --accent: #4f86ff; --accent-soft: #1c2a45; --mine: #2f6bf0; --theirs: #1b2330; --hover: #1b2330;
  --ok: #34c06a; --warn: #f0b04a; --danger: #f26b6b; --read: #bfe3ff; --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 14px/1.4 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.noscript { padding: 24px; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: -.5px; flex: none; }
.logo.big { width: 64px; height: 64px; border-radius: 18px; font-size: 24px; }

/* Buttons and fields */
.btn { height: 40px; padding: 0 18px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--hover); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.wide { width: 100%; height: 46px; border-radius: 12px; }
.link { color: var(--accent); font-weight: 600; padding: 6px 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.input { height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--panel); outline: 0; width: 100%; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.code-input { letter-spacing: .5em; font-size: 20px; text-align: center; font-weight: 600; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }
.hint { color: var(--muted); font-size: 13px; }
.ib { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); flex: none; }
.ib:hover { background: var(--hover); color: var(--ink); }
.ib.accent { color: var(--accent); }

/* Sign-in */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; overflow: auto; }
.card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card h1 { font-size: 22px; }
.card .head { display: flex; align-items: center; gap: 12px; }
.card .head small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.card .row2 { display: flex; justify-content: space-between; align-items: center; }
.secure { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12.5px; }
.secure svg.i { color: var(--ok); width: 16px; height: 16px; margin-top: 1px; }

/* The app */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 68px 336px minmax(0, 1fr) auto; }
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; }
.rail .logo { margin-bottom: 14px; }
.ri { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); position: relative; }
.ri:hover { background: var(--hover); }
.ri.on { background: var(--accent-soft); color: var(--accent); }
.badge { position: absolute; top: 4px; right: 3px; background: var(--badge); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 9px; padding: 1px 5px; line-height: 1.35; }
.grow { flex: 1; }
/* The state of the network after «Чаты»: green while connected, grey otherwise. */
.net { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 8px; vertical-align: middle; background: var(--faint); }
.net.online { background: var(--ok); }

.list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.lh { padding: 18px 16px 10px; display: flex; align-items: center; gap: 8px; }
.lh h1 { font-size: 20px; flex: 1; }
.search { margin: 0 16px 10px; height: 38px; border-radius: 10px; background: var(--hover); display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--faint); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); height: 100%; }
.tabs { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { font-size: 12.5px; padding: 5px 9px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tab.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.scroll { overflow-y: auto; min-height: 0; flex: 1; overscroll-behavior: contain; }
.notice { margin: 0 16px 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.notice b { color: var(--accent); }
.notice .grow { min-width: 0; }
/* Ready for calls: a step a line, ✓ when done. */
.ready { display: flex; flex-direction: column; gap: 4px; }
.ready-step { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ready-step:last-of-type { border-bottom: 0; }
.ready-step .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ready-step small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.ready-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; }
.ready-step.ok .ready-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.ready-mark svg.i { width: 14px; height: 14px; stroke-width: 3; }
.ready-step .btn { flex: none; }
.ready-phone { margin-top: 6px; font-size: 12.5px; line-height: 1.45; }

.chat { display: flex; gap: 12px; padding: 10px 16px; align-items: center; cursor: pointer; width: 100%; text-align: left; }
.chat:hover { background: var(--hover); }
.chat.on { background: var(--accent-soft); }
.chat-item { position: relative; overflow: hidden; isolation: isolate; }
.chat-slide { position: relative; background: var(--panel); display: flex; touch-action: pan-y; transition: transform .18s ease; }
.chat-slide .chat { padding-right: 48px; min-height: 68px; }
.chat-item.swiping .chat-slide { transition: none; }
.chat-menu-button { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); }
.chat-actions { position: absolute; inset: 0 0 0 auto; width: 152px; display: flex; pointer-events: none; visibility: hidden; }
.actions-open .chat-actions, .swiping .chat-actions { pointer-events: auto; visibility: visible; }
.chat-actions button { width: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: #fff; }
.chat-clear { background: #586985; }
.chat-delete { background: #ce3038; }
.chat-actions button:hover { filter: brightness(1.12); }
.chat-actions svg.i { width: 24px; height: 24px; }
.chat-slide:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px; flex: none; position: relative; user-select: none; }
.av.sm { width: 32px; height: 32px; font-size: 12px; }
.av.md { width: 38px; height: 38px; font-size: 13px; }
.av.lg { width: 72px; height: 72px; font-size: 22px; }
.av .dot { position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--panel); }
.av.sm .dot { width: 10px; height: 10px; right: -1px; bottom: -1px; }
.cm { flex: 1; min-width: 0; }
.cm .t { display: flex; gap: 6px; align-items: center; }
.cm .t b { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm .t span { font-size: 12px; color: var(--faint); flex: none; }
.cm .s { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin-top: 2px; }
.cm .s em { font-style: normal; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm .s em.typing { color: var(--accent); }
.cnt { background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 10px; padding: 1px 7px; flex: none; }
.cnt.mute { background: var(--faint); }
.st { display: inline-flex; align-items: center; flex: none; }
.st svg.i { width: 16px; height: 16px; }
.st.read { color: var(--accent); }
.st.failed { color: var(--danger); }
.empty-list { padding: 32px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.sres { padding: 8px 16px; cursor: pointer; display: block; width: 100%; text-align: left; }
.sres:hover { background: var(--hover); }
.sres small { color: var(--faint); display: block; font-size: 12px; }
.sres span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 10px 16px 6px; }

/* A conversation */
.conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.ch { height: 64px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 12px 0 18px; flex: none; }
.ch .cm { cursor: pointer; }
.ch .cm b { font-size: 15.5px; }
.ch .back { display: none; }
.e2e { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-size: 12.5px; white-space: nowrap; }
.e2e svg.i { width: 13px; height: 13px; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 28px 8px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.msgs .spacer { flex: 1; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin: 8px 0; }
.sys { align-self: center; font-size: 12.5px; color: var(--muted); text-align: center; max-width: 80%; }
.row { display: flex; gap: 10px; align-items: flex-end; max-width: min(72%, 640px); }
.row.mine { align-self: flex-end; flex-direction: row-reverse; }
.row.cont .av { visibility: hidden; }
.row.flash .bub { animation: flash 1.2s; }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 16px; }
.msg-check { display: none; width: 21px; height: 21px; flex: none; align-self: center; border: 2px solid var(--faint); border-radius: 50%; color: transparent; }
.msg-check svg.i { width: 17px; height: 17px; stroke-width: 3; }
.selecting .msg-check { display: grid; place-items: center; }
.selecting .row { cursor: pointer; }
.selecting .bub { user-select: none; }
.selected .msg-check { color: #fff; background: var(--accent); border-color: var(--accent); }
.selected .bub { box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px var(--accent-soft); }
.selecting .more { display: none !important; }
.selection-count { flex: 1; font-size: 15px; }
.selection-top .ib { color: var(--accent); }
.selection-top .ib:last-child { color: var(--danger); }
.selection-top .ib:disabled, .selection-action:disabled { opacity: .4; cursor: default; }
.selection-bottom { min-height: 50px; display: flex; justify-content: center; gap: 24px; align-items: center; }
.selection-action { color: var(--accent); display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.selection-action:hover:not(:disabled) { background: var(--accent-soft); }
.delete-option { display: flex; gap: 9px; align-items: center; padding: 12px 0; }
.delete-option input { width: 18px; height: 18px; accent-color: var(--accent); }
.clipboard-helper { position: fixed; top: 0; left: -9999px; width: 1px; height: 1px; }
.forward-dialog { display: flex; flex-direction: column; gap: 12px; }
.forward-list { max-height: min(45vh, 360px); overflow-y: auto; }
.forward-target { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 8px; text-align: left; border-radius: 10px; }
.forward-target:hover { background: var(--hover); }
.forward-target > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.forward-target > svg.i { color: var(--accent); }
.forward-target:disabled { opacity: .5; cursor: default; }
.forward-dialog summary { color: var(--accent); cursor: pointer; margin-bottom: 10px; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
.bub { background: var(--theirs); border: 1px solid var(--line); border-radius: 16px 16px 16px 6px; padding: 7px 12px 5px; position: relative; min-width: 64px; max-width: 100%; overflow-wrap: anywhere; }
/* On a touch screen a long press opens the menu of the message (with «Копировать»), not a text selection. */
@media (hover: none) { .bub { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.mine .bub { background: var(--mine); color: var(--mine-ink); border-color: var(--mine); border-radius: 16px 16px 6px 16px; }
.mine .bub a { color: #fff; }
.text { white-space: pre-wrap; }
.who { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; display: flex; gap: 4px; justify-content: flex-end; align-items: center; user-select: none; }
.mine .meta { color: rgba(255, 255, 255, .78); }
.mine .meta .st.delivered { opacity: .6; }
.mine .meta .st.read { color: var(--read); }
.mine .meta .st.failed { color: #ffd2d2; cursor: pointer; }
.meta .warn { color: var(--warn); }
.quote { border-left: 3px solid var(--accent); padding: 2px 8px; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); cursor: pointer; border-radius: 2px; }
.quote b { display: block; color: var(--accent); font-weight: 600; }
.quote span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.mine .quote { border-left-color: rgba(255, 255, 255, .75); color: rgba(255, 255, 255, .88); }
.mine .quote b { color: #fff; }
.deleted { font-style: italic; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.mine .deleted { color: rgba(255, 255, 255, .8); }
.deleted svg.i { width: 15px; height: 15px; }
.file { display: flex; gap: 10px; align-items: center; margin: 2px 0; text-decoration: none; color: inherit; min-width: 200px; }
.fi { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.mine .fi { background: rgba(255, 255, 255, .18); color: #fff; }
.file small { display: block; font-size: 12.5px; color: var(--muted); }
.mine .file small { color: rgba(255, 255, 255, .8); }
.file b { display: block; word-break: break-all; }
.pic { display: block; max-width: min(320px, 100%); max-height: 320px; border-radius: 10px; margin: 4px 0 2px; cursor: zoom-in; background: var(--hover); }
.pic-ph { width: 260px; height: 150px; border-radius: 10px; margin: 4px 0 2px; background: linear-gradient(135deg, #9aa7b8, #5f6f84); display: grid; place-items: center; color: #fff; font-size: 12px; text-align: center; padding: 8px; }
.vid { position: relative; display: block; width: min(320px, 100%); border-radius: 10px; overflow: hidden; margin: 4px 0 2px; background: #000; cursor: pointer; }
.vid video { display: block; width: 100%; max-height: 320px; object-fit: contain; pointer-events: none; }
.vid-play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.vid-play svg.i { width: 24px; height: 24px; margin-left: 3px; stroke: none; }
.vid-dur { position: absolute; left: 8px; bottom: 8px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.vid-dur:empty { display: none; }
.vid-dl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); text-decoration: none; margin: 2px 0; max-width: min(320px, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-dl svg.i { width: 15px; height: 15px; flex: none; }
.mine .vid-dl { color: rgba(255, 255, 255, .85); }
.aud audio { display: block; width: min(300px, 70vw); margin: 4px 0 2px; }
/* A voice message: ▶, the outline of its sound, its length, «В текст» and the text. */
.voice { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 10px; align-items: center; width: min(300px, 68vw); padding: 4px 0 2px; }
.vplay { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.vplay:disabled { opacity: .5; }
.vplay svg.i { width: 18px; height: 18px; }
.mine .vplay { background: #fff; color: var(--mine); }
.vwave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.vwave i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: color-mix(in srgb, currentColor 30%, transparent); }
.vwave i.on { background: var(--accent); }
.mine .vwave i.on { background: #fff; }
.vrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; font-size: 12px; opacity: .85; }
.vtotext { font-size: 12px; font-weight: 600; color: var(--accent); padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); }
.mine .vtotext { color: #fff; background: rgba(255, 255, 255, .2); }
.vtotext[hidden] { display: none; }
.vtext { grid-column: 1 / -1; margin-top: 6px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.vtext[hidden] { display: none; }
.vtext.busy, .vtext.err { opacity: .75; font-style: italic; }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reac { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; border-radius: 999px; padding: 1px 8px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.reac.on { box-shadow: inset 0 0 0 1.5px var(--accent); }
.mine .reac { background: rgba(255, 255, 255, .2); color: #fff; }
.typing-line { color: var(--muted); font-size: 12.5px; padding: 0 28px 4px; min-height: 22px; }
.more { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 8px; display: none; place-items: center; background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.mine .more { right: auto; left: -32px; top: 50%; transform: translateY(-50%); }
.row:not(.mine) .more { right: -32px; top: 50%; transform: translateY(-50%); }
@media (hover: hover) { .row:hover .more { display: grid; } }
.down { position: absolute; right: 24px; bottom: 96px; width: 42px; height: 42px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--muted); }
.down .cnt { position: absolute; top: -6px; right: -4px; }
.drop { position: absolute; inset: 0; background: rgba(37, 99, 235, .12); border: 3px dashed var(--accent); display: grid; place-items: center; font-weight: 600; color: var(--accent); font-size: 18px; z-index: 5; pointer-events: none; }

.comp-wrap { padding: 0 20px 18px; flex: none; }
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; font-size: 13px; }
.bar svg.i { color: var(--accent); }
.bar .cm b { color: var(--accent); font-size: 13px; }
.bar .cm span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.bar + .comp { border-radius: 0 0 14px 14px; }
.files-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
.files-bar + .comp, .files-bar + .bar { border-radius: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--hover); border-radius: 8px; padding: 4px 6px 4px 10px; font-size: 12.5px; max-width: 240px; }
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip button { width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; }
.comp { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px; }
.comp textarea { flex: 1; border: 0; outline: 0; background: none; resize: none; max-height: 180px; min-height: 36px; padding: 7px 4px; line-height: 22px; }
.send { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { opacity: .5; }
.send[hidden] { display: none; }
/* Recording a voice message in place of the composer. */
.recbar { align-items: center; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; animation: recpulse 1s ease-in-out infinite; }
@keyframes recpulse { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; min-width: 40px; }
.rec-wave { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 2px; height: 28px; overflow: hidden; color: var(--accent); }
.rec-wave i { width: 3px; flex: none; border-radius: 2px; background: currentColor; }
.readonly { padding: 14px 20px 20px; text-align: center; color: var(--muted); }

.empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.empty > div { display: flex; flex-direction: column; gap: 10px; align-items: center; max-width: 380px; }
.empty .logo { margin-bottom: 6px; }
.empty h2 { color: var(--ink); font-size: 18px; }

/* The info panel */
.side { width: 300px; background: var(--panel); border-left: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; }
.side .top { text-align: center; position: relative; }
.side .top .av { margin: 6px auto 10px; }
.side .top b { font-size: 16px; display: block; }
.side .top small { color: var(--muted); font-size: 13px; display: block; }
.side .close { position: absolute; top: -6px; right: -6px; }
.acts { display: flex; justify-content: center; gap: 10px; }
.act { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.act > span { width: 40px; height: 40px; border-radius: 12px; background: var(--hover); display: grid; place-items: center; color: var(--accent); }
.act.on > span { background: var(--accent); color: #fff; }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.box .h { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 4px; }
.box .h.ok { color: var(--ok); }
.box .h svg.i { width: 16px; height: 16px; }
.box .link { padding: 4px 0 0; font-size: 13px; }
.side .sec { padding: 4px 0 0; }
.mem { display: flex; align-items: center; gap: 10px; font-size: 13.5px; width: 100%; text-align: left; }
.mem > div:not(.av) { min-width: 0; flex: 1; }
.mem small { color: var(--faint); display: block; font-size: 12px; }
.mem .x { color: var(--faint); }
.danger-link { color: var(--danger); font-weight: 600; text-align: left; padding: 6px 0; }
.buttons-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* Settings and contacts */
/* The page column scrolls inside itself, on the computer and on the phone alike. */
.pagewrap { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.page { flex: 1; overflow-y: auto; padding: 28px; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.page > div { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page h2 { font-size: 20px; }
.page h3 { font-size: 15px; margin-bottom: 4px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.line { display: flex; align-items: center; gap: 12px; }
.line > div:first-child { flex: 1; min-width: 0; }
.line small { display: block; color: var(--muted); font-size: 12.5px; }
.dev { display: flex; gap: 12px; align-items: center; padding: 6px 0; }
.dev + .dev { border-top: 1px solid var(--line); padding-top: 12px; }
.dev .fi { width: 36px; height: 36px; }
.dev > div:nth-child(2) { flex: 1; min-width: 0; }
.dev small { display: block; color: var(--muted); font-size: 12.5px; }
.dev code { font-size: 11.5px; color: var(--faint); }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.seg { display: inline-flex; background: var(--hover); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); font-weight: 600; }
.switch { width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

/* Dialogs, menus, toasts */
.veil { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--panel); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.modal h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.modal h2 span { flex: 1; }
.modal .buttons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.found { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.found > div:nth-child(2) { flex: 1; min-width: 0; }
.found small { display: block; color: var(--muted); }
.picked { display: flex; flex-wrap: wrap; gap: 6px; }
.safety { display: grid; grid-template-columns: repeat(4, auto); gap: 6px 18px; justify-content: center; font: 600 17px/1.3 ui-monospace, 'Cascadia Mono', 'Noto Sans Mono', monospace; letter-spacing: 1px; padding: 12px 0; }
.viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); z-index: 60; display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.viewer.video { cursor: default; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
.viewer.video video { width: min(100%, 1100px); max-height: 100%; object-fit: contain; border-radius: 6px; background: #000; align-self: center; }
.viewer-bar { display: flex; gap: 10px; justify-content: center; }
.viewer-bar .btn { color: #fff; background: rgba(255, 255, 255, .14); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.menu { position: fixed; z-index: 70; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 200px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.menu .emo { display: flex; justify-content: space-between; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .emo button { width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 18px; border-radius: 50%; }
/* Where the sound of a call goes: over the screen of the call. */
.place-menu { z-index: 95; min-width: 210px; }
.place-menu button span { flex: 1; }
.place-menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 80; font-size: 13.5px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

.tabbar { display: none; }

/* A call: over everything (docs/mockups/mobile.html, «Входящий звонок»). */
.call { position: fixed; inset: 0; z-index: 90; background: linear-gradient(180deg, #1e3a8a, #0f172a); color: #fff; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
/* The engine's canvas takes the place of the slot. */
.call-slot { display: contents; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-me { position: absolute; right: 16px; bottom: 140px; width: min(30vw, 220px); border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); z-index: 2; touch-action: none; cursor: grab; }
.call-me.settling { transition: left .2s ease, top .2s ease; }
.call-local { display: block; width: 100%; max-height: 40vh; object-fit: cover; }
/* The front camera is shown as a mirror, the main one as it is. */
.call-local.mirror { transform: scaleX(-1); }
.call-remote.off, .call-me.off { opacity: 0; pointer-events: none; }
.me-btn { position: absolute; top: 6px; width: 30px; height: 30px; border-radius: 50%; background: rgba(15, 23, 42, .55); color: #fff; display: grid; place-items: center; }
.me-btn svg.i { width: 17px; height: 17px; }
.me-switch { left: 6px; }
.me-close { right: 6px; }
.call-me-show { position: absolute; right: 16px; bottom: 140px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; display: grid; place-items: center; }
.me-btn[hidden], .call-me-show[hidden] { display: none; }
/* The link of the call: its quality and its way. */
.call-net { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 5px 11px 5px 8px; border-radius: 999px; background: rgba(0, 0, 0, .3); color: #fff; font-size: 12.5px; text-shadow: none; }
.call-net[hidden] { display: none; }
.call-net .bars { width: 16px; height: 16px; flex: none; }
.call-net .bars rect { fill: rgba(255, 255, 255, .3); }
.call-net.good .bars rect.on { fill: #4ade80; }
.call-net.fair .bars rect.on { fill: #facc15; }
.call-net.poor .bars rect.on { fill: #f87171; }
.call-net.lost { color: #fecaca; }
.call-who { position: relative; z-index: 1; margin-top: max(12vh, 56px); text-align: center; padding: 0 16px; }
.call-who .av { width: 116px; height: 116px; font-size: 38px; margin: 0 auto 18px; }
.call-who h2 { font-size: 28px; font-weight: 600; }
.call-who p { color: #c7d2fe; margin-top: 6px; font-size: 15px; }
.call-e2e { margin-top: 10px; font-size: 13px; color: #86efac; display: inline-flex; gap: 4px; align-items: center; }
.call-e2e svg.i { width: 14px; height: 14px; }
.call.has-video .call-who { margin-top: max(16px, env(safe-area-inset-top)); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.call.has-video .call-who .av, .call.has-video .call-e2e { display: none; }
.call.has-video .call-who h2 { font-size: 18px; }
.call-bar { position: relative; z-index: 1; margin-top: auto; margin-bottom: max(40px, env(safe-area-inset-bottom)); display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; padding: 0 16px; }
.cb { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: #e0e7ff; min-width: 72px; }
.cb > span { width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: grid; place-items: center; color: #fff; }
.cb.red > span { background: #ef4444; }
.cb.green > span { background: #22c55e; }
.cb.on > span { background: #fff; color: #0f172a; }
.cb svg.i { width: 28px; height: 28px; }
.cb svg.i.hang { transform: rotate(135deg); }

/* Without the info panel on mid-size screens it opens over the conversation. */
@media (max-width: 1199px) {
  .app { grid-template-columns: 68px 320px minmax(0, 1fr); }
  .side { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; box-shadow: var(--shadow); }
}

/* Phones: one screen at a time, tabs at the bottom (docs/mockups/mobile.html). */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 100%; grid-template-rows: minmax(0, 1fr) auto; }
  .rail { display: none; }
  .list, .conv, .pagewrap { grid-column: 1; grid-row: 1; border: 0; }
  .app[data-view="chats"] .conv, .app[data-view="chats"] .pagewrap { display: none; }
  .app[data-view="conv"] .list, .app[data-view="conv"] .pagewrap, .app[data-view="conv"] .tabbar { display: none; }

  .app[data-view="page"] .list, .app[data-view="page"] .conv { display: none; }
  .lh { padding: 14px 16px 8px; padding-top: max(14px, env(safe-area-inset-top)); }
  .lh h1 { font-size: 30px; }
  .av { width: 52px; height: 52px; }
  .chat { padding: 9px 16px; }
  .chat .cm { border-bottom: 1px solid var(--line); padding-bottom: 9px; }
  .ch { height: auto; min-height: 56px; padding: 6px 8px 6px 4px; padding-top: max(6px, env(safe-area-inset-top)); gap: 8px; }
  .ch .back { display: grid; color: var(--accent); }
  .ch .av { width: 38px; height: 38px; }
  .ch .cm .s { white-space: nowrap; overflow: hidden; }
  .ch .cm .s > span:first-child { overflow: hidden; text-overflow: ellipsis; }
  .e2e-t { display: none; }
  .msgs { padding: 12px; background: var(--bg); }
  .row { max-width: 86%; }
  .row .av.sm { display: none; }
  .bub { border-radius: 18px 18px 18px 6px; font-size: 15px; }
  .mine .bub { border-radius: 18px 18px 6px 18px; }
  .typing-line { padding: 0 14px 2px; }
  .comp-wrap { padding: 6px 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
  .comp { border-radius: 20px; border-color: var(--line); padding: 3px 4px 3px 6px; }
  .bar, .files-bar { border-radius: 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
  .bar + .comp, .files-bar + .comp, .files-bar + .bar { border-radius: 20px; }
  .send { border-radius: 50%; }
  .down { bottom: 84px; right: 14px; }
  .side { width: 100%; border: 0; padding-top: max(18px, env(safe-area-inset-top)); }
  .page { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
  .tabbar { display: flex; grid-column: 1; grid-row: 2; border-top: 1px solid var(--line); justify-content: space-around; padding: 8px 0 max(8px, env(safe-area-inset-bottom)); background: var(--panel); }
  .tb { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--faint); position: relative; min-width: 72px; }
  .tb svg.i { width: 24px; height: 24px; }
  .tb.on { color: var(--accent); }
  .tb .badge { top: -4px; right: 14px; }
  .more { display: none !important; }
  .modal { border-radius: 18px; }
}
@media (min-width: 761px) {
  .pagewrap { grid-column: 3 / -1; }
  .app[data-view="page"] .conv { display: none; }
  .app:not([data-view="page"]) .pagewrap { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
