/* Unimess — интерфейс в духе iOS-мессенджеров */
:root {
  --accent: #007aff;
  --tg: #007aff;
  --max: #7b5cfa;
  --red: #ff3b30;
  --green: #34c759;
  --orange: #ff9500;
  --gray-action: #8e8e93;

  --bg: #ffffff;
  --bar: rgba(247, 247, 247, .86);
  --grouped: #efeff4;
  --cell: #ffffff;
  --text: #000000;
  --text-2: #8e8e93;
  --sep: rgba(60, 60, 67, .22);
  --pinned: #f7f7f7;
  --field: rgba(118, 118, 128, .12);
  --badge-muted: #a7a7ac;

  --wall-1: #d4e5c2;
  --wall-2: #e7e9bf;
  --wall-3: #b9d8c6;
  --wall-dots: rgba(255, 255, 255, .35);
  --bubble-in: #ffffff;
  --bubble-out: #effdde;
  --text-out: #000000;
  --meta-in: #a1aab3;
  --meta-out: #5fb35d;
  --tick-read: #4fae4e;
  --pill: rgba(0, 0, 0, .22);

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --app-h: 100dvh;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #0a84ff;
    --tg: #0a84ff;
    --bg: #000000;
    --bar: rgba(28, 28, 29, .86);
    --grouped: #000000;
    --cell: #1c1c1e;
    --text: #ffffff;
    --text-2: #8e8e93;
    --sep: rgba(84, 84, 88, .55);
    --pinned: #1c1c1d;
    --field: rgba(118, 118, 128, .24);
    --badge-muted: #5a5a5e;

    --wall-1: #0f1b24;
    --wall-2: #13212c;
    --wall-3: #0c1720;
    --wall-dots: rgba(255, 255, 255, .03);
    --bubble-in: #1f2c38;
    --bubble-out: #2b5278;
    --text-out: #ffffff;
    --meta-in: #6d7f8f;
    --meta-out: #8fbbe0;
    --tick-read: #8fd0ff;
    --pill: rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
body[data-p="max"] { --accent: var(--max); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow-x: hidden; }
body {
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { flex: none; }

/* ===== заставка ===== */
.splash { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--bg); color: var(--text-2); font-size: 15px; text-align: center; padding: 24px; }
.splash img { border-radius: 18px; }

/* ===== вход ===== */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--grouped); }
.login-card { width: min(380px, 100%); display: grid; gap: 14px; text-align: center; }
.login-logo { justify-self: center; border-radius: 22px; }
.login h1 { margin: 6px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.login-sub { margin: 0 0 10px; color: var(--text-2); font-size: 15px; }
.ios-group { background: var(--cell); border-radius: 12px; overflow: hidden; text-align: left; }
.ios-group input {
  display: block; width: 100%; border: 0; background: none; padding: 13px 16px; font-size: 17px; outline: none;
}
.ios-group input + input { border-top: .5px solid var(--sep); }
.form-error { color: var(--red); margin: 0; min-height: 1.2em; font-size: 14px; }
.login-note { color: var(--text-2); font-size: 13px; margin: 0; }
.btn-primary {
  background: var(--accent); color: #fff; border-radius: 12px; padding: 14px; font-weight: 600; font-size: 17px;
}
.btn-primary:disabled { opacity: .5; }

/* ===== каркас ===== */
.app { height: var(--app-h); display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; width: 100%; }
.side { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
  height: var(--app-h); background: var(--bg); }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding-bottom: calc(60px + var(--safe-bottom)); }
.chat {
  min-width: 0;
  position: fixed; inset: 0; height: var(--app-h); z-index: 20; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .32s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
}
.app.chat-open .chat { transform: none; visibility: visible; }
@media (min-width: 900px) {
  .app { grid-template-columns: 380px minmax(0, 1fr); }
  .side { border-right: .5px solid var(--sep); }
  .chat { position: relative; transform: none; visibility: visible; transition: none; z-index: auto; }
  .back { visibility: hidden; pointer-events: none; }
}

