:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #17191e;
  --panel-2: #20232a;
  --line: #2d3038;
  --text: #f5f2eb;
  --muted: #999da8;
  --accent: #e7ff55;
  --accent-ink: #171900;
  --telegram: #4fa8e8;
  --field: #0f1013;
  --topbar: #17191ef2;
  --danger: #ff7979;
  --pattern: #ffffff08;
  --app-height: 100dvh;
  --viewport-offset-top: 0px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f1eee5;
  --panel: #fffdf7;
  --panel-2: #ece8dd;
  --line: #d2ccbd;
  --text: #24231f;
  --muted: #706d64;
  --accent: #6d39ff;
  --accent-ink: #fff;
  --telegram: #0878b9;
  --field: #fff;
  --topbar: #fffdf7eb;
  --danger: #c73030;
  --pattern: #00000009;
}
[data-theme="terminal"] {
  color-scheme: dark;
  --bg: #001408;
  --panel: #001d0c;
  --panel-2: #052a14;
  --line: #0b6331;
  --text: #a8ffbd;
  --muted: #5cb276;
  --accent: #3cff6f;
  --accent-ink: #001408;
  --telegram: #59ffa9;
  --field: #001006;
  --topbar: #001d0cf2;
  --danger: #ff6580;
  --pattern: #3cff6f0b;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; overscroll-behavior: none; }
body { background: var(--bg); color: var(--text); min-height: 100svh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.loading-view { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; min-height: var(--app-height, 100dvh); padding: max(22px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow-y: auto; background: radial-gradient(circle at 50% 15%, color-mix(in srgb, var(--accent) 13%, var(--bg)) 0, var(--bg) 48%); }
.loading-card { width: min(100%, 520px); padding: clamp(24px, 7vw, 44px); text-align: center; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 30px 90px #000a; }
.loading-card h1 { margin: 8px 0 10px; font-size: clamp(28px, 8vw, 44px); line-height: 1; letter-spacing: -.045em; }
.loading-card .eyebrow { margin-top: 22px; }
.loading-machine { position: relative; width: 112px; height: 88px; margin: 0 auto; display: grid; place-items: center; }
.loading-machine span { display: grid; place-items: center; width: 76px; height: 76px; color: var(--accent); font-size: 66px; line-height: 1; filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 40%, transparent)); animation: loader-crank 1.25s linear infinite; }
.loading-machine i { position: absolute; right: -18px; bottom: -2px; color: var(--danger); font: 900 13px/1 ui-monospace, monospace; transform: rotate(-8deg); opacity: .8; }
@keyframes loader-crank { to { transform: rotate(360deg); } }
.loading-view[data-mode="whitelist"] .loading-machine span, .loading-view[data-mode="offline"] .loading-machine span { animation-duration: 3.2s; }
.loading-view[data-mode="whitelist"] .loading-card { border-color: #f24545; box-shadow: 0 0 0 5px #f2454518, 0 30px 90px #000b; }
.rkn-stamp { width: fit-content; margin: 22px auto 10px; padding: 9px 13px; color: #ff6767; border: 3px double #ff6767; border-radius: 5px; font: 950 12px/1 ui-monospace, monospace; letter-spacing: .08em; transform: rotate(-2deg); }
.loading-footnote { margin: 10px 0 18px; color: var(--muted); font-size: 12px; font-weight: 750; }
.loading-card .action-button { width: 100%; margin-top: 16px; }
.update-banner { position: fixed; z-index: 200; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 20px; padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); color: #160800; background: #ff5c35; border-bottom: 3px solid #180800; box-shadow: 0 8px 30px #0009; }
.update-banner > div { display: grid; gap: 2px; max-width: 720px; }
.update-banner strong { font-size: 13px; letter-spacing: .06em; }
.update-banner span { font-size: 12px; font-weight: 750; line-height: 1.3; }
.update-banner a { flex: 0 0 auto; padding: 10px 14px; color: #fff; background: #180800; border: 2px solid #fff5; border-radius: 9px; font-size: 11px; font-weight: 950; text-decoration: none; white-space: nowrap; box-shadow: 3px 3px 0 #fff5; }
.update-banner a[aria-disabled="true"] { opacity: .65; pointer-events: none; }
.android-pwa-nag { position: fixed; z-index: 360; inset: 0; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); background: #000b; backdrop-filter: blur(7px); }
.android-pwa-nag-card { position: relative; width: min(92vw, 540px); min-height: 290px; display: grid; place-items: center; align-content: center; gap: 18px; padding: 58px 54px; color: #fff6ed; background: linear-gradient(145deg, #3a0905, #130000 62%, #2d1700); border: 3px solid #ff5c35; border-radius: 20px; box-shadow: 0 0 0 6px #ff5c3522, 0 34px 100px #000e; text-align: center; transform: rotate(-.6deg); }
.android-pwa-nag-card > span { color: #ff9d70; font: 950 9px/1.3 ui-monospace, monospace; letter-spacing: .13em; }
.android-pwa-nag-card > strong { font-size: clamp(24px, 7vw, 38px); line-height: 1.02; letter-spacing: -.04em; text-wrap: balance; }
.android-pwa-nag-card > p { max-width: 420px; margin: 0; color: #f5c6b7; font-size: 13px; font-weight: 800; line-height: 1.45; }
.android-pwa-nag-card > a { display: block; width: 100%; padding: 15px 14px; color: #1b0600; background: #ff9d32; border: 2px solid #fff5; border-radius: 8px; box-shadow: 5px 5px 0 #fff3; font-size: 12px; font-weight: 950; text-decoration: none; }
.android-pwa-nag-card > button { width: 100%; padding: 12px 14px; color: #ffd3c3; background: #160300; border: 1px solid #ff805e; font: 900 10px/1.2 ui-monospace, monospace; }
.android-pwa-nag-card > small { color: #d6957f; font-size: 10px; font-weight: 800; }
.android-pwa-nag-close { position: fixed; z-index: 3; left: 0; top: 0; width: 48px; height: 48px; display: grid; place-items: center; padding: 0; color: #fff; background: #160300; border: 2px solid #ff805e; border-radius: 50%; box-shadow: 0 8px 24px #000b; font-size: 30px; font-weight: 950; line-height: 1; touch-action: manipulation; will-change: transform; }
[data-theme="terminal"] .android-pwa-nag-card, [data-theme="terminal"] .android-pwa-nag-card > a, [data-theme="terminal"] .android-pwa-nag-close { border-radius: 2px; }
.muted { color: var(--muted); line-height: 1.5; }
.eyebrow { color: var(--accent); font-weight: 800; font-size: 11px; letter-spacing: .16em; margin: 0 0 8px; }
.error { min-height: 1.2em; color: var(--danger); font-size: 13px; }
.login-view { min-height: var(--app-height, 100dvh); display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--accent) 14%, var(--bg)) 0, transparent 42%); }
.login-card { width: min(100%, 390px); background: rgba(23,25,30,.94); border: 1px solid var(--line); padding: 36px; border-radius: 24px; box-shadow: 0 26px 70px #0008; }
.login-card h1 { font-size: 42px; margin: 8px 0 4px; letter-spacing: -.05em; }
.brand-mark { position: relative; width: 54px; height: 54px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 16px; font-weight: 950; transform: rotate(-4deg); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
.unread-badge { position: absolute; z-index: 2; right: -9px; top: -8px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--panel); border-radius: 999px; color: #fff; background: #f04455; box-shadow: 0 3px 10px #0007; font: 900 10px/1 ui-sans-serif, system-ui, sans-serif; transform: rotate(4deg); }
label { display: grid; gap: 7px; color: #cacdd4; font-size: 13px; margin-top: 17px; }
input, textarea, select { width: 100%; color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: 11px; padding: 13px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #e7ff5519; }
.login-card > button, .user-form > button { width: 100%; border: 0; background: var(--accent); color: var(--accent-ink); padding: 14px; border-radius: 11px; font-weight: 800; margin-top: 20px; }
.chat-view { position: relative; height: var(--app-height, 100dvh); display: grid; grid-template-rows: 64px auto auto minmax(0, 1fr) auto auto auto; max-width: 1000px; margin: auto; border-inline: 1px solid var(--line); background: var(--panel); overflow: hidden; transform: translateY(var(--viewport-offset-top, 0px)); }
.topbar { grid-row: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--topbar); backdrop-filter: blur(14px); }
.brand, .top-actions { display: flex; align-items: center; gap: 12px; }
.brand > div:last-child { display: grid; }
.brand small, #connection-state { color: var(--muted); font-size: 11px; margin-top: 2px; }
#connection-state.online { color: var(--accent); }
#current-user { font-size: 13px; color: #c5c8cf; }
.icon-button { border: 1px solid var(--line); color: var(--text); background: var(--panel-2); border-radius: 9px; width: 36px; height: 36px; font-size: 20px; }
.busted-gear { position: relative; transform: rotate(-14deg); color: var(--accent); text-shadow: 2px 1px 0 color-mix(in srgb, var(--danger) 65%, transparent); }
.busted-gear::after { content: "╱"; position: absolute; right: 4px; top: -3px; color: var(--danger); font-size: 12px; font-weight: 900; transform: rotate(25deg); }
.busted-gear:hover { transform: rotate(18deg) scale(1.06); transition: transform .18s ease; }
.mention-center-button { position: relative; color: var(--telegram); font-size: 18px; font-weight: 950; }
.mention-center-badge { position: absolute; right: -7px; top: -7px; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--panel); border-radius: 999px; color: #111600; background: var(--accent); box-shadow: 0 3px 10px #0008; font: 950 9px/1 ui-sans-serif, system-ui, sans-serif; }
.logout-button { border: 1px solid #ff797955; color: #ff9a9a; background: #ff797910; border-radius: 9px; height: 36px; padding: 0 12px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.logout-button:hover { background: #ff797920; border-color: #ff797988; }
.install-promo { grid-row: 2; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 14px; color: #241200; border-bottom: 2px solid #301800; background: #ffb13b; box-shadow: 0 6px 18px #0004; z-index: 3; }
.install-promo.hidden { display: none; }
.install-promo-icon { font-size: 24px; transform: rotate(-12deg); }
.install-promo > div { min-width: 0; display: grid; gap: 2px; }
.install-promo strong { font-size: 10px; letter-spacing: .08em; }
.install-promo small { overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.install-promo a { padding: 8px 10px; color: #fff; border-radius: 8px; background: #241200; font-size: 10px; font-weight: 950; text-decoration: none; white-space: nowrap; }
.pinned-bar { grid-row: 3; min-width: 0; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 30px; align-items: stretch; min-height: 44px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--topbar)); box-shadow: 0 5px 14px #0003; z-index: 2; }
.pinned-bar.hidden { display: none; }
.pin-nav, .pin-remove, .pin-current { border: 0; color: var(--text); background: transparent; }
.pin-nav { color: var(--muted); font-size: 25px; }
.pin-nav:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pin-current { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 7px 8px; text-align: left; }
.pin-current:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.pin-icon { font-size: 18px; transform: rotate(-12deg); }
.pin-copy { min-width: 0; display: grid; gap: 2px; }
.pin-copy strong { overflow: hidden; color: var(--accent); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pin-copy small { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.pin-count { align-self: start; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 800; }
.pin-remove { width: 32px; color: var(--muted); font-size: 21px; }
.pin-remove:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.messages { grid-row: 4; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 16px clamp(10px, 3vw, 28px); display: flex; flex-direction: column; gap: 10px; background-color: var(--bg); background-image: radial-gradient(circle at 12% 4%, color-mix(in srgb, var(--telegram) 9%, transparent), transparent 38%), radial-gradient(circle at 88% 94%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 42%), radial-gradient(var(--pattern) 1px, transparent 1px); background-size: auto, auto, 22px 22px; }
.load-more { align-self: center; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; }
.telegram-link-banner { position: sticky; z-index: 18; top: 0; order: -1; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-sizing: border-box; padding: 10px 12px; color: #191d00; border: 2px solid #111600; border-radius: 10px; background: var(--accent); box-shadow: 0 8px 24px #0007; }
.telegram-link-banner.hidden { display: none; }
.telegram-link-banner strong { font-size: 12px; font-weight: 950; letter-spacing: .015em; }
.telegram-link-banner button { flex: 0 0 auto; padding: 7px 9px; color: var(--accent); border: 1px solid #111600; border-radius: 7px; background: #111600; font: 900 9px/1 ui-monospace, monospace; }
.telegram-link-dialog { width: min(520px, calc(100% - 28px)); padding: 24px; color: var(--text); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 28px 90px #000c; }
.telegram-link-dialog::backdrop { background: #000b; backdrop-filter: blur(8px); }
.telegram-link-dialog h2 { margin: 4px 0 14px; }
.telegram-link-dialog ol { display: grid; gap: 8px; padding-left: 22px; line-height: 1.45; }
.telegram-link-dialog > a { display: block; margin-top: 18px; padding: 13px 16px; color: var(--accent-ink); border-radius: 9px; background: var(--accent); font-weight: 950; text-align: center; text-decoration: none; }
.telegram-link-dialog .dialog-close { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: 20px; }
.unread-divider { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 10px; font-weight: 950; letter-spacing: .09em; }
.unread-divider::before, .unread-divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.message { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; max-width: 82%; min-width: 0; align-self: flex-start; }
.message.web { align-self: flex-end; grid-template-columns: minmax(0, 1fr); }
.message.web .avatar { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: #2c3038; color: var(--telegram); font-weight: 800; font-size: 12px; cursor: pointer; }
.avatar img { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.bubble { min-width: 0; max-width: 560px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px 15px 15px 15px; padding: 7px 10px 5px; box-shadow: 0 4px 14px #0002; overflow: hidden; }
.web .bubble { background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 16px 4px 16px 16px; }
.message.mentioned .bubble { border: 2px solid var(--accent); box-shadow: 0 0 0 4px #e7ff5520, 0 8px 28px #0006; }
.message.mentioned { animation: mention-in .35s ease-out; }
.message.jump-highlight .bubble { animation: jump-highlight 3s ease-out; }
@keyframes jump-highlight { 0%, 22% { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), 0 8px 28px #0006; } 100% { } }
.message.media-only .bubble { padding: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.message.media-only .message-meta { padding: 0 2px 3px; }
.message.media-only .attachment { margin-top: 0; }
@keyframes mention-in { from { transform: translateY(5px); opacity: .7; } }
.message-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.forward-origin { display: flex; align-items: center; gap: 6px; margin: -2px -4px 8px; padding: 6px 8px; border: 1px solid color-mix(in srgb, var(--telegram) 25%, transparent); border-radius: 9px; color: var(--telegram); background: color-mix(in srgb, var(--telegram) 8%, transparent); text-decoration: none; }
.forward-origin:hover { border-color: color-mix(in srgb, var(--telegram) 65%, transparent); background: color-mix(in srgb, var(--telegram) 13%, transparent); }
.forward-origin.static { cursor: default; }
.forward-origin span { font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.forward-origin strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.forward-origin i { margin-left: auto; font-size: 11px; font-style: normal; }
.sender { color: var(--telegram); font-size: 13px; }
.sender-line { min-width: 0; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.transport-badge { padding: 2px 5px; border: 1px dashed color-mix(in srgb, var(--accent) 65%, var(--line)); border-radius: 4px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); font: 850 8px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; white-space: nowrap; }
.web .sender { color: var(--accent); }
.mention-badge { color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 2px 6px; font-size: 8px; font-weight: 900; letter-spacing: .06em; }
time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.message-stamp { display: inline-flex; align-items: baseline; color: var(--muted); font: 700 9px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }
.message-number { color: color-mix(in srgb, var(--muted) 82%, var(--text)); }
.body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; margin: 6px 0 3px; line-height: 1.42; }
.tg-text-segment { white-space: pre-wrap; }
.tg-code, .tg-pre { padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--field) 82%, #000); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tg-pre { white-space: pre-wrap; }
.tg-spoiler { border-radius: 4px; color: transparent; background: color-mix(in srgb, var(--muted) 45%, var(--panel)); cursor: pointer; user-select: none; }
.tg-spoiler.revealed { color: inherit; background: color-mix(in srgb, var(--muted) 14%, transparent); user-select: text; }
.tg-blockquote { display: block; margin: 7px 0; padding: 7px 10px; border-left: 4px solid var(--telegram); border-radius: 0 8px 8px 0; background: color-mix(in srgb, var(--telegram) 9%, transparent); white-space: pre-wrap; }
.tg-blockquote.expandable { padding: 0; border-left-style: double; overflow: hidden; }
.tg-blockquote.expandable summary { padding: 7px 10px; color: var(--telegram); font: 800 10px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; cursor: pointer; list-style: none; user-select: none; }
.tg-blockquote.expandable summary::-webkit-details-marker { display: none; }
.tg-blockquote.expandable summary::before { content: "▸ "; }
.tg-blockquote.expandable[open] summary::before { content: "▾ "; }
.tg-blockquote-content { padding: 0 10px 8px; white-space: pre-wrap; }
.body:empty { display: none; }
.message-link { color: var(--telegram); font-weight: 650; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.mention-link { display: inline; margin: 0; padding: 0; border: 0; background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
.web .message-link { color: var(--accent); }
.link-previews { clear: both; }
.link-previews:empty { display: none; }
.link-previews.loading { min-height: 3px; margin-top: 9px; border-radius: 999px; background: linear-gradient(90deg, transparent, var(--telegram), transparent); background-size: 200% 100%; animation: preview-loading 1.2s linear infinite; }
@keyframes preview-loading { to { background-position: -200% 0; } }
.link-preview { display: grid; grid-template-columns: minmax(128px, 42%) minmax(0, 1fr); max-width: 440px; margin-top: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: color-mix(in srgb, var(--panel) 72%, #000); text-decoration: none; }
.link-preview:hover { border-color: color-mix(in srgb, var(--telegram) 65%, var(--line)); }
.link-preview img { width: 100%; height: 100%; min-height: 92px; aspect-ratio: 16 / 9; object-fit: cover; background: #090909; }
.link-preview > span { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 10px 12px; }
.link-preview small { overflow: hidden; color: #ff5757; font-size: 8px; font-weight: 900; letter-spacing: .08em; text-overflow: ellipsis; white-space: nowrap; }
.link-preview strong { display: -webkit-box; overflow: hidden; font-size: 12px; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.link-preview em { color: var(--muted); font-size: 8px; font-style: normal; font-weight: 800; letter-spacing: .05em; }
.site-preview small { color: var(--telegram, var(--accent)); }
.site-preview.no-image { grid-template-columns: minmax(0, 1fr); }
.link-preview-text { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; white-space: pre-line; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.spotify-preview { border-color: color-mix(in srgb, #1db954 55%, var(--line)); }
.spotify-preview:hover { border-color: #1db954; }
.spotify-preview small { color: #1db954; }
.spotify-cover { display: grid; place-items: center; min-height: 92px; color: #1db954; background: #090909; font-size: 34px; text-decoration: none; }
.spotify-cover img { aspect-ratio: 1 / 1; }
.spotify-listen { align-self: flex-start; margin-top: 3px; padding: 6px 10px; border: 0; border-radius: 6px; color: #06130a; background: #1db954; font: inherit; font-size: 9px; font-weight: 950; letter-spacing: .06em; cursor: pointer; }
.spotify-listen:hover { background: #24d862; }
.spotify-open { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .05em; text-decoration: none; }
.spotify-embed { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.spotify-embed iframe { width: 100%; border: 0; border-radius: 12px; background: #090909; }
/* Находки поиска в боковой панели: люди сверху, сообщения ниже */
.desktop-search-results { max-height: 46vh; overflow: auto; margin: 0 12px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.desktop-search-results b { display: block; padding: 7px 10px 3px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.desktop-search-hit { width: 100%; display: block; padding: 7px 10px; border: 0; border-top: 1px solid var(--line); color: var(--text); background: transparent; font: inherit; font-size: 11px; text-align: left; cursor: pointer; }
.desktop-search-hit:first-of-type { border-top: 0; }
.desktop-search-hit:hover { background: var(--panel-2); }
.desktop-search-hit small { display: block; color: var(--accent); font-size: 8px; font-weight: 900; letter-spacing: .05em; }
.desktop-search-hit span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.desktop-search-empty { padding: 10px; color: var(--muted); font-size: 10px; text-align: center; }

/* Мобильный обыск: та же выдача, но окном во весь экран и пальцами. */
.search-dialog[open] { display: grid; gap: 12px; align-content: start; }
.search-field { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 0 12px; color: var(--muted); background: var(--field); border: 1px solid var(--line); border-radius: 12px; }
.search-field span { font-size: 18px; }
.search-field input { min-width: 0; height: 46px; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font: inherit; font-size: 16px; }
.search-results { display: grid; align-content: start; gap: 2px; min-height: 96px; max-height: min(58dvh, 520px); overflow: auto; }
.search-results > b { padding: 12px 2px 4px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.search-hit { width: 100%; display: grid; gap: 3px; padding: 11px 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; font: inherit; text-align: left; }
.search-hit small { color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: .05em; }
.search-hit span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-size: 13px; }
.search-empty { padding: 24px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.store-preview { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.store-preview:hover { border-color: var(--accent); box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 16%, transparent); }
.store-preview small { color: var(--accent); }
.store-preview em { color: color-mix(in srgb, var(--accent) 78%, var(--muted)); }
.message-footer { clear: both; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 5px 10px; margin-top: 5px; }
.reactions { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.reaction-list { display: contents; }
.reaction-pill { min-width: 0; min-height: 32px; display: inline-grid; grid-template-columns: auto auto auto; align-items: center; gap: 5px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: color-mix(in srgb, var(--panel) 72%, transparent); font: inherit; font-size: 12px; cursor: default; }
.reaction-pill strong { font-size: 12px; white-space: nowrap; }
.reaction-pill i { color: var(--muted); font-size: 7px; font-style: normal; font-weight: 950; letter-spacing: .08em; }
.reaction-actors { display: flex; align-items: center; min-width: 22px; padding-right: 1px; }
.reaction-actor-avatar { width: 24px; height: 24px; display: grid; place-items: center; overflow: hidden; margin-left: -5px; border: 2px solid var(--panel); border-radius: 50%; color: var(--accent-ink); background: var(--accent); font-size: 7px; font-weight: 950; line-height: 1; }
.reaction-actor-avatar:first-child { margin-left: 0; }
.reaction-actor-avatar img { width: 100%; height: 100%; object-fit: cover; }
.reaction-pill.own { border-color: var(--telegram); background: color-mix(in srgb, var(--telegram) 18%, var(--panel)); }
.reaction-pill.own { color: var(--telegram); font-weight: 900; }
.reaction-pill.dicktalk { cursor: pointer; }
.reaction-pill.dicktalk:hover { border-color: var(--accent); }
.reaction-add { min-height: 32px; padding: 4px 9px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: transparent; font: inherit; font-size: 9px; font-weight: 900; }
.reaction-picker { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 16px; background: #000a; backdrop-filter: blur(6px); }
.reaction-picker section { width: min(520px, 100%); max-height: min(720px, calc(100dvh - 24px)); overflow: hidden; padding: 12px; border: 1px solid var(--accent); border-radius: 14px; background: var(--panel); box-shadow: 0 22px 70px #000b; }
.reaction-picker header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--accent); font-size: 12px; letter-spacing: .07em; }
.reaction-picker header button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--field); font-size: 23px; }
.reaction-picker-groups { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: thin; overscroll-behavior-inline: contain; }
.reaction-picker-groups button { flex: 0 0 auto; min-height: 42px; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--field); white-space: nowrap; }
.reaction-picker-groups button.active { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.reaction-picker-groups button b { font-size: 18px; }
.reaction-picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; overflow-y: auto; }
.reaction-picker-grid > button { min-height: 52px; display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--field); text-align: left; }
.reaction-picker-grid > button:hover { border-color: var(--accent); }
.reaction-picker b { font-size: 24px; }
.reaction-picker span { font-size: 9px; font-weight: 900; line-height: 1.2; }
.receipt-row { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; min-height: 0; margin-left: auto; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .025em; }
.delivery-status { color: color-mix(in srgb, var(--accent) 72%, var(--muted)); }
.delivery-status.failed { color: var(--danger); cursor: pointer; }
.delivery-status.queued { color: #e5aa42; }
.read-receipts { display: inline-flex; align-items: center; gap: 4px; color: var(--telegram); cursor: default; }
.read-receipts .reader-faces { display: inline-flex; flex-direction: row-reverse; margin-left: 2px; }
.read-receipts .reader-face { width: 17px; height: 17px; display: grid; place-items: center; overflow: hidden; margin-left: -4px; border: 1px solid var(--panel-2); border-radius: 50%; color: var(--telegram); background: var(--field); font-size: 6px; font-weight: 950; cursor: pointer; }
.read-receipts .reader-face img { width: 100%; height: 100%; object-fit: cover; }
.read-receipts-dialog { width: min(520px, calc(100% - 24px)); }
.reaction-details-dialog .reaction-source-badge { justify-self: end; color: var(--muted); font: 900 8px/1 ui-monospace, monospace; }
.reaction-details-dialog .read-receipt-person > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; text-align: left; }
.reaction-details-dialog .read-receipt-person > span:nth-child(2) time { color: var(--muted); font-size: 11px; }
.read-receipts-summary { margin: 12px 0 18px; color: var(--muted); font-size: 13px; }
.read-receipts-list { display: grid; gap: 8px; }
.read-receipt-person { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--text); text-align: left; }
.read-receipt-avatar { width: 44px; height: 44px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; color: var(--telegram); background: var(--panel-2); font-size: 12px; font-weight: 950; }
.read-receipt-avatar img { width: 100%; height: 100%; object-fit: cover; }
.read-receipt-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.read-receipt-person time { color: var(--muted); font-size: 12px; font-weight: 750; white-space: nowrap; }
.read-receipts-empty { padding: 24px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
[data-theme="terminal"] .read-receipt-person, [data-theme="terminal"] .read-receipts-empty { border-radius: 2px; }
.desktop-shell .message .bubble { cursor: context-menu; }
.message.outbox { opacity: .82; }
.message.outbox .bubble { border-style: dashed; }
.message-actions { float: right; display: flex; justify-content: flex-end; gap: 9px; }
.message-actions button { opacity: 0; border: 0; background: transparent; color: var(--muted); padding: 3px 0 0 7px; font-size: 11px; }
.message-actions .delete-button { color: color-mix(in srgb, var(--danger) 78%, var(--muted)); }
.message:hover .message-actions button { opacity: 1; }
.quoted { display: -webkit-box; width: 100%; text-align: left; margin-top: 5px; padding: 6px 8px; border: 0; border-left: 3px solid var(--accent); border-radius: 4px; color: color-mix(in srgb, var(--text) 82%, var(--muted)); background: color-mix(in srgb, var(--field) 62%, var(--telegram) 8%); font-family: ui-serif, Georgia, serif; font-size: 11px; font-style: italic; line-height: 1.3; white-space: normal; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
[data-theme="terminal"] .quoted { color: var(--text); background: #0008; border: 1px solid var(--line); border-left: 3px solid var(--accent); font-family: inherit; }
.attachment { margin-top: 8px; --media-cap: 480px; }
/* Медиа в своих пропорциях, как в телеге: коробка считается из сторон вложения. Ширина
   упирается в потолок, а у вертикального видео её задаёт потолок высоты (--media-cap),
   поэтому нет ни чёрных полос, ни обрезанных голов. --ar ставит клиент по реальным сторонам. */
.attachment img, .attachment video { display: block; width: min(520px, calc(var(--media-cap) * var(--ar, 1.6))); max-width: 100%; height: auto; aspect-ratio: var(--ar, 1.6); border-radius: 10px; object-fit: cover; }
.attachment .sticker-media { width: min(260px, 68vw); height: min(260px, 68vw); object-fit: contain; border-radius: 0; background: transparent; }
.sticker-lottie { overflow: hidden; }
.sticker-lottie svg, .sticker-lottie img { display: block; width: 100%; height: 100%; object-fit: contain; }
.attachment.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; overflow: hidden; border-radius: 11px; }
.attachment.media-grid > * { min-width: 0; height: clamp(120px, 24vw, 250px); }
/* В альбоме плитки заполняют ячейку целиком, поэтому там и обёртка, и само медиа во всю ширину. */
.attachment.media-grid .media-tile, .attachment.media-grid .video-tile { width: 100%; }
.attachment.media-grid img, .attachment.media-grid video { width: 100%; height: 100%; max-height: none; border-radius: 0; aspect-ratio: auto; object-fit: cover; }
.media-tile { display: block; width: min(520px, calc(var(--media-cap, 480px) * var(--ar, 1.6))); max-width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 10px; background: #090a0c; cursor: zoom-in; }
.media-tile img { transition: transform .18s ease; }
.media-tile:hover img { transform: scale(1.015); }
.video-tile { position: relative; width: min(520px, calc(var(--media-cap, 480px) * var(--ar, 1.6))); max-width: 100%; }
.media-expand { position: absolute; right: 7px; top: 7px; width: 34px; height: 34px; border: 1px solid #fff5; border-radius: 9px; color: #fff; background: #000a; font-size: 18px; backdrop-filter: blur(8px); }
.attachment audio { width: min(360px, 100%); }
/* Бабин магнитофон: плеер для музыки */
.babin { width: min(420px, 100%); margin-top: 8px; overflow: hidden; border: 1px solid #8b4b32; border-radius: 10px; background: #3a2b24; color: #c3aa76; }
.babin-deck { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 14px 18px 24px; background: linear-gradient(180deg, #43312a, #33241e); }
.babin-reel { position: relative; display: block; width: 72px; height: 72px; margin: 0 auto; border: 3px solid #c3aa76; border-radius: 50%; background: #171310; box-shadow: inset 0 0 0 6px #171310, 0 2px 6px #0008; }
.babin-reel i { position: absolute; inset: 8px; display: block; border-radius: 50%; background:
  radial-gradient(circle, #160d09 0 9%, transparent 9.5%),
  radial-gradient(circle, #8b4b32 0 20%, transparent 20.5%),
  conic-gradient(from 0deg, #c3aa76 0 14deg, transparent 14deg 120deg, #c3aa76 120deg 134deg, transparent 134deg 240deg, #c3aa76 240deg 254deg, transparent 254deg 360deg);
  mask: radial-gradient(circle, transparent 0 24%, #000 25% 80%, transparent 81%); -webkit-mask: radial-gradient(circle, transparent 0 24%, #000 25% 80%, transparent 81%); }
.babin-reel::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%; background: #8b4b32; box-shadow: inset 0 0 0 4px #160d09; }
.babin.playing .babin-reel i { animation: babin-spin 1.8s linear infinite; }
.babin.playing .babin-reel.right i { animation-direction: reverse; animation-duration: 2.3s; }
@keyframes babin-spin { to { transform: rotate(360deg); } }
.babin-window { display: grid; place-items: center; width: 64px; height: 64px; overflow: hidden; border: 1px solid #8b4b32; border-radius: 6px; background: #160d09; font-size: 26px; }
.babin-window img { width: 100%; height: 100%; object-fit: cover; }
.babin-label { position: absolute; right: 0; bottom: 6px; left: 0; overflow: hidden; font-family: ui-monospace, Menlo, monospace; font-size: 8px; font-style: normal; font-weight: 900; letter-spacing: .08em; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.babin-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 14px 0; color: var(--text); }
.babin-info strong { overflow: hidden; font-size: 13px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.babin-info small { overflow: hidden; color: #c3aa76; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.babin-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 14px 12px; }
.babin-play { width: 40px; height: 40px; border: 0; border-radius: 50%; color: #171310; background: #c3aa76; font: inherit; font-size: 15px; font-weight: 900; cursor: pointer; }
.babin-play:hover { background: #d9c08a; }
.babin-seek { width: 100%; min-width: 0; margin: 0; accent-color: #c3aa76; }
.babin-time { font-family: ui-monospace, Menlo, monospace; font-size: 10px; font-weight: 800; white-space: nowrap; }
.babin.broken .babin-label { color: var(--danger); }
.babin-lyrics { margin: 0 14px 6px; border-top: 1px solid #8b4b3266; }
.babin-lyrics summary { padding: 8px 0; color: #c3aa76; font-family: ui-monospace, Menlo, monospace; font-size: 9px; font-weight: 900; letter-spacing: .08em; cursor: pointer; list-style: none; }
.babin-lyrics summary::before { content: "▸ "; }
.babin-lyrics[open] summary::before { content: "▾ "; }
.babin-lyrics pre { max-height: 320px; overflow: auto; margin: 0 0 8px; padding: 8px 10px; border-radius: 6px; color: var(--text); background: #160d09; font: inherit; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.babin audio { display: none; }
.video-note-wrap { position: relative; width: min(280px, 72vw); aspect-ratio: 1; overflow: visible; touch-action: pan-y; border-radius: 50%; background: radial-gradient(circle at 36% 31%, #5b6670 0 18%, #252b30 48%, #8a5a2b 76%, #171a1d 100%); box-shadow: inset 0 0 0 2px #c58a43b8, inset 0 0 0 16px #090b0d, 0 9px 30px #0008; }
.attachment .video-note { position: absolute; z-index: 1; inset: 7%; width: 86%; height: 86%; max-width: none; max-height: none; border-radius: 50%; object-fit: cover; background: #050607; box-shadow: 0 0 0 3px #000d, 0 0 0 5px #ffffff2e; cursor: pointer; }
.video-note-progress { position: absolute; z-index: 2; inset: 5%; width: 90%; height: 90%; overflow: visible; pointer-events: none; transform: rotate(-90deg); }
.video-note-progress circle { fill: none; stroke-width: 1.7; }
.video-note-progress-track { stroke: #000a; }
.video-note-progress-value { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; filter: drop-shadow(0 0 2px color-mix(in srgb, var(--accent) 70%, transparent)); transition: stroke-dashoffset .1s linear; }
.video-note-bolts { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.video-note-bolts i { position: absolute; width: 11px; height: 11px; transform: translate(-50%, -50%); border: 2px solid #0a0c0e; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #e0b078 0 10%, #b57a3c 22% 67%, #3a210f 100%); box-shadow: 0 1px 2px #000c; }
.video-note-bolts i::after { content: ""; position: absolute; left: 1px; right: 1px; top: 50%; height: 1px; transform: translateY(-50%) rotate(-8deg); border-radius: 2px; background: #17100bd0; }
.video-note-toggle { position: absolute; z-index: 5; left: 50%; top: 50%; display: grid; place-items: center; width: 58px; height: 58px; padding: 0 0 0 4px; transform: translate(-50%, -50%); border: 1px solid #fff7; border-radius: 50%; color: #fff; background: #050607a8; box-shadow: 0 8px 24px #0008; font-size: 23px; backdrop-filter: blur(10px); transition: opacity .18s, transform .18s; }
.video-note-toggle.playing { opacity: 0; padding-left: 0; font-size: 16px; }
.video-note-wrap:hover .video-note-toggle.playing, .video-note-toggle.playing:focus-visible { opacity: .82; }
.transcription { clear: both; display: grid; gap: 5px; margin-top: 9px; padding: 9px 11px; border-left: 3px solid var(--telegram); border-radius: 7px; background: color-mix(in srgb, var(--telegram) 10%, var(--panel-2)); }
.transcription strong { color: var(--telegram); font-size: 9px; letter-spacing: .07em; }
.transcription p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; }
.transcription.failed { border-color: var(--danger); }
.transcription.failed strong { color: var(--danger); }
.file-link { color: var(--text); display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid #ffffff18; border-radius: 10px; text-decoration: none; }
.reply-bar { grid-row: 5; display: flex; justify-content: space-between; align-items: center; background: var(--panel-2); border-top: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 8px 16px; }
.reply-bar > div { display: grid; min-width: 0; }
.reply-bar small { color: var(--muted); }
#reply-preview { color: #bbbfc8; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 70vw; }
.edit-bar { border-left-color: var(--telegram); }
#edit-preview { max-width: 70vw; overflow: hidden; color: var(--telegram); text-overflow: ellipsis; white-space: nowrap; }
.composer { grid-row: 7; min-height: 72px; display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.attach-button { display: grid; place-items: center; flex: 0 0 44px; height: 44px; margin: 0; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 24px; cursor: pointer; }
.attach-button input { display: none; }
.composer-tools { position: relative; flex: 0 0 44px; }
.composer-tools-menu { position: absolute; z-index: 45; left: 0; bottom: calc(100% + 9px); display: grid; width: 230px; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 96%, transparent); box-shadow: 0 18px 50px #0009; backdrop-filter: blur(16px); }
.composer-tool-item { width: 100%; display: flex; align-items: center; gap: 10px; margin: 0; padding: 11px 12px; border: 0; border-radius: 9px; color: var(--text); background: transparent; font: inherit; text-align: left; cursor: pointer; }
.composer-tool-item:hover { color: var(--accent-ink); background: var(--accent); }
.composer-tool-item input { display: none; }
.format-toolbar { order: 1; display: flex; gap: 3px; margin: 0 0 5px 2px; overflow-x: auto; scrollbar-width: none; }
.format-toolbar::-webkit-scrollbar { display: none; }
.format-toolbar button { flex: 0 0 auto; min-width: 28px; height: 25px; padding: 0 6px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: color-mix(in srgb, var(--field) 86%, transparent); font-size: 10px; }
.format-toolbar button:hover, .format-toolbar button.active { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.sticker-panel { position: absolute; z-index: 38; left: 14px; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); display: grid; grid-template-rows: auto minmax(0, 1fr); height: min(470px, calc(var(--app-height, 100dvh) - 145px)); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--panel) 97%, transparent); box-shadow: 0 24px 70px #000b; backdrop-filter: blur(18px); }
.sticker-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sticker-panel > header > div { display: grid; }
.sticker-panel header strong { color: var(--accent); font-size: 12px; letter-spacing: .08em; }
.sticker-panel header small { color: var(--muted); font-size: 10px; }
.sticker-panel header button { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel-2); font-size: 22px; }
.sticker-catalog { min-height: 0; overflow-y: auto; padding: 8px 12px 18px; overscroll-behavior: contain; }
.sticker-catalog section + section { margin-top: 16px; }
.sticker-catalog h4 { position: sticky; z-index: 1; top: -8px; margin: 0 -4px 5px; padding: 8px 4px 5px; color: var(--muted); background: var(--panel); font-size: 10px; letter-spacing: .05em; }
.sticker-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.sticker-grid button { aspect-ratio: 1; min-width: 0; padding: 3px; border: 1px solid transparent; border-radius: 10px; background: transparent; }
.sticker-grid button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sticker-grid button.sending { opacity: .45; transform: scale(.9); }
.sticker-grid img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sticker-empty { padding: 30px 16px; color: var(--muted); text-align: center; }
.recording-panel { position: absolute; z-index: 55; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); color: var(--text); background: color-mix(in srgb, var(--topbar) 96%, #000); backdrop-filter: blur(22px); }
.recording-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recording-panel > header > div { display: grid; }
.recording-panel header strong { color: var(--accent); font-size: 13px; letter-spacing: .08em; }
.recording-panel header small { margin-top: 4px; color: var(--muted); }
.recording-panel header time { color: var(--text); font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 900; }
.recording-stage { display: grid; place-items: center; min-height: 0; padding: 20px; }
.recording-stage video { width: min(560px, 82vw, 65vh); height: min(560px, 82vw, 65vh); aspect-ratio: 1; border: 6px solid var(--accent); border-radius: 50%; object-fit: cover; background: #000; box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 10%, transparent), 0 25px 70px #000a; }
.recording-stage video.front-camera { transform: scaleX(-1); }
.recording-voice-pulse { position: relative; display: grid; place-items: center; width: min(340px, 68vw); aspect-ratio: 1; border-radius: 50%; color: var(--accent-ink); background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); animation: record-pulse 1.5s ease-out infinite; }
.recording-voice-pulse span { font-size: clamp(60px, 15vw, 100px); }
.recording-voice-pulse i { position: absolute; bottom: 24%; width: 6px; height: 15%; border-radius: 99px; background: var(--accent-ink); animation: record-bars .7s ease-in-out infinite alternate; }
.recording-voice-pulse i:nth-of-type(1) { margin-left: -30px; animation-delay: -.2s; }.recording-voice-pulse i:nth-of-type(3) { margin-left: 30px; animation-delay: -.4s; }
@keyframes record-pulse { 70% { box-shadow: 0 0 0 35px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes record-bars { to { height: 5%; } }
.recording-panel > footer { display: flex; justify-content: center; gap: 10px; }
.recording-panel footer button { min-height: 48px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--panel-2); font-weight: 850; }
.recording-panel footer .recording-stop { color: #fff; border-color: #dc394d; background: #dc394d; }
.recording-panel footer .recording-camera { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel-2)); }
.recording-panel footer .recording-send { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.compose-field { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.compose-editor { position: relative; order: 2; min-width: 0; border-radius: 11px; background: var(--field); }
.compose-editor textarea, .composer-format-preview { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
textarea { position: relative; z-index: 2; resize: none; max-height: 140px; min-height: 44px; padding: 11px 13px; line-height: 1.35; background: transparent; }
.composer-format-preview { position: absolute; z-index: 1; inset: 0; overflow: hidden; padding: 11px 13px; border: 1px solid transparent; border-radius: 11px; color: var(--text); font-size: inherit; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }
.composer-format-preview .message-link { font-weight: inherit; }
.composer-format-preview .tg-code, .composer-format-preview .tg-pre { padding: 0; border-radius: 2px; font-family: inherit; }
.composer-format-preview .tg-blockquote { display: inline; margin: 0; padding: 0; border: 0; border-radius: 2px; font-style: italic; }
.compose-editor.has-format-preview textarea { color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--text); }
.compose-editor.has-format-preview textarea::selection { color: var(--text); -webkit-text-fill-color: var(--text); background: color-mix(in srgb, var(--telegram) 55%, transparent); }
.compose-editor.has-format-preview textarea::placeholder { color: var(--muted); -webkit-text-fill-color: var(--muted); }
html[data-platform="android"] .compose-editor { order: 1; }
html[data-platform="android"] .format-toolbar { order: 2; margin: 5px 0 0 2px; }
.pending-files { order: 3; display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--accent); font-size: 11px; }
.pending-files span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-files button { flex: 0 0 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 7px; color: var(--danger); background: transparent; }
.upload-progress { order: 4; display: grid; gap: 3px; margin-top: 5px; }
.upload-progress > span { height: 4px; overflow: hidden; border-radius: 99px; background: var(--line); }
.upload-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .12s linear; }
.upload-progress small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.compose-field { position: relative; }
.viewer-open { overflow: hidden; }
.media-viewer { position: fixed; z-index: 300; inset: 0; display: grid; grid-template: 58px minmax(0, 1fr) / 64px minmax(0, 1fr) 64px; color: #fff; background: #020304f2; backdrop-filter: blur(16px); }
.media-viewer > header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); border-bottom: 1px solid #ffffff1c; background: #08090bd9; }
.media-viewer header strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-viewer header span { color: #aeb3bd; font-size: 12px; white-space: nowrap; }
.media-viewer header a { margin-left: auto; color: var(--accent); font-size: 11px; font-weight: 900; text-decoration: none; }
.media-viewer header button { width: 38px; height: 38px; border: 1px solid #ffffff2e; border-radius: 10px; color: #fff; background: #ffffff0d; font-size: 25px; }
.media-stage { grid-column: 2; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; touch-action: pan-y pinch-zoom; }
/* Высота задаётся от экрана, а не от строки сетки: Safari внутри minmax(0, 1fr) считает её неопределённой
   и рисует высокую картинку во всю ширину, обрезая низ без прокрутки. */
.media-stage img, .media-stage video { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 58px - 16px); object-position: center; }
.media-stage img { object-fit: contain; cursor: zoom-in; }
.media-stage video { object-fit: contain; }
/* Зум по клику: во всю ширину с вертикальной прокруткой — газетную полосу иначе не прочитать. */
.media-stage.zoomed { place-items: start center; overflow: auto; -webkit-overflow-scrolling: touch; }
.media-stage.zoomed img { width: 100%; max-height: none; cursor: zoom-out; }
.media-nav { align-self: center; width: 48px; height: 64px; margin: 8px; border: 1px solid #ffffff24; border-radius: 14px; color: #fff; background: #ffffff0b; font-size: 45px; }
.media-nav.prev { grid-column: 1; }
.media-nav.next { grid-column: 3; }
.typing-state { grid-row: 6; min-height: 0; height: 0; overflow: hidden; padding: 0 16px; color: var(--muted); background: var(--panel); font-size: 11px; font-style: italic; transition: height .18s ease, padding .18s ease; }
.typing-state.active { height: 25px; padding-top: 6px; }
.mention-menu { position: absolute; z-index: 8; left: 0; right: 0; bottom: calc(100% + 8px); max-height: 280px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: 0 18px 50px #0008; backdrop-filter: blur(16px); }
.mention-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px; border: 0; border-radius: 9px; color: var(--text); background: transparent; text-align: left; }
.mention-menu button:hover, .mention-menu button.active { color: var(--accent-ink); background: var(--accent); }
.mention-menu button > span:first-child { flex: 0 0 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--telegram); background: var(--panel-2); font-size: 10px; font-weight: 900; }
.mention-menu button > span:last-child { display: grid; min-width: 0; }
.mention-menu small { color: var(--muted); }
.mention-menu button:hover small, .mention-menu button.active small { color: inherit; opacity: .7; }
/* Эмодзи: кнопка рядом с отправкой и всплывающая панель над композером. */
.emoji-button { flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 21px; line-height: 1; cursor: pointer; }
.emoji-button[aria-expanded="true"] { border-color: var(--accent); }
.composer { position: relative; }
.emoji-panel { position: absolute; right: 16px; bottom: calc(100% + 8px); z-index: 40; width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 18px 40px #0009; }
.emoji-panel.hidden { display: none; }
.emoji-panel header { display: flex; gap: 8px; align-items: center; }
.emoji-panel header input { flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; }
.emoji-panel header button { flex: 0 0 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.emoji-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tabs button { flex: 0 0 auto; width: 32px; height: 30px; border: 1px solid transparent; border-radius: 9px; background: transparent; font-size: 16px; line-height: 1; cursor: pointer; }
.emoji-tabs button:hover { background: var(--panel-2); }
.emoji-tabs button.active { border-color: var(--accent); background: var(--panel-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 232px; overflow-y: auto; scrollbar-width: thin; }
.emoji-item { aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.emoji-item:hover { background: var(--panel-2); }
.emoji-empty { margin: 0; padding: 12px 4px; color: var(--muted); font-size: 12px; text-align: center; }
.send-button { flex: 0 0 44px; height: 44px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 19px; font-weight: 900; }
.send-button:disabled { opacity: .5; cursor: wait; }
dialog { width: min(680px, calc(100% - 24px)); max-height: calc(100dvh - 32px); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
dialog::backdrop { background: #000b; backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; }
.dialog-head h2 { margin: 0; }
.user-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.user-form .checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.users-list { display: grid; gap: 8px; margin-top: 18px; }
.user-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px; background: var(--panel-2); border-radius: 10px; }
.user-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.user-row-actions select { width: min(230px, 38vw); padding: 7px 9px; font-size: 12px; }
.user-row small { color: var(--muted); display: block; }
.user-row button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 8px; padding: 6px 9px; }
.user-row-actions .reset-password-button { border-color: #ff8a8a66; color: #ff9b9b; }
.user-row-actions .reset-password-button:hover { color: #210000; background: #ff8a8a; }
.user-row-actions .admin-role-button { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent); }
.user-row-actions .admin-role-button:hover { color: var(--accent-ink); background: var(--accent); }
.temporary-password-mark { margin-left: 6px; color: var(--danger); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.admin-section-title { margin: 20px 0 0; }
.admin-activity-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 18px; padding: 13px 14px; border: 1px solid var(--accent); border-radius: 12px; color: var(--text); background: color-mix(in srgb, var(--accent) 7%, transparent); text-decoration: none; }
.admin-activity-link > span:first-child { font-size: 28px; }
.admin-activity-link > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.admin-activity-link small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-activity-link b { color: var(--accent); font-size: 10px; }
.admin-activity-link:hover { color: var(--accent-ink); background: var(--accent); }
.admin-activity-link:hover small, .admin-activity-link:hover b { color: inherit; }
.boob-admin { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.boob-admin-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.boob-admin-head h3 { margin: 0; font-size: 22px; }
.boob-admin-head > strong { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); font-size: 11px; }
.boob-admin > .muted { margin: 12px 0 15px; font-size: 11px; }
.boob-upload-button { display: grid; place-items: center; min-height: 48px; margin: 0; border: 1px dashed var(--accent); border-radius: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); font-weight: 900; cursor: pointer; }
.boob-upload-button:hover { color: var(--accent-ink); background: var(--accent); }
.boob-upload-button input { display: none; }
.boob-upload-status { display: grid; gap: 5px; margin-top: 11px; }
.boob-upload-status > span { height: 6px; overflow: hidden; border-radius: 999px; background: var(--field); }
.boob-upload-status i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .15s ease; }
.boob-upload-status small, .boob-library-empty { color: var(--muted); font-size: 11px; }
.boob-library-empty { padding: 20px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.boob-library-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.boob-library-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.boob-library-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--field); }
.boob-library-card footer { display: grid; gap: 2px; padding: 7px 8px; }
.boob-library-card footer strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.boob-library-card footer small { color: var(--muted); font-size: 8px; }
.boob-library-delete { position: absolute; top: 5px; right: 5px; width: 30px; height: 30px; border: 1px solid #ff909077; border-radius: 8px; color: #fff; background: #190606d9; font-size: 15px; backdrop-filter: blur(8px); }
.boob-library-delete:hover { background: var(--danger); }
.settings-dialog { width: min(560px, calc(100% - 24px)); }
.task-settings-button { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.my-task-count { min-width: 24px; padding: 4px 7px; border-radius: 999px; color: var(--accent-ink); background: var(--accent); font-size: 10px; text-align: center; }
.my-tasks-dialog { width: min(650px, calc(100% - 24px)); }
.my-tasks-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 15px 0; padding: 10px 12px; border: 1px solid var(--line); background: var(--field); }
.my-tasks-toolbar label { display: flex; align-items: center; gap: 7px; }.my-tasks-toolbar input { width: auto; }.my-tasks-toolbar span { color: var(--muted); font-size: 10px; }
.my-tasks-list { display: grid; gap: 9px; max-height: min(58vh, 620px); overflow-y: auto; }
.my-task-card { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; background: var(--panel-2); }
.my-task-card.status-analyzed { border-left-color: #c87aff; }.my-task-card.status-in_progress { border-left-color: var(--telegram); }.my-task-card.status-done { border-left-color: var(--muted); opacity: .72; }
.my-task-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }.my-task-card header strong { color: var(--accent); font-size: 11px; }.my-task-card header span { padding: 4px 7px; border: 1px solid currentColor; color: var(--muted); font-size: 8px; font-weight: 950; }.my-task-card.status-analyzed header span { color: #c87aff; }.my-task-card.status-in_progress header span { color: var(--telegram); }.my-task-card.status-new header span { color: #e5c94d; }
.my-task-card h3 { margin: 0; color: var(--text); font-size: 16px; }.my-task-card details summary { color: var(--muted); font-size: 10px; cursor: pointer; }.my-task-card details p { margin: 8px 0 0; padding: 10px; border-left: 2px solid var(--line); color: var(--text); font-size: 12px; white-space: pre-wrap; }.my-task-card time { color: var(--muted); font-size: 9px; }
.my-tasks-empty { padding: 35px 18px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }.create-dick-task { width: 100%; margin-top: 14px; }
[data-theme="terminal"] .my-task-card, [data-theme="terminal"] .my-task-count, [data-theme="terminal"] .my-tasks-toolbar { border-radius: 2px; }
.create-task-dialog { width: min(590px, calc(100% - 24px)); }
.create-task-dialog form { display: grid; gap: 14px; }
.create-task-dialog form > .muted { margin: 0; }
.create-task-dialog label { display: grid; gap: 7px; margin: 0; color: var(--muted); font-weight: 800; }
.create-task-dialog textarea { min-height: 130px; max-height: min(38vh, 320px); resize: vertical; }
.create-task-actions { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 10px; }
.create-task-actions .action-button { width: 100%; }
[data-theme="terminal"] .create-task-dialog { border-radius: 2px; }
.password-dialog { width: min(520px, calc(100% - 24px)); }
.mentions-dialog { width: min(690px, calc(100% - 24px)); }
.mention-center-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; margin: 6px 0 16px; }
.mention-center-toolbar p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.mention-center-toolbar b { color: var(--telegram); }
.mention-center-toolbar button { min-height: 38px; font-size: 10px; }
.mention-center-list { display: grid; gap: 8px; }
.mention-center-item { width: 100%; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--panel-2); text-align: left; }
.mention-center-item:hover { border-color: var(--telegram); }
.mention-center-item.unviewed { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel-2)); box-shadow: inset 3px 0 0 var(--accent); }
.mention-center-avatar { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; color: var(--telegram); background: var(--field); font-size: 11px; font-weight: 900; }
.mention-center-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mention-center-copy { min-width: 0; display: grid; gap: 4px; }
.mention-center-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mention-center-meta strong { color: var(--telegram); font-size: 12px; }
.mention-center-reason { padding: 3px 6px; border-radius: 999px; color: var(--accent-ink); background: var(--accent); font-size: 8px; font-weight: 950; letter-spacing: .04em; text-transform: uppercase; }
.mention-center-preview { overflow: hidden; color: var(--text); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.mention-center-item time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.mention-center-empty { padding: 28px 18px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); font-size: 12px; text-align: center; }
.mention-center-more { width: 100%; margin-top: 10px; }
.call-log-item { grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; }
.call-log-item.missed { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--panel-2)); box-shadow: inset 3px 0 0 var(--danger); }
.call-log-item .mention-center-reason { background: var(--telegram); color: #fff; }
.call-log-item.missed .mention-center-reason { background: var(--danger); color: #fff; }
.call-log-item.outgoing .mention-center-reason { color: var(--text); background: var(--field); }
.call-log-arrow { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--field); font-size: 17px; font-weight: 900; }
.call-log-item.missed .call-log-arrow { color: var(--danger); }
.call-log-item.outgoing .call-log-arrow { color: var(--muted); }
.call-log-item:not(.missed):not(.outgoing) .call-log-arrow { color: var(--accent); }
.password-dialog form { display: grid; }
.password-dialog .action-button { margin-top: 22px; }
.password-dialog[data-forced="true"] { border-color: var(--danger); box-shadow: 0 24px 90px #000c, 0 0 50px color-mix(in srgb, var(--danger) 18%, transparent); }
.forced-password-warning { display: grid; gap: 4px; margin: 8px 0 2px; padding: 12px 13px; border: 1px solid var(--danger); border-radius: 11px; color: #ffd5d5; background: color-mix(in srgb, var(--danger) 11%, var(--panel-2)); }
.forced-password-warning strong { color: var(--danger); font-size: 10px; letter-spacing: .07em; }
.forced-password-warning span { font-size: 11px; line-height: 1.35; }
.settings-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-section h3 { margin: 0 0 9px; }
.settings-section p { margin: 6px 0 12px; }
.notification-mode-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 9px; }
.notification-mode-picker button { min-height: 38px; padding: 7px; border: 1px solid var(--line); color: var(--muted); background: var(--field); font-size: 10px; font-weight: 850; }
.notification-mode-picker button.active { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.online-button { position: relative; color: var(--accent); font-size: 15px; }
.online-list { display: grid; gap: 7px; margin-top: 14px; }
.online-person { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); color: var(--text); background: var(--panel-2); text-align: left; }
.online-person-avatar, .profile-avatar { display: grid; place-items: center; overflow: hidden; color: var(--accent-ink); background: var(--accent); font-weight: 950; }
.online-person-avatar { width: 44px; height: 44px; border-radius: 13px; }
.online-person-avatar img, .profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.online-person-copy { min-width: 0; display: grid; gap: 2px; }
.online-person-copy small, .online-person > small { color: var(--muted); font-size: 9px; }
.online-person > small.online { color: var(--accent); }
.online-person-client { font-family: ui-monospace, monospace; font-weight: 800; letter-spacing: .02em; opacity: .75; }
.online-person-client.stale { color: var(--danger); opacity: 1; }
.user-profile-card { display: grid; justify-items: center; gap: 9px; padding: 24px 12px 10px; text-align: center; }
.profile-avatar { width: 112px; height: 112px; border-radius: 30px; font-size: 30px; }
.user-profile-card h3 { margin: 7px 0 0; font-size: 24px; }
.user-profile-card p { margin: 0; color: var(--muted); }
.profile-badge { padding: 5px 9px; border: 1px solid var(--accent); color: var(--accent); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.user-profile-card .profile-status { max-width: 420px; padding: 10px 14px; border-left: 3px solid var(--line); color: var(--text); font-style: italic; }
.user-profile-state { margin-top: 5px; padding: 6px 10px; border: 1px solid var(--line); font-size: 10px; font-weight: 900; }
.user-profile-state.online { color: var(--accent); border-color: var(--accent); }
.profile-editor-dialog { width: min(560px, calc(100vw - 24px)); }
.profile-editor-dialog form { display: grid; gap: 14px; }
.profile-editor-dialog label { display: grid; gap: 7px; color: var(--muted); font-weight: 800; }
.profile-editor-dialog input, .profile-editor-dialog textarea { width: 100%; box-sizing: border-box; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--field); font: inherit; resize: vertical; }
.profile-editor-avatar-row { display: flex; align-items: center; gap: 16px; }
.profile-editor-avatar-row > div { display: grid; gap: 7px; align-items: start; }
.profile-avatar-pick { cursor: pointer; }
.text-button { border: 0; color: var(--muted); background: transparent; text-align: left; text-decoration: underline; cursor: pointer; }
[data-theme="terminal"] .profile-editor-dialog input, [data-theme="terminal"] .profile-editor-dialog textarea { border-radius: 2px; }
.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-picker button, .action-button { min-height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; color: var(--text); background: var(--panel-2); font-weight: 750; }
.theme-picker button.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.action-button { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.action-button:disabled { opacity: .45; cursor: not-allowed; }
.action-button.secondary { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.apk-download { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; }
.apk-download b { font-size: 17px; }
.android-download > small { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.ios-app-note b { color: var(--danger); }
.install-help { font-size: 12px; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--field); }
.version-row code { color: var(--accent); font-size: 14px; font-weight: 900; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); padding: 11px 16px; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent-ink); background: var(--accent); box-shadow: 0 14px 40px #0008; font-size: 13px; font-weight: 800; text-align: center; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
[data-theme="terminal"] .brand-mark { border-radius: 2px; transform: none; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
[data-theme="terminal"] .bubble, [data-theme="terminal"] input, [data-theme="terminal"] textarea, [data-theme="terminal"] select, [data-theme="terminal"] button { border-radius: 2px; }
[data-theme="terminal"] .brand strong::after { content: "_"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
[data-theme="light"] .login-card { box-shadow: 0 26px 70px #5c574733; }
[data-theme="light"] .reply-bar { background: #f2eee4; }

/* macOS/desktop PWA shell. The phone remains the same application below 1180px. */
.desktop-sidebar, .desktop-context, .desktop-room-heading, .desktop-presence-refresh, .desktop-jump-latest { display: none; }

@media (min-width: 1180px) and (pointer: fine) {
  body {
    height: var(--app-height, 100dvh); overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    font-size: 14px; line-height: 1.4;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  }
  [data-theme="terminal"] body {
    font-family: "SFMono-Regular", "SF Mono", Menlo, Monaco, Consolas, monospace;
    font-size: 13px; line-height: 1.42;
  }
  .chat-view {
    width: 100%; max-width: none; height: var(--app-height, 100dvh); min-height: 0;
    grid-template-columns: 296px minmax(560px, 1fr) 326px;
    grid-template-rows: 64px auto auto minmax(0, 1fr) auto auto auto;
    border: 0; border-radius: 0; background: var(--bg);
  }
  .chat-view > :not(.desktop-sidebar):not(.desktop-context) { grid-column: 2; }
  .desktop-mode-hidden { display: none !important; }
  .search-button { display: none; }
  .desktop-sidebar {
    grid-column: 1; grid-row: 1 / -1; min-width: 0; display: flex; flex-direction: column;
    color: var(--text); background: color-mix(in srgb, var(--panel) 88%, var(--bg));
    border-right: 1px solid var(--line); overflow: hidden;
  }
  .desktop-brand { height: 72px; display: flex; align-items: center; gap: 11px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
  .desktop-brand-mark { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; color: var(--accent-ink); background: var(--accent); border-radius: 8px; font: 950 13px/1 ui-monospace, monospace; }
  .desktop-brand > span:last-child { display: grid; min-width: 0; }
  .desktop-brand strong { font-size: 20px; letter-spacing: -.025em; }
  [data-theme="terminal"] .desktop-brand strong::after { content: "_"; animation: blink 1s steps(1) infinite; }
  .desktop-brand small { display: flex; align-items: center; gap: 7px; color: var(--muted); font: 700 10px/1.3 ui-monospace, monospace; }
  .desktop-brand small i { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); }
  .desktop-brand small b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
  .desktop-search { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; margin: 15px 14px 10px; padding: 0 10px; color: var(--muted); background: var(--field); border: 1px solid var(--line); border-radius: 9px; }
  .desktop-search input { min-width: 0; height: 38px; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 12px; }
  .desktop-search kbd, .desktop-context kbd { color: var(--muted); background: transparent; font: 800 9px/1 ui-monospace, monospace; }
  .desktop-primary-nav { display: grid; gap: 5px; padding: 5px 12px 12px; }
  .desktop-primary-nav button, .desktop-primary-nav a { min-height: 46px; text-decoration: none; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 0 12px; color: var(--text); background: transparent; border: 0; border-radius: 9px; text-align: left; }
  .desktop-primary-nav button:hover, .desktop-primary-nav a:hover, .desktop-primary-nav button.active { background: var(--panel-2); }
  .desktop-primary-nav button > span, .desktop-primary-nav a > span { color: var(--accent); font: 950 18px/1 ui-monospace, monospace; text-align: center; }
  .desktop-primary-nav button > b, .desktop-primary-nav a > b { font-size: 13px; }
  .desktop-primary-nav button > i { min-width: 23px; height: 23px; display: grid; place-items: center; padding: 0 6px; color: var(--accent-ink); background: var(--accent); border-radius: 999px; font: 950 10px/1 ui-monospace, monospace; font-style: normal; }
  .desktop-live-section { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; border-top: 1px solid var(--line); }
  .desktop-live-section > header { display: flex; align-items: center; padding: 15px 17px 8px; color: var(--muted); font: 850 9px/1 ui-monospace, monospace; letter-spacing: .08em; }
  .desktop-presence-list { min-height: 0; overflow: auto; padding: 4px 10px 14px; scrollbar-width: thin; }
  .desktop-presence-group { display: grid; gap: 2px; }
  .desktop-presence-group + .desktop-presence-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
  .desktop-presence-group h4 { margin: 0; padding: 4px 8px; color: var(--muted); font: 850 9px/1.2 ui-monospace, monospace; letter-spacing: .05em; text-transform: uppercase; }
  .desktop-presence-group.online h4 { color: var(--accent); }
  .desktop-presence-group-list { display: grid; }
  .desktop-person, .desktop-conversation { width: 100%; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 8px; color: var(--text); background: transparent; border: 0; border-radius: 9px; text-align: left; }
  .desktop-person:hover, .desktop-conversation:hover, .desktop-conversation.active { background: var(--panel-2); }
  .desktop-person-avatar, .desktop-profile-avatar { position: relative; width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); border-radius: 50%; font: 850 12px/1 ui-monospace, monospace; }
  .desktop-person-avatar img, .desktop-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .desktop-person-copy { min-width: 0; display: grid; gap: 2px; }
  .desktop-person-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .desktop-person-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .desktop-person-copy small.online { color: var(--accent); }
  .desktop-person-client { font-family: ui-monospace, monospace; font-size: 9px; font-weight: 800; letter-spacing: .02em; opacity: .75; }
  .desktop-person-client.stale { color: var(--danger); opacity: 1; }
  .desktop-person-badge { min-width: 21px; height: 21px; display: grid; place-items: center; color: var(--accent-ink); background: var(--accent); border-radius: 50%; font: 950 9px/1 ui-monospace, monospace; }
  .desktop-profile-bar { display: grid; grid-template-columns: minmax(0,1fr) 42px 42px; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
  #desktop-logout-button { color: #ff9a9a; }
  .desktop-profile-bar > button { min-width: 0; color: var(--text); background: transparent; border: 0; }
  #desktop-profile-button { display: grid; grid-template-columns: 36px minmax(0,1fr); grid-template-rows: auto auto; align-items: center; gap: 1px 9px; text-align: left; }
  #desktop-profile-button .desktop-profile-avatar { grid-row: 1 / 3; width: 36px; height: 36px; }
  #desktop-profile-button b, #desktop-profile-button small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #desktop-profile-button b { font-size: 11px; } #desktop-profile-button small { color: var(--muted); font-size: 9px; }
  #desktop-settings-button { border: 1px solid var(--line); border-radius: 8px; }
  .topbar { grid-row: 1; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--line); }
  .topbar .brand { display: none; }
  .desktop-room-heading { min-width: 0; display: grid; gap: 2px; margin-right: auto; }
  .desktop-room-heading strong { font-size: 15px; }
  .desktop-room-heading small { color: var(--muted); font: 700 9px/1.3 ui-monospace, monospace; }
  .top-actions { margin-left: auto; }
  #current-user, .topbar .logout-button { display: none; }
  #online-button, #mentions-button, #calls-button { display: none; }
  #desktop-refresh-presence { display: grid; }
  .install-promo { grid-row: 2; }
  .pinned-bar { grid-row: 3; }
  .messages { grid-row: 4; min-width: 0; gap: 7px; padding: 18px 16px; scroll-padding-bottom: 90px; }
  .desktop-jump-latest {
    position: absolute; z-index: 24; left: calc(296px + (100% - 622px) / 2); bottom: 84px;
    display: block; transform: translateX(-50%); padding: 8px 13px;
    color: var(--accent-ink); background: var(--accent); border: 1px solid var(--accent);
    border-radius: 999px; box-shadow: 0 10px 30px #0009;
    font: 900 9px/1 ui-monospace, monospace; letter-spacing: .035em;
    transition: opacity .16s ease, transform .16s ease;
  }
  .desktop-jump-latest:hover { transform: translateX(-50%) translateY(-2px); }
  [data-theme="terminal"] .desktop-jump-latest { border-radius: 2px; }
  .messages .message { width: 100%; max-width: 100%; }
  .messages .message.web { margin-left: auto; }
  .messages .bubble { width: fit-content; max-width: 560px; padding: 6px 9px 4px; }
  .messages .message:not(.web) .bubble { justify-self: start; }
  .messages .message.web .bubble { justify-self: end; }
  .messages .body { margin: 4px 0 1px; font-size: 14px; line-height: 1.32; }
  .messages .sender { font-size: 12px; }
  .messages time { font-size: 9px; }
  .messages .message-footer { margin-top: 4px; }
  .messages .reaction-pill { min-height: 26px; gap: 4px; padding: 2px 6px; }
  .messages .reaction-actor-avatar { width: 20px; height: 20px; }
  .messages .reaction-add { min-height: 26px; padding: 2px 7px; }
  .messages .receipt-row { gap: 5px; }
  .messages .read-receipts .reader-face { width: 15px; height: 15px; }
  [data-theme="terminal"] .messages .body { font-size: 13px; line-height: 1.35; }
  .composer textarea, .composer-format-preview { font-size: 14px; }
  [data-theme="terminal"] .composer textarea,
  [data-theme="terminal"] .composer-format-preview { font-size: 13px; }
  .reply-bar { grid-row: 5; }
  .edit-bar { grid-row: 5; }
  .typing-state { grid-row: 6; }
  .composer { grid-row: 7; padding: 10px 16px; }
  .sticker-panel, .recording-panel { grid-column: 2 !important; }
  .desktop-context { grid-column: 3; grid-row: 1 / -1; min-width: 0; display: block; padding: 0 14px 18px; overflow-y: auto; background: color-mix(in srgb, var(--panel) 88%, var(--bg)); border-left: 1px solid var(--line); scrollbar-width: thin; }
  .desktop-context > header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; padding: 24px 4px 16px; color: var(--muted); background: color-mix(in srgb, var(--panel) 92%, var(--bg)); font: 850 9px/1 ui-monospace, monospace; letter-spacing: .08em; }
  .desktop-context-card { margin-bottom: 12px; padding: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
  .desktop-context-card h3 { margin: 0 0 11px; font-size: 13px; }
  .desktop-context-card button { padding: 0; color: var(--accent); background: transparent; border: 0; font: 850 9px/1.35 ui-monospace, monospace; text-align: left; }
  #desktop-context-mention-list, #desktop-context-task-list { display: grid; gap: 9px; margin-bottom: 12px; }
  .desktop-context-item { display: grid; gap: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
  .desktop-context-item strong { color: var(--text); font-size: 10px; }
  .desktop-context-item b { color: var(--accent); font: 850 9px/1.3 ui-monospace, monospace; }
  .desktop-transport-card p { display: flex; align-items: center; gap: 7px; margin: 8px 0 0; color: var(--muted); font: 700 9px/1.2 ui-monospace, monospace; }
  .desktop-transport-card i { width: 7px; height: 7px; border: 1px solid var(--muted); border-radius: 50%; }
  .desktop-transport-card i.online { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px var(--accent); }
}
@media (max-width: 620px) {
  html, body { height: 100%; min-height: 0; overflow: hidden; background: var(--panel); }
  .loading-card { border-radius: 20px; }
  .loading-machine { transform: scale(.9); }
  .update-banner { align-items: stretch; gap: 8px; flex-direction: column; }
  .update-banner > div { gap: 1px; }
  .update-banner strong { font-size: 12px; }
  .update-banner span { font-size: 11px; }
  .update-banner a { align-self: stretch; padding: 9px 12px; text-align: center; }
  .android-pwa-nag-card { min-height: min(420px, calc(var(--app-height, 100dvh) - 42px)); padding: 68px 32px; }
  button, .attach-button { touch-action: manipulation; }
  input, textarea, select { font-size: 16px; }
  #current-user { display: none; }
  .chat-view { position: fixed; top: var(--viewport-offset-top, 0px); right: 0; left: 0; width: 100%; max-width: none; height: var(--app-height, 100dvh); margin: 0; border: 0; grid-template-rows: calc(58px + env(safe-area-inset-top)) auto auto minmax(0, 1fr) auto auto auto; transform: none; }
  .topbar { min-width: 0; padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
  .brand { min-width: 0; gap: 9px; }
  .brand > div:last-child { min-width: 0; }
  .brand strong { font-size: 14px; }
  .brand small { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
  .top-actions { gap: 7px; }
  .logout-button { height: 34px; padding: 0 10px; font-size: 10px; }
  .icon-button { width: 34px; height: 34px; }
  .install-promo { grid-template-columns: auto minmax(0, 1fr); gap: 5px 9px; padding: 7px max(9px, env(safe-area-inset-right)) 7px max(9px, env(safe-area-inset-left)); }
  .install-promo-icon { grid-row: 1 / 3; }
  .install-promo small { white-space: normal; line-height: 1.25; }
  .install-promo a { grid-column: 2; justify-self: start; padding: 5px 8px; }
  .pinned-bar { grid-template-columns: 26px minmax(0, 1fr) auto 26px; min-height: 40px; }
  .pin-current { gap: 5px; padding: 4px; }
  .pin-icon { font-size: 16px; }
  .pin-copy small { font-size: 11px; }
  .pin-remove { width: 29px; }
  .messages { padding: 9px max(7px, env(safe-area-inset-right)) 12px max(7px, env(safe-area-inset-left)); gap: 8px; }
  .message { grid-template-columns: 36px minmax(0, 1fr); gap: 6px; max-width: 97%; }
  .message.web { max-width: 89%; }
  .avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 10px; }
  .bubble { min-width: 0; padding: 6px 8px 4px; border-radius: 3px 13px 13px 13px; }
  .web .bubble { border-radius: 14px 3px 14px 14px; }
  .message-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 8px; }
  .forward-origin { margin-bottom: 7px; }
  .sender { min-width: 0; overflow-wrap: anywhere; line-height: 1.15; }
  .mention-badge { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .message-stamp { grid-column: 2; grid-row: 1; }
  .body { font-size: 15px; line-height: 1.4; }
  .link-preview { grid-template-columns: 120px minmax(0, 1fr); }
  .link-preview img { min-height: 86px; }
  .link-preview > span { padding: 8px 9px; }
  .quoted { max-width: 100%; }
  .attachment { --media-cap: 55dvh; }
  .attachment.media-grid > * { height: clamp(110px, 38vw, 190px); }
  .media-viewer { grid-template: calc(54px + env(safe-area-inset-top)) minmax(0, 1fr) / 42px minmax(0, 1fr) 42px; }
  .media-stage img, .media-stage video { max-height: calc(100dvh - 54px - env(safe-area-inset-top) - 12px); }
  .media-viewer > header { gap: 8px; }
  .media-viewer header strong { font-size: 12px; }
  .media-viewer header a { font-size: 9px; }
  .media-nav { width: 36px; height: 54px; margin: 3px; padding: 0; font-size: 34px; }
  .message-actions button { opacity: .72; min-height: 20px; padding-top: 2px; font-size: 10px; }
  .body { margin-block: 4px 2px; }
  .receipt-row { margin-top: 3px; }
  .reply-bar { padding: 7px max(10px, env(safe-area-inset-right)) 7px max(12px, env(safe-area-inset-left)); }
  .composer { min-height: 50px; position: relative; z-index: 8; gap: 6px; padding: 5px max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); background: var(--panel); }
  .sticker-panel { left: max(7px, env(safe-area-inset-left)); right: max(7px, env(safe-area-inset-right)); bottom: calc(63px + env(safe-area-inset-bottom)); height: min(58vh, calc(var(--app-height, 100dvh) - 125px)); border-radius: 16px; }
  .sticker-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .composer-tools-menu { bottom: calc(100% + 7px); }
  .attach-button, .send-button, .emoji-button { flex-basis: 38px; width: 38px; height: 38px; border-radius: 10px; }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); max-height: 196px; }
  textarea { min-height: 38px; padding: 7px 9px; line-height: 1.3; }
  dialog { width: 100%; max-width: none; height: var(--app-height, 100dvh); max-height: none; margin: 0; border: 0; border-radius: 0; padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); overflow-y: auto; }
  .dialog-head { position: sticky; top: calc(-1 * max(18px, env(safe-area-inset-top))); z-index: 2; margin: calc(-1 * max(18px, env(safe-area-inset-top))) calc(-1 * max(14px, env(safe-area-inset-right))) 0 calc(-1 * max(14px, env(safe-area-inset-left))); padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left)); background: var(--topbar); backdrop-filter: blur(12px); }
  .dialog-head h2 { font-size: 28px; }
  .user-form { grid-template-columns: 1fr; }
  .user-row { flex-direction: column; align-items: stretch; }
  .user-row-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .user-row-actions select { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .user-row-actions .reset-password-button { white-space: normal; }
  .boob-admin-head { align-items: start; flex-direction: column; }
  .boob-library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-view { padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); place-items: center; }
  .login-card { width: 100%; padding: 26px 22px; border-radius: 20px; }
  .login-card h1 { font-size: clamp(36px, 12vw, 44px); }
  .theme-picker { grid-template-columns: 1fr; }
  .mention-center-toolbar { grid-template-columns: 1fr; }
  .mention-center-toolbar button { width: 100%; }
  .mention-center-item { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 10px; }
  .mention-center-avatar { width: 36px; height: 36px; border-radius: 10px; }
  .mention-center-item time { grid-column: 3; grid-row: 1; justify-self: end; }
}

@media (max-width: 350px) {
  .logout-button { max-width: none; padding-inline: 7px; font-size: 9px; }
  .brand small { max-width: 108px; }
  .message { max-width: 98%; }
  .message.web { max-width: 92%; }
  .messages { padding-inline: 6px; }
  .top-actions { gap: 4px; }
  .brand { gap: 6px; }
  .brand-mark.small { width: 30px; height: 30px; }
  .icon-button { width: 32px; height: 32px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .chat-view { grid-template-rows: 50px auto auto minmax(0, 1fr) auto auto auto; }
  .topbar { padding-top: 0; }
  .brand-mark.small { width: 32px; height: 32px; }
  .messages { padding-block: 8px; }
  .composer { min-height: 52px; padding-block: 4px; }
  .attach-button, .send-button { height: 42px; }
}

/* Сияние восьмёрки: сообщения, отправленные из DickTalk 8. */
.message.from-eight .bubble { box-shadow: 0 0 0 1px #37ff7255, 0 0 18px #37ff7233; animation: eight-glow 3.2s ease-in-out infinite; }
.message.from-eight .transport-badge { color: #021008; background: linear-gradient(90deg, #37ff72, #e7ff43); border-color: transparent; }
/* Кружок с расшифровкой: ширина как у кружка, а не как у самой длинной реплики. */
.message.has-video-note { max-width: min(560px, 82%); }
@keyframes eight-glow { 0%, 100% { box-shadow: 0 0 0 1px #37ff7255, 0 0 14px #37ff7226; } 50% { box-shadow: 0 0 0 1px #e7ff4388, 0 0 26px #e7ff4340; } }
@media (prefers-reduced-motion: reduce) { .message.from-eight .bubble { animation: none; } }

/* Голосования */
.body.poll-question { font-weight: 800; font-size: 15px; }
.poll { display: grid; gap: 8px; margin-top: 6px; }
.poll-meta { color: var(--muted); font: 900 9px/1.3 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.poll-options { display: grid; gap: 6px; }
.poll-option { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); text-align: left; overflow: hidden; cursor: pointer; }
.poll-option:disabled { cursor: default; opacity: .9; }
.poll-option .poll-bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 22%, transparent); transition: width .3s; pointer-events: none; }
.poll-option.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.poll-option-text { position: relative; font-size: 13px; overflow-wrap: anywhere; }
.poll-option-count { position: relative; font: 900 10px/1 ui-monospace, monospace; color: var(--accent); white-space: nowrap; }
.poll-voters { position: relative; grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.poll-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.poll-action { padding: 5px 10px; border: 1px solid var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 900 10px/1 ui-monospace, monospace; letter-spacing: .06em; cursor: pointer; }
.poll-action:disabled { opacity: .4; cursor: default; }
.poll-action.danger { border-color: var(--danger); color: var(--danger); }
.poll-form { display: grid; gap: 12px; padding: 4px 0 0; }
.poll-form label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.poll-form input[type="text"], .poll-form textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; }
.poll-form .poll-check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.poll-form-error { margin: 0; color: var(--danger); font-size: 12px; }
.poll-form-actions { display: flex; justify-content: flex-end; }
.poll-form .primary-button { padding: 10px 14px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 900 11px/1 ui-monospace, monospace; letter-spacing: .08em; cursor: pointer; }

/* Звук уведомлений */
.sound-settings { display: grid; gap: 8px; margin-top: 14px; }
.sound-settings h4 { margin: 0; font: 900 11px/1.2 ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sound-list { display: grid; gap: 6px; }
.sound-group { margin-top: 6px; color: var(--accent); font: 900 9px/1.4 ui-monospace, monospace; letter-spacing: .12em; }
.sound-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.sound-pick { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); text-align: left; font-size: 13px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-pick.active { border-color: var(--accent); color: var(--accent); font-weight: 800; }
.sound-play, .sound-remove { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); cursor: pointer; }
.sound-remove { color: var(--danger); }
.sound-upload { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px dashed var(--accent); border-radius: 10px; color: var(--accent); font: 900 10px/1 ui-monospace, monospace; letter-spacing: .08em; cursor: pointer; width: fit-content; }
.sound-upload input { display: none; }

/* Звонки в PWA: полноэкранный оверлей входящего, исходящего и разговора. */
.call-overlay { position: fixed; inset: 0; z-index: 260; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 88%, black); padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.call-overlay.hidden { display: none; }
.call-card { width: min(420px, 100%); display: grid; justify-items: center; gap: 12px; text-align: center; }
.call-card h2 { margin: 0; font-size: 1.6rem; }
.call-avatar { width: 112px; height: 112px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 2.4rem; }
.call-avatar img { width: 100%; height: 100%; object-fit: cover; }
.call-status { margin: 0; color: var(--muted); }
.call-timer { margin: 0; font: 700 1.4rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.call-actions { display: flex; gap: 22px; margin-top: 18px; }
.call-button { width: 78px; height: 78px; border-radius: 50%; border: 0; display: grid; place-items: center; gap: 2px; font-size: 1.6rem; color: #fff; cursor: pointer; }
.call-button small { font-size: .6rem; font-weight: 900; letter-spacing: .06em; }
.call-button.accept { background: #2fbf5f; animation: callPulse 1.2s infinite; }
.call-button.hangup { background: #e0313b; }
.call-button.neutral { background: #444a55; }
.call-button.neutral.active { background: var(--accent); color: var(--accent-ink); }
.call-button.hidden { display: none; }
.online-call { margin-left: auto; font-size: 1.15rem; padding: 6px 8px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.online-call.muted { background: transparent; opacity: .35; }
.profile-call-button { margin-top: 12px; }
@keyframes callPulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(47,191,95,.25); } }

.settings-logout { width: 100%; height: 44px; margin-top: 8px; }
