:root {
  --bg: #0b1220;
  --bg-elevated: #121a2b;
  --bg-card: #172033;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e8eef8;
  --text-muted: #94a3b8;
  --accent: #0d9488;
  --accent-soft: rgba(13, 148, 136, 0.16);
  --danger: #ef4444;
  --ok: #22c55e;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", "Manrope", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(13, 148, 136, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, 0.12), transparent 50%),
    var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.screen.is-active {
  display: flex;
}

/* —— Login —— */
.login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + var(--safe-b));
}

.login__card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 22px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login__logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto 14px;
  object-fit: contain;
}

.login__brand {
  font-size: 1.75rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}

.login__sub {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.login__card .field {
  text-align: left;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.search-input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.search-input::placeholder {
  color: #94a3b8;
}

.field__password {
  position: relative;
}

.field__password input {
  padding-right: 48px;
}

.field__toggle-pass {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.field__toggle-pass:hover,
.field__toggle-pass:focus-visible {
  color: #5eead4;
  background: var(--accent-soft);
  outline: none;
}

.field__toggle-pass[aria-pressed="true"] {
  color: #5eead4;
}

.field__eye {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.field__eye[hidden],
.field__toggle-pass[aria-pressed="false"] .field__eye--hide,
.field__toggle-pass:not([aria-pressed="true"]) .field__eye--hide {
  display: none !important;
}

.field__toggle-pass[aria-pressed="true"] .field__eye--show {
  display: none !important;
}

.field__toggle-pass[aria-pressed="true"] .field__eye--hide {
  display: block !important;
}

.field input:focus,
.search-input:focus,
.composer__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 650;
  cursor: pointer;
}

.btn--primary {
  width: 100%;
  background: var(--accent);
  color: #042f2e;
}

.btn--primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 10px;
}

.login__error {
  min-height: 1.2em;
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 0.85rem;
}

/* —— Shell —— */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(197, 205, 216, 0.12);
  background: rgba(30, 37, 51, 0.3);
  color: #c5cdd8;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.topbar__back {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.topbar__back.is-visible {
  display: inline-flex;
}

.topbar__back:hover,
.topbar__back:focus-visible {
  background: #f8fafc;
  color: #020617;
  outline: none;
}

.topbar__call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #3b82f6;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
}

.topbar__call[hidden] {
  display: none !important;
}

.topbar__call:hover,
.topbar__call:focus-visible {
  background: #2563eb;
  outline: none;
}

.topbar__call:disabled {
  opacity: 0.55;
  cursor: wait;
}

.topbar__call svg {
  width: 20px;
  height: 20px;
}

.topbar__notify {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.topbar__notify[hidden] {
  display: none !important;
}

.topbar__notify:hover,
.topbar__notify:focus-visible {
  background: #ffffff;
  outline: none;
}

.topbar .btn--ghost {
  color: #c5cdd8;
}

.topbar .btn--ghost:hover,
.topbar .btn--ghost:focus-visible {
  color: #ffffff;
  background: #2a3347;
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 12px calc(var(--nav-h) + var(--safe-b) + 16px);
  background: transparent;
}

.panel {
  display: none;
  min-height: 100%;
  background: transparent;
}

.panel.is-active {
  display: block;
}

/* Фон разделов: чаты, напоминания, задачи, компании — под экран, без скролла */
#screen-main.is-active {
  position: relative;
  background-color: #061018;
  background-image: none;
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
}

#screen-main.is-active::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #061018;
  background-image: url("../images/section-bg.png?v=2");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: scroll;
  transform: translateZ(0);
}

#screen-main.is-active > * {
  position: relative;
  z-index: 1;
}

.state {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
}

.state--error {
  color: #fca5a5;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(23, 32, 51, 0.5);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.card--chat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.card__avatar-wrap {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #1e293b;
  border: 2px solid rgba(148, 163, 184, 0.25);
  display: block;
}

.card__avatar-wrap--unread {
  width: calc(44px * 1.2);
  height: calc(44px * 1.2);
}

.card__avatar-wrap--unread .card__avatar {
  width: calc(44px * 1.2);
  height: calc(44px * 1.2);
  border-color: rgba(45, 212, 191, 0.65);
  box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.45);
  animation: avatar-breathe 1.8s ease-in-out infinite;
}

@keyframes avatar-breathe {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.35);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(45, 212, 191, 0);
  }
}