/* ===== навбар ===== */
.navbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  height: calc(44px + var(--safe-top)); padding-top: var(--safe-top);
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep);
}
.nav-title { font-weight: 600; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-2); border-top-color: transparent;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search { position: relative; margin: 8px 16px 6px; display: flex; align-items: center; }
.search svg { position: absolute; left: 9px; color: var(--text-2); pointer-events: none; }
.search input {
  width: 100%; height: 36px; border: 0; border-radius: 10px; background: var(--field);
  padding: 0 10px 0 31px; font-size: 17px; outline: none; -webkit-appearance: none;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ===== список чатов ===== */
.row-wrap { position: relative; overflow: hidden; background: var(--bg); }
.row-wrap.pinned, .row-wrap.pinned .row { background: var(--pinned); }
.row {
  position: relative; z-index: 1; display: flex; gap: 10px; align-items: center; width: 100%;
  padding: 0 0 0 10px; text-align: left; background: var(--bg); touch-action: pan-y;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.row.dragging { transition: none; }
.row:active { background: var(--field); }
.row-wrap .row.active { background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center;
  height: 76px; padding-right: 14px; border-bottom: .5px solid var(--sep); }
.row-wrap:last-child .row .body { border-bottom: 0; }
.row .top, .row .bottom { display: flex; align-items: flex-start; gap: 6px; }
.row .name { flex: 1; min-width: 0; font-weight: 600; font-size: 16.5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.row .name .t { overflow: hidden; text-overflow: ellipsis; }
.row .name svg { color: var(--text-2); }
.row .time { font-size: 14px; color: var(--text-2); padding-top: 2px; }
.row .preview {
  flex: 1; min-width: 0; color: var(--text-2); font-size: 15px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px;
  overflow-wrap: anywhere; word-break: break-word;
}
.row .side-icons { display: flex; align-items: center; gap: 4px; padding-top: 4px; color: var(--badge-muted); }
.badge {
  min-width: 21px; height: 21px; padding: 0 6.5px; border-radius: 11px; display: inline-grid; place-items: center;
  font-size: 14px; font-weight: 500; color: #fff; background: var(--accent); font-variant-numeric: tabular-nums;
}
.badge.muted { background: var(--badge-muted); }

.avatar {
  width: 58px; height: 58px; border-radius: 50%; flex: none; overflow: hidden; display: grid; place-items: center;
  font-weight: 600; color: #fff; font-size: 22px; letter-spacing: -.01em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.saved { background: linear-gradient(180deg, #72d5fd, #2a9ef1) !important; }

/* действия свайпом */
.actions { position: absolute; top: 0; bottom: 0; display: flex; }
.actions.left { left: 0; }
.actions.right { right: 0; }
.act {
  width: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: #fff; font-size: 13px; font-weight: 500;
}
.act.blue { background: var(--accent); }
.act.green { background: var(--green); }
.act.orange { background: var(--orange); }
.act.gray { background: var(--gray-action); }

.list-section { padding: 18px 16px 6px; font-size: 13px; color: var(--text-2); text-transform: none; }
.list-empty { padding: 48px 24px; color: var(--text-2); text-align: center; font-size: 15px; }
.banner { margin: 8px 16px; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--orange) 14%, transparent); }

/* ===== подключение аккаунта ===== */
.auth-panel { padding: 28px 16px; display: grid; gap: 14px; text-align: center; }
.auth-panel h2 { margin: 0; font-size: 22px; font-weight: 700; }
.auth-panel p { margin: 0; color: var(--text-2); font-size: 15px; }
.auth-form { display: grid; gap: 14px; margin-top: 6px; }
.auth-form input {
  width: 100%; border: 0; border-radius: 12px; background: var(--field); padding: 14px 16px; font-size: 17px;
  text-align: center; outline: none;
}
.auth-steps { margin: 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; text-align: left; font-size: 15px; }
.auth-steps a { color: var(--accent); }

/* ===== нижние вкладки ===== */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 0 calc(4px + var(--safe-bottom));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-2); font-size: 10.5px;
  font-weight: 500; position: relative; padding: 1px 0; }
.tab[aria-selected="true"] { color: var(--tab-color, var(--accent)); }
.tab .ic { position: relative; height: 28px; display: grid; place-items: center; }
.tab .badge { position: absolute; top: -4px; left: 16px; height: 18px; min-width: 18px; font-size: 12px; padding: 0 5px;
  background: var(--red); }
