/* Стили для голосовых, кружков, стикеров, звонков, файлов, фонов и закреплённых чатов */
.accent-text { color: var(--accent); }
.small { padding: 6px 12px !important; font-size: 13px; }
.dim { opacity: .6; }
.head-actions { margin-left: auto; display: flex; gap: 2px; }

/* ---------- Закреплённые чаты и перетаскивание ---------- */
.pin-icon { font-size: 12px; opacity: .7; flex-shrink: 0; }
.chat-item.dragging { opacity: .4; }
.chat-item.drop-target { box-shadow: inset 0 3px 0 var(--accent); }
.chat-item.pinned + .chat-item:not(.pinned) { margin-top: 9px; position: relative; overflow: visible; }
.chat-item.pinned + .chat-item:not(.pinned)::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: -5px; border-top: 1px solid var(--border);
}

/* ---------- Фоны чатов ---------- */
.messages.has-wallpaper .day-sep, .messages.has-wallpaper .sys-msg { background: rgba(0,0,0,.35); color: #fff; }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.wp-tile {
  aspect-ratio: 3/4; border-radius: 12px; border: 2px solid transparent; position: relative; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center; padding: 0; background-color: var(--panel-2);
}
.wp-tile span { background: rgba(0,0,0,.45); color: #fff; font-size: 11px; width: 100%; padding: 3px 0; }
.wp-tile.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.wp-tile.upload { border: 2px dashed var(--border); align-items: center; }
.wp-tile.upload span { background: none; color: var(--muted); font-size: 13px; }
.check-row { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Стикеры и кружки — без «пузыря» ---------- */
.bubble.bare { background: none !important; box-shadow: none; padding: 0; min-width: 0; }
.bubble.bare .meta {
  float: none; display: inline-flex; margin: 2px 0 0; background: rgba(0,0,0,.35); color: #fff !important;
  padding: 1px 7px; border-radius: 10px;
}
.out .bubble.bare { text-align: right; }
.bubble.bare .meta .ticks.read { color: #8fd3ff; }
.sticker-img { display: block; width: 160px; height: 160px; object-fit: contain; }
.sticker-emoji { font-size: 110px; line-height: 1.1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); }

.note { position: relative; width: 220px; height: 220px; border-radius: 50%; cursor: pointer; }
.note-video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #000; display: block; }
.note-ring, .video-preview .ring {
  position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}
.note-play {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.5);
  color: #fff; display: grid; place-items: center; font-size: 22px; padding-left: 4px;
}
.note-time {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(0,0,0,.5);
  color: #fff; font-size: 12px; padding: 1px 8px; border-radius: 10px;
}

/* ---------- Голосовые ---------- */
.bubble.voice { min-width: 250px; }
.voice-msg { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.play-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; flex-shrink: 0;
  font-size: 14px; display: grid; place-items: center;
}
.voice-body { flex: 1; min-width: 0; }
.wave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.wave span { flex: 1; min-width: 2px; background: color-mix(in srgb, currentColor 30%, transparent); border-radius: 2px; }
.wave span.played { background: var(--accent); }
.out .wave span.played { background: color-mix(in srgb, var(--bubble-out-text) 85%, transparent); }
.voice-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.voice-foot .meta { margin: 0 0 0 auto !important; float: none; }
.speed-btn {
  border: 0; background: color-mix(in srgb, currentColor 12%, transparent); border-radius: 8px;
  font-size: 11px; padding: 1px 6px; color: inherit;
}
.out .voice-foot { color: color-mix(in srgb, var(--bubble-out-text) 60%, transparent); }

/* ---------- Запись ---------- */
.recording { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; flex-shrink: 0; }
@keyframes blink { 50% { opacity: .2; } }
#recTime { font-variant-numeric: tabular-nums; min-width: 40px; }
.rec-hint { flex: 1; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-preview { position: relative; width: 240px; height: 240px; margin: 12px auto 0; }
.video-preview video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; transform: scaleX(-1); background: #000; }

/* ---------- Панель эмодзи и стикеров ---------- */
.panel { border-bottom: 1px solid var(--border); height: 300px; display: flex; flex-direction: column; }
.panel-tabs { display: flex; gap: 4px; padding: 6px 10px 0; }
.panel-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); }
.panel-tabs button.active { background: var(--panel-2); color: var(--text); }
.panel-body { flex: 1; overflow-y: auto; padding: 6px 10px 10px; }
.panel-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 2px 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.emoji { border: 0; background: none; font-size: 24px; height: 40px; border-radius: 8px; padding: 0; }
.emoji:hover, .sticker-cell:hover { background: var(--panel-2); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px; }
.sticker-cell { border: 0; background: none; aspect-ratio: 1; border-radius: 10px; padding: 4px; display: grid; place-items: center; }
.sticker-cell img { width: 100%; height: 100%; object-fit: contain; }
.sticker-cell.emoji-sticker { font-size: 44px; }
.sticker-cell.add { border: 2px dashed var(--border); font-size: 28px; color: var(--muted); }
.small-note { font-size: 13px; padding: 4px 2px; }

/* ---------- Передача файлов ---------- */
.file-card { min-width: 260px; max-width: 340px; }
.file-head { display: flex; gap: 10px; align-items: center; }
.file-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft);
  display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
}
.file-info { min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 12px; }
.file-bar { height: 4px; background: color-mix(in srgb, currentColor 12%, transparent); border-radius: 2px; margin: 8px 0 4px; overflow: hidden; }
.file-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.file-status { font-size: 12px; color: var(--muted); }
.out .file-status { color: color-mix(in srgb, var(--bubble-out-text) 65%, transparent); }
.file-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.file-actions:empty { display: none; }