.card__body {
  flex: 1;
  min-width: 0;
}

.card--unread .card__title {
  font-weight: 800;
  color: #f8fafc;
}

.card:active {
  transform: scale(0.99);
}

.card__title {
  font-weight: 650;
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.card__meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.card__badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #5eead4;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: transparent;
  padding-bottom: 0;
}

.search-input {
  flex: 1;
}

/* —— Bottom nav —— */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  border-top: 1px solid rgba(197, 205, 216, 0.12);
  background: #1e2533;
  backdrop-filter: none;
}

.tabbar__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #c5cdd8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
  padding: 4px 2px;
}

.tabbar__btn svg {
  width: 22px;
  height: 22px;
}

.tabbar__btn:hover {
  background: #2a3347;
  color: #ffffff;
}

.tabbar__btn.is-active {
  color: #ffffff;
  background: #3b82f6;
}

body.is-chat-open .tabbar {
  display: none;
}

body.is-chat-open #screen-main.is-active {
  position: relative;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background-color: #f3d6d9;
}

/* Фон переписки на весь экран (в т.ч. под шапкой) — без синей полосы */
body.is-chat-open #screen-main.is-active::before {
  background-color: #f3d6d9;
  background-image: url("../images/chat-bg.png?v=3");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

/* Полоса шапки остаётся, но прозрачная: назад + ФИО + звонок */
body.is-chat-open .topbar {
  position: relative;
  z-index: 30;
  flex-shrink: 0;
  background: transparent !important;
  border-bottom: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}

body.is-chat-open .topbar__title {
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.75);
}

body.is-chat-open .content {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  background: transparent;
}

body.is-chat-open #panel-messenger.is-active {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

body.is-chat-open .chat-thread {
  padding-top: 0;
  background-color: transparent;
}

body.is-chat-open .chat-thread__bg {
  background-color: transparent;
  /* тот же фон уже на screen-main — слой можно оставить для стабильности */
  background-image: url("../images/chat-bg.png?v=3");
}

/* —— Messenger —— */
.chat-layout {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 56px - var(--nav-h) - var(--safe-b));
}

.chat-layout.is-thread .contacts-only {
  display: none;
}

.chat-layout:not(.is-thread) .thread-only {
  display: none;
}

.chat-thread {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background-color: #f3d6d9;
  isolation: isolate;
}

.chat-thread__bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #f3d6d9;
  background-image: url("../images/chat-bg.png?v=3");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  transform: translateZ(0);
}

.chat-thread::before {
  display: none;
}

.chat-thread__scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 8px;
  -webkit-overflow-scrolling: touch;
  background: transparent !important;
  background-image: none !important;
}

.chat-thread__load-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 12px;
}

.chat-thread__load-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.88);
  color: #475569;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-thread__load-btn:hover:not(:disabled) {
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.45);
}

.chat-thread__load-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.msg-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.msg-swipe {
  position: relative;
  display: flex;
  align-self: flex-start;
  max-width: 86%;
  width: fit-content;
}

.msg-swipe:has(.msg--own) {
  align-self: flex-end;
}

.msg-swipe__hint {
  position: absolute;
  left: 10px;
  top: 50%;
  z-index: 0;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.9);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.msg-swipe.is-swiping .msg-swipe__hint {
  opacity: 0.55;
}

.msg-swipe.is-swipe-ready .msg-swipe__hint {
  opacity: 1;
  transform: scale(1);
}

.msg {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.65);
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.msg.is-swiping {
  transition: none;
  user-select: none;
}

.msg.is-swipe-ready {
  box-shadow: 0 2px 14px rgba(37, 99, 235, 0.28);
}

.msg--own {
  background: rgba(219, 234, 254, 0.95);
  border-color: rgba(147, 197, 253, 0.85);
}

.msg__author {
  display: block;
  font-size: 0.72rem;
  color: #0d9488;
  margin-bottom: 2px;
}

.msg__text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #0f172a;
}