.tab .warn-dot { position: absolute; top: 0; right: -6px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }

/* ===== настройки ===== */
.grouped { background: var(--grouped); }
.g-title { padding: 22px 32px 6px; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .02em; }
.g-foot { padding: 6px 32px 0; font-size: 13px; color: var(--text-2); }
.g-list { margin: 0 16px; background: var(--cell); border-radius: 12px; overflow: hidden; }
.cell { display: flex; align-items: center; gap: 12px; min-height: 48px; padding-left: 16px; width: 100%; text-align: left; }
.cell .c-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 11px 16px 11px 0;
  border-bottom: .5px solid var(--sep); min-height: 48px; }
.cell:last-child .c-body { border-bottom: 0; }
.cell .c-text { flex: 1; min-width: 0; display: grid; }
.cell .c-sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.cell .c-value { color: var(--text-2); font-size: 16px; }
.cell .c-action { color: var(--accent); font-size: 16px; }
.cell.danger { color: var(--red); justify-content: center; }
.cell.link { color: var(--accent); }
.c-icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 15px;
  font-weight: 700; flex: none; }

/* ===== открытый чат ===== */
.chat {
  background-color: var(--wall-2);
  background-image:
    radial-gradient(var(--wall-dots) 1.2px, transparent 1.3px),
    linear-gradient(160deg, var(--wall-1), var(--wall-2) 55%, var(--wall-3));
  background-size: 22px 22px, 100% 100%;
}
.chat-empty { flex: 1; display: grid; place-items: center; }
.chat-empty span { background: var(--pill); color: #fff; padding: 4px 12px; border-radius: 14px; font-size: 14px; }
.chat-head {
  display: grid; grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr); align-items: center;
  height: calc(54px + var(--safe-top)); padding: var(--safe-top) 10px 0 6px; z-index: 3;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep);
}
@media (min-width: 900px) { .chat-head { grid-template-columns: 1fr auto 1fr; } }
.back { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 17px; justify-self: start; padding: 8px 4px; }
.back .badge { height: 20px; min-width: 20px; font-size: 13px; }
.chat-title { display: grid; justify-items: center; max-width: 60vw; line-height: 1.2; }
.chat-title strong { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  display: flex; align-items: center; gap: 4px; }
.chat-title > span { font-size: 13px; color: var(--text-2); }
.chat-title .tt { overflow: hidden; text-overflow: ellipsis; }
.chat-title strong svg { color: var(--text-2); }
.head-avatar { justify-self: end; }
.head-avatar .avatar { width: 38px; height: 38px; font-size: 15px; }