/* ---------- Настройки в профиле ---------- */
.settings-block { display: flex; flex-direction: column; }
.settings-block:empty { display: none; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }

/* ---------- Звонки ---------- */
.call-banner { border: 0; background: var(--accent); color: #fff; padding: 8px 14px; text-align: left; font-weight: 600; font-size: 14px; }
.call-overlay {
  position: fixed; inset: 0; z-index: 45; background: #0b1118; color: #fff; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.call-top { display: flex; align-items: center; padding: 12px 16px; gap: 10px; }
.call-title { flex: 1; display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.call-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-status { font-size: 13px; color: #9fb1c3; font-variant-numeric: tabular-nums; }
.call-min { border: 0; background: rgba(255,255,255,.1); color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; flex-shrink: 0; }
.call-grid {
  flex: 1; display: grid; gap: 8px; padding: 8px; min-height: 0; position: relative;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); grid-auto-rows: 1fr;
}
.call-grid[data-count="2"] { grid-template-columns: 1fr; }
.call-grid[data-count="2"] .call-tile.local {
  position: absolute; right: 16px; bottom: 16px; width: min(28vw, 200px); aspect-ratio: 3/4; z-index: 2;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.call-tile { position: relative; background: #1a2430; border-radius: 16px; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-tile.screen video { object-fit: contain; background: #000; }
.call-tile.mirror video { transform: scaleX(-1); }
.call-tile .tile-avatar { position: absolute; inset: 0; display: none; place-items: center; }
.call-tile.no-video video { opacity: 0; }
.call-tile.no-video .tile-avatar { display: grid; }
.call-tile.connecting .tile-avatar .avatar { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.95); } }
.tile-name {
  position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.5); padding: 3px 10px;
  border-radius: 10px; font-size: 13px; display: flex; gap: 4px;
}
.call-controls { display: flex; justify-content: center; gap: 14px; padding: 14px; }
.call-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 22px;
  display: grid; place-items: center; flex-shrink: 0;
}
.call-btn:hover { background: rgba(255,255,255,.22); }
.call-btn.off { background: #fff; color: #111; }
.call-btn.active { background: var(--accent); }
.call-btn.hang { background: var(--danger); transform: rotate(135deg); }
.call-btn.accept { background: #22c55e; }
.call-overlay.minimized {
  inset: 12px 12px auto auto; width: 300px; border-radius: 16px; box-shadow: var(--shadow); padding: 0;
}
.call-overlay.minimized .call-grid {
  position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; padding: 0;
}
.call-overlay.minimized .call-controls { padding: 0 12px 12px; gap: 10px; }
.call-overlay.minimized .call-btn { width: 42px; height: 42px; font-size: 17px; }
.call-overlay.minimized .call-min { transform: rotate(180deg); }
.incoming-call {
  position: fixed; z-index: 55; left: 50%; top: 20px; transform: translateX(-50%); width: min(340px, calc(100% - 32px));
  background: #17212b; color: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; animation: drop .25s;
}
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }
.incoming-actions { display: flex; gap: 18px; margin-top: 10px; }

/* ---------- Реакции ---------- */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; clear: both; }
.bubble.bare .reactions { justify-content: flex-start; }
.out .bubble.bare .reactions { justify-content: flex-end; }
.reaction {
  border: 1px solid transparent; background: color-mix(in srgb, var(--accent) 14%, transparent); color: inherit;
  border-radius: 14px; padding: 1px 8px; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; line-height: 1.5;
}
.reaction b { font-size: 12px; font-weight: 600; }
.reaction.mine { background: var(--accent); color: #fff; }
.out .reaction:not(.mine) { background: color-mix(in srgb, var(--bubble-out-text) 12%, transparent); }
.bubble.bare .reaction:not(.mine) { background: rgba(0,0,0,.35); color: #fff; }
.reaction-bar { display: flex; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu .reaction-bar button { width: 34px; height: 34px; padding: 0; text-align: center; font-size: 20px; border-radius: 50%; transition: transform .1s; }
.menu .reaction-bar button:hover { transform: scale(1.2); background: var(--panel-2); }
.menu .reaction-bar button.mine { background: var(--accent-soft); }

/* Многострочные системные сообщения (например, сводка статусов) */
.sys-msg.multi { white-space: pre-line; text-align: left; max-width: min(460px, 90%); padding: 10px 16px; line-height: 1.5; }

/* ---------- Без звука ---------- */
.muted-icon { font-size: 12px; opacity: .65; }
.badge.badge-muted { background: var(--muted); }
.chat-item.active .badge.badge-muted { background: rgba(255,255,255,.7); color: var(--accent); }

/* ---------- Настройки ---------- */
.setting-row.column { flex-direction: column; align-items: stretch; }
.setting-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
label.setting-row { flex-direction: row; font-size: inherit; color: inherit; cursor: pointer; }
.block { display: block; font-size: 12px; margin-top: 2px; }
.hint { display: block; font-size: 12px; padding-bottom: 6px; }
.segmented { display: flex; background: var(--panel-2); border-radius: 10px; padding: 3px; }
.segmented button { flex: 1; border: 0; background: none; padding: 7px 6px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.segmented button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

@media (max-width: 760px) {
  .head-actions .icon-btn { width: 34px; height: 34px; }
  .call-overlay.minimized { left: 12px; width: auto; }
  .note { width: 200px; height: 200px; }
  .panel { height: 260px; }
  .bubble.voice { min-width: 220px; }
}