.msg__time {
  display: block;
  margin-top: 0;
  font-size: 0.68rem;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.msg__read {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: #2563eb;
  line-height: 0;
}

.msg__read-icon {
  display: block;
}

.msg--own .msg__read {
  color: #3b82f6;
}

.msg__quote {
  margin: 0 0 6px;
  padding: 6px 8px;
  border-left: 3px solid #0d9488;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 0 8px 8px 0;
}

.msg__quote-author {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0d9488;
  margin-bottom: 2px;
}

.msg__quote-text {
  display: block;
  font-size: 0.78rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg__footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: nowrap;
}

.msg__actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

.msg__action {
  appearance: none;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.65rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.msg__action:hover {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.msg__action--danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.composer__mode {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 12px 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.88);
}

.composer__mode-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.composer__mode-text strong {
  color: #5eead4;
  font-weight: 700;
}

.composer__mode-text span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer__mode-cancel {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.composer__mode-cancel:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
}

.chat-thread__scroll .state {
  color: #1e293b;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}

.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 0 4px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(transparent, var(--bg) 30%);
}

.composer-dock {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  margin-top: auto;
  background: transparent;
  border-top: none;
  box-shadow: none;
}

.composer--dock {
  position: relative;
  flex-shrink: 0;
  align-items: center;
  padding: 10px 12px calc(10px + var(--safe-b));
  border-top: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.composer__field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.composer__input {
  flex: 1;
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #ffffff;
  color: #0f172a;
  border-radius: 14px;
  padding: 10px 76px 10px 12px;
  line-height: 1.35;
  box-sizing: border-box;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.composer__input::placeholder {
  color: #94a3b8;
}

.composer__tools {
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 34px;
}

/* Центр иконок по высоте, пока поле пустое */
.composer__input:placeholder-shown + .composer__tools {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

.composer__tool {
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer__tool svg {
  width: 20px;
  height: 20px;
}

.composer__tool:hover,
.composer__tool.is-active {
  color: #0d9488;
  background: rgba(13, 148, 136, 0.12);
}

.composer__emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 12px 0;
  padding: 8px 10px;
  max-height: 148px;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.88);
}

.composer__emoji-item {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.composer__emoji-item:hover {
  background: rgba(148, 163, 184, 0.16);
}

.composer__pending {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.88);
}

.composer__pending-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.composer__pending-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.composer__pending-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer__pending-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer__pending-size {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.composer__pending-remove {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.composer__pending-remove:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.msg__image-link {
  display: block;
  margin: 0 0 6px;
}

.msg__image {
  display: block;
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  object-fit: cover;
}

.msg__file {
  display: inline-block;
  margin: 0 0 6px;
  color: #7dd3fc;
  text-decoration: underline;
  font-size: 0.88rem;
  word-break: break-word;
}

.composer__send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.composer__send:hover,
.composer__send:focus-visible {
  background: #1d4ed8;
  outline: none;
}

.composer__send:active {
  transform: scale(0.96);
}

.composer__send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.composer__send--recording {
  background: #dc2626;
  box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45);
  animation: composer-send-pulse 1.1s ease-out infinite;
}

.composer__send--recording:hover,
.composer__send--recording:focus-visible {
  background: #b91c1c;
}

@keyframes composer-send-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(220, 38, 38, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

.composer__voice-tip {
  margin: 0 12px 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.16);
  color: #fecaca;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.msg__voice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(220px, 72vw);
  max-width: 100%;
  margin: 2px 0 4px;
  padding: 4px 2px;
}

.msg__voice-play {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}

.msg--own .msg__voice-play {
  background: #1d4ed8;
}

.msg__voice-play:hover,
.msg__voice-play:focus-visible {
  filter: brightness(1.08);
  outline: none;
}

.msg__voice-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.msg__voice-track {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
}

.msg--own .msg__voice-track {
  background: rgba(37, 99, 235, 0.12);
}

.msg__voice-wave {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 0 6px;
  box-sizing: border-box;
}

.msg__voice-bar {
  flex: 1;
  max-width: 4px;
  height: var(--h, 40%);
  min-height: 18%;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.45);
}

.msg--own .msg__voice-bar {
  background: rgba(37, 99, 235, 0.45);
}

.msg__voice-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  z-index: 0;
  background: rgba(37, 99, 235, 0.22);
  pointer-events: none;
  transition: width 0.1s linear;
}

.msg__voice.is-playing .msg__voice-bar {
  background: rgba(37, 99, 235, 0.75);
}

.msg__voice-time {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  min-width: 2.4em;
  text-align: right;
}

.msg--own .msg__voice-time {
  color: #475569;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.chip.is-active {
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.45);
  background: var(--accent-soft);
}
.card--openable {
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.detail {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.detail__head {
  margin-bottom: 14px;
}

.detail__title {
  margin: 10px 0 0;
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.detail__row {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.detail__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail__value {
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
}

.detail__value--multiline {
  white-space: pre-wrap;
}

.detail__link {
  color: #7dd3fc;
  text-decoration: underline;
}

.detail__lpr {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.2);
}

.detail__lpr:last-child {
  border-bottom: none;
}

.detail__checklist {
  margin: 0;
  padding-left: 18px;
}

.detail__checklist li {
  margin: 4px 0;
}

.detail__checklist li.is-done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.detail__actions {
  margin-top: 16px;
}

.detail__actions .btn {
  width: 100%;
}

/* —— Аудиозвонки (как на полной версии) —— */
.msg--call-log {
  align-self: center;
  max-width: 92%;
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
  color: #334155;
}

.msg--call-log-missed {
  color: #b91c1c;
}

.btn--sm {
  padding: 8px 12px;
  font-size: 0.82rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.btn--danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.btn--danger:hover {
  background: #b91c1c;
}

.messenger-call-remote-audio {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.messenger-call-global-shell {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + var(--safe-b));
  z-index: 45;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  max-height: min(48vh, 320px);
}

body.is-chat-open .messenger-call-global-shell {
  bottom: 0;
}

.messenger-call-global-shell:not([hidden]) {
  pointer-events: auto;
}

.messenger-call-global-shell[hidden] {
  display: none !important;
}

.messenger-call-bar {
  flex-shrink: 0;
  width: 100%;
  background: linear-gradient(to top right, #6d28d9 0%, #312e81 45%, #0f172a 100%);
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.28);
}

.messenger-call-bar[hidden] {
  display: none !important;
}

.messenger-call-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  flex-wrap: wrap;
}

.messenger-call-bar__info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.messenger-call-bar__status {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.messenger-call-bar__names {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(220px, 48vw);
}

.messenger-call-bar__timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.messenger-call-bar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.messenger-call-bar__btn--active {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #1e40af !important;
  border-color: #fff !important;
}

.messenger-incoming-call-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 24px;
}

.messenger-incoming-call-overlay[hidden] {
  display: none !important;
}

.messenger-incoming-call {
  width: 100%;
  max-width: 400px;
  padding: 36px 28px 28px;
  border-radius: 24px;
  background: linear-gradient(to top right, #6d28d9 0%, #312e81 45%, #0f172a 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.22);
}

.messenger-incoming-call__avatar-wrap {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
}

.messenger-incoming-call__avatar {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.35);
}

.messenger-incoming-call__avatar--ringing {
  animation: messenger-incoming-avatar-pulse 1.4s ease-in-out infinite;
}

@keyframes messenger-incoming-avatar-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.messenger-incoming-call__name {
  margin: 0 0 28px;
  font-size: 1.35rem;
  font-weight: 650;
}

.messenger-incoming-call__actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 18px;
}

.messenger-incoming-call__btn {
  flex: 1;
  max-width: 150px;
  min-height: 52px;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 650;
  color: #fff;
  cursor: pointer;
}

.messenger-incoming-call__btn--accept {
  background: #22c55e;
}

.messenger-incoming-call__btn--decline {
  background: #ef4444;
}

.messenger-incoming-call__later {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
  cursor: pointer;
  font-size: 1rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  width: 100%;
  max-width: 400px;
  max-height: min(80vh, 560px);
  overflow: auto;
  background: #fff;
  color: #111827;
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.modal__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}

.modal__form {
  padding: 10px 12px 14px;
}

.messenger-call-add-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.messenger-forward-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: #111827;
}

.messenger-forward-item:hover {
  background: #f3f4f6;
}

.messenger-forward-item__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.messenger-contacts__empty {
  margin: 12px 8px;
  color: #6b7280;
  font-size: 0.9rem;
}

.messenger-call-screen-stage,
.messenger-call-screen-fullscreen {
  display: none;
}

body.messenger-call-shell-visible .content {
  padding-bottom: calc(var(--messenger-call-shell-height, 72px) + var(--nav-h) + var(--safe-b) + 8px);
}

body.messenger-call-shell-visible.is-chat-open .content {
  padding-bottom: 0;
}

body.messenger-call-shell-visible.is-chat-open .composer-dock {
  margin-bottom: var(--messenger-call-shell-height, 72px);
}