.messages {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 8px 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.day { align-self: center; margin: 10px 0 6px; padding: 3px 10px; border-radius: 12px; font-size: 13.5px; font-weight: 500;
  background: var(--pill); color: #fff; position: sticky; top: 4px; z-index: 2; }
.loader { align-self: center; padding: 3px 10px; margin: 8px 0; border-radius: 12px; font-size: 13px; background: var(--pill); color: #fff; }

.msg { display: flex; max-width: min(82%, 520px); position: relative; touch-action: pan-y; }
.msg.out { align-self: flex-end; }
.msg.first { margin-top: 6px; }
.msg .swipe-hint { position: absolute; right: -36px; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0;
  width: 28px; height: 28px; border-radius: 50%; background: var(--pill); color: #fff; display: grid; place-items: center; }
.bubble {
  position: relative; background: var(--bubble-in); padding: 6px 10px 6px 11px; border-radius: 17px;
  min-width: 56px; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
  box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
}
.msg.out .bubble { background: var(--bubble-out); color: var(--text-out); }
/* хвостик у последнего сообщения в группе */
.msg.last:not(.out) .bubble { border-bottom-left-radius: 5px; }
.msg.last.out .bubble { border-bottom-right-radius: 5px; }
.msg.last .bubble::after {
  content: ""; position: absolute; bottom: 0; width: 12px; height: 16px; background: inherit;
  -webkit-mask: var(--tail) no-repeat; mask: var(--tail) no-repeat;
}
.msg.last:not(.out) .bubble::after { left: -6px; --tail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath d='M12 0v16H0c4-1 7-4 8-9 .6-3 1.6-5.5 4-7Z'/%3E%3C/svg%3E"); }
.msg.last.out .bubble::after { right: -6px; --tail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath d='M0 0v16h12C8 15 5 12 4 7 3.4 4 2.4 1.5 0 0Z'/%3E%3C/svg%3E"); }
.bubble .who { font-size: 14px; font-weight: 600; display: block; margin-bottom: 1px; }
.bubble .text { white-space: pre-wrap; font-size: 16.5px; line-height: 1.3; }
.bubble .text a { color: var(--accent); }
.msg.out .bubble .text a { color: inherit; text-decoration: underline; }
.bubble .meta {
  float: right; margin: 8px 0 -6px 8px; font-size: 11.5px; color: var(--meta-in); display: inline-flex; align-items: center;
  gap: 2px; font-variant-numeric: tabular-nums; user-select: none; -webkit-user-select: none;
}
.msg.out .bubble .meta { color: var(--meta-out); }
.bubble .meta.on-media {
  position: absolute; right: 8px; bottom: 8px; margin: 0; padding: 1px 6px; border-radius: 10px;
  background: rgba(0, 0, 0, .45); color: #fff !important;
}
.msg.deleted .text { color: var(--text-2); font-style: italic; }
.ticks { width: 17px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ticks.read { color: var(--tick-read); }
.quote {
  border-left: 3px solid var(--accent); padding: 2px 8px; margin: 2px 0 5px; font-size: 14.5px; border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 10%, transparent); max-width: 300px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg.out .quote { border-left-color: var(--meta-out); background: color-mix(in srgb, var(--meta-out) 16%, transparent); }
.quote b { display: block; font-weight: 600; color: var(--accent); font-size: 13.5px; }
.msg.out .quote b { color: var(--meta-out); }

.media { display: block; margin: -2px -7px 4px -8px; border-radius: 14px; overflow: hidden; background: rgba(0, 0, 0, .06); }
.bubble.media-only { padding: 3px; }
.bubble.media-only .media { margin: 0; }
.media img, .media video { display: block; max-width: 100%; max-height: 380px; width: auto; height: auto; }
.media img { cursor: zoom-in; min-width: 140px; min-height: 90px; object-fit: cover; }
.bubble.sticker-only { background: none; box-shadow: none; padding: 0; }
.bubble.sticker-only::after { display: none; }
.sticker { background: none; margin: 0; }
.sticker img, .sticker video { max-width: 170px; max-height: 170px; }
.video-note video { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; }
.ext-link { display: inline-block; margin: 4px 0; color: var(--accent); }

.voice { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 3px 0 2px; }
.voice .play {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none;
}
.msg.out .voice .play { background: var(--meta-out); }
.voice .wave { flex: 1; height: 22px; display: flex; align-items: center; gap: 2px; }
.voice .wave i { flex: 1; border-radius: 2px; background: color-mix(in srgb, currentColor 30%, transparent); min-height: 3px; }
.voice .wave i.on { background: var(--accent); }
.msg.out .voice .wave i.on { background: var(--meta-out); }
.voice .dur { font-size: 12px; color: var(--meta-in); font-variant-numeric: tabular-nums; }
.msg.out .voice .dur { color: var(--meta-out); }

.file { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 3px 0; }
.file .ic { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.msg.out .file .ic { background: var(--meta-out); }
.file .fn { font-weight: 500; font-size: 15px; display: block; overflow-wrap: anywhere; }
.file .fs { font-size: 13px; color: var(--meta-in); }
.msg.out .file .fs { color: var(--meta-out); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 1px; }
.react {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 14px; padding: 3px 9px 3px 7px;
  background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.msg.out .react { background: color-mix(in srgb, var(--meta-out) 22%, transparent); color: var(--meta-out); }
.react .re { font-size: 16px; line-height: 1; }
.react.mine, .msg.out .react.mine { background: var(--accent); color: #fff; }
.msg.out .react.mine { background: var(--meta-out); }

/* ===== поле ввода ===== */
.composer {
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep); padding-bottom: var(--safe-bottom);
}
.app.kb-open .composer { padding-bottom: 0; }
.compose-row { display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; color: var(--text-2); flex: none; cursor: pointer; }
.compose-row textarea {
  flex: 1; resize: none; border: .5px solid var(--sep); background: var(--bg); border-radius: 19px;
  padding: 8px 14px; max-height: 140px; line-height: 1.3; font-size: 17px; outline: none; min-height: 38px;
}
.round-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.round-btn.mic { background: none; color: var(--text-2); }
.round-btn:disabled { opacity: .5; }
.reply-bar, .files-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 0 12px; }
.reply-bar > svg { color: var(--accent); }
.reply-bar div { flex: 1; min-width: 0; border-left: 2px solid var(--accent); padding-left: 8px; display: grid; font-size: 14.5px; }
.reply-bar strong { color: var(--accent); font-weight: 600; font-size: 14px; }
.reply-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-btn { color: var(--text-2); font-size: 18px; width: 30px; height: 30px; }
.chips { flex: 1; display: flex; gap: 6px; overflow-x: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--field); border-radius: 10px; padding: 6px 8px 6px 10px;
  font-size: 13px; white-space: nowrap; }
.chip button { color: var(--text-2); }
.as-files { font-size: 13px; color: var(--text-2); white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite alternate; }
#recTime { font-variant-numeric: tabular-nums; }
/* запись голосового: поле ввода прячется, кнопка микрофона увеличивается */
.rec-inline { flex: 1; min-width: 0; height: 38px; display: flex; align-items: center; gap: 10px; padding-left: 8px; font-size: 16px; }
.rec-hint { flex: 1; text-align: center; color: var(--text-2); font-size: 15px; white-space: nowrap; transition: opacity .1s; }
.composer.recording .compose-row > .icon-btn, .composer.recording #input { display: none; }
.mic-wrap { position: relative; flex: none; }
#sendBtn { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.composer.recording #sendBtn { background: var(--accent); color: #fff; transform: scale(1.55); transition: transform .15s;
  box-shadow: 0 0 0 calc(var(--lvl, 0) * 14px) color-mix(in srgb, var(--accent) 25%, transparent); }
.composer.locked #sendBtn { transform: none; box-shadow: none; }
.rec-lock {
  position: absolute; bottom: 62px; left: 50%; transform: translateX(-50%); width: 36px; padding: 8px 0 6px;
  border-radius: 18px; background: var(--cell); color: var(--text-2); display: flex; flex-direction: column;
  align-items: center; gap: 2px; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); animation: lock-in .2s ease-out;
}
.rec-lock.armed { color: var(--accent); }
@keyframes lock-in { from { opacity: 0; transform: translate(-50%, 10px); } }
.link-btn { color: var(--accent); padding: 8px; }
@keyframes pulse { to { opacity: .25; } }

/* ===== листы действий ===== */
dialog { border: 0; padding: 0; color: var(--text); background: transparent; }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(560px, 100%); max-width: 100%;
  padding: 0 8px calc(8px + var(--safe-bottom)); display: none;
}
.sheet[open] { display: grid; gap: 8px; animation: sheet-up .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-group { background: color-mix(in srgb, var(--cell) 92%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-radius: 14px; overflow: hidden; }
.sheet-title { padding: 12px 16px; text-align: center; font-size: 13px; color: var(--text-2); border-bottom: .5px solid var(--sep); }
.sheet-btn { display: block; width: 100%; padding: 17px 16px; text-align: center; font-size: 19px; color: var(--accent); }
.sheet-btn + .sheet-btn { border-top: .5px solid var(--sep); }
.sheet-btn.danger { color: var(--red); }
.sheet-btn.cancel { font-weight: 600; }
.quick-reacts { display: flex; padding: 8px 6px; border-bottom: .5px solid var(--sep); }
.quick-reacts button { flex: 1 1 0; min-width: 0; padding: 6px 0; font-size: 27px; text-align: center; border-radius: 10px; line-height: 1; }
.quick-reacts button.mine { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.quick-reacts + .sheet-btn { border-top: 0; }

.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; background: transparent; }
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: rgba(0, 0, 0, .94); }
.viewer img { max-width: 100vw; max-height: 100dvh; display: block; }

.toast {
  position: fixed; left: 50%; top: calc(54px + var(--safe-top)); transform: translateX(-50%); z-index: 50;
  background: rgba(30, 30, 30, .9); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14.5px;
  max-width: 90vw; text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
