/* Atlas Day 4.8.5: identity, navigation and unified messenger. */

.brand .brand-mark[data-atlas-logo="4.8.5"] {
  background: #fff;
  border: 1px solid rgba(96, 239, 255, .42);
  border-radius: 13px;
  box-shadow: 0 5px 18px rgba(0, 131, 176, .2);
  overflow: hidden;
}

.brand .brand-mark[data-atlas-logo="4.8.5"] img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.creator-credit[data-atlas-credit="4.8.5"] {
  align-items: center;
  color: rgba(255, 255, 255, .78);
  display: flex;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 650;
  gap: 8px;
  letter-spacing: .035em;
  line-height: 1.25;
  min-height: 42px;
  padding: 7px 9px;
}

.creator-credit[data-atlas-credit="4.8.5"] img {
  background: #fff;
  border-radius: 9px;
  flex: 0 0 34px;
  height: 34px;
  object-fit: cover;
  width: 34px;
}

.sidebar nav button.atlas-service-start {
  margin-top: 28px;
  position: relative;
}

.sidebar nav button.atlas-service-start::before {
  color: #8fa0b9;
  content: "Профиль и система";
  font-size: 9px;
  font-weight: 800;
  left: 12px;
  letter-spacing: .12em;
  position: absolute;
  text-transform: uppercase;
  top: -20px;
}

.atlas-edit-target {
  animation: atlas-edit-focus 1.5s ease;
  scroll-margin-top: 24px;
}

@keyframes atlas-edit-focus {
  0%, 100% { box-shadow: 0 16px 40px rgba(36, 50, 74, .07); }
  30% { box-shadow: 0 0 0 5px rgba(0, 180, 219, .24), 0 16px 40px rgba(0, 131, 176, .18); }
}

body.atlas-messenger-active .content {
  max-width: 1600px;
  padding-left: calc(5.5vw + 320px);
}

.atlas-messenger-nav {
  background: linear-gradient(165deg, #141a2a, #0f111a 60%, #17243a);
  border: 1px solid rgba(96, 239, 255, .18);
  border-radius: 19px;
  color: #f4f7ff;
  height: min(760px, calc(100vh - 92px));
  min-height: 520px;
  overflow: hidden;
  padding: 14px;
  left: 282px;
  position: fixed;
  top: 28px;
  width: 290px;
  z-index: 120;
}

.atlas-messenger-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.atlas-messenger-header p { font: 700 20px/1.15 Montserrat, sans-serif; margin: 0; }
.atlas-messenger-header small { color: #8f9bb4; display: block; font-size: 10px; margin-top: 3px; }

.atlas-events-shortcut,
.atlas-atlas-shortcut,
.atlas-new-message {
  background: rgba(96, 239, 255, .1);
  border: 1px solid rgba(96, 239, 255, .24);
  border-radius: 10px;
  color: #baf7ff;
  min-height: 36px;
  padding: 8px 10px;
}

.atlas-messenger-header-actions { display: flex; gap: 6px; }
.atlas-events-shortcut,
.atlas-atlas-shortcut { font-size: 10px; white-space: nowrap; }
.atlas-atlas-shortcut { background: linear-gradient(135deg, rgba(0, 180, 219, .22), rgba(0, 131, 176, .3)); color: #e8fdff; }
.atlas-new-message { font-size: 12px; font-weight: 800; width: 100%; }

.atlas-events-shortcut:focus-visible,
.atlas-atlas-shortcut:focus-visible,
.atlas-thread-atlas-exit:focus-visible,
.atlas-group-back:focus-visible,
.atlas-messenger-back:focus-visible {
  outline: 3px solid #60efff;
  outline-offset: 2px;
}

.atlas-conversation-search {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .12);
  color: #fff;
  margin: 9px 0 5px;
  min-height: 40px;
}

.atlas-conversation-search::placeholder { color: #8590a6; }

.atlas-conversation-items {
  height: calc(100% - 136px);
  overflow-y: auto;
  padding: 0 2px 20px;
}

.atlas-conversation-section {
  color: #7f8ba3;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .12em;
  margin: 14px 8px 6px;
  text-transform: uppercase;
}

.atlas-conversation-item,
.atlas-contact-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 13px;
  color: #f4f7ff;
  display: grid;
  gap: 10px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  margin: 2px 0;
  min-height: 58px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.atlas-conversation-item:hover,
.atlas-conversation-item.selected,
.atlas-contact-item:hover { background: rgba(96, 239, 255, .11); }
.atlas-conversation-item.selected { box-shadow: inset 3px 0 #60efff; }

.atlas-thread-avatar {
  align-items: center;
  background: linear-gradient(135deg, #4158d0, #60efff);
  border-radius: 14px;
  color: #fff;
  display: flex;
  flex: 0 0 42px;
  font-weight: 850;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  width: 42px;
}

.atlas-thread-avatar img { height: 100%; object-fit: cover; width: 100%; }
.atlas-conversation-copy { min-width: 0; }
.atlas-conversation-copy strong,
.atlas-conversation-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atlas-conversation-copy strong { font-size: 11px; }
.atlas-conversation-copy small { color: #8f9bb4; font-size: 9px; margin-top: 5px; }
.atlas-conversation-meta { align-items: end; display: flex; flex-direction: column; gap: 6px; }
.atlas-conversation-meta time { color: #7f8ba3; font-size: 8px; }
.atlas-conversation-meta b { align-items: center; background: #00b4db; border-radius: 999px; display: flex; font-size: 9px; height: 19px; justify-content: center; min-width: 19px; padding: 0 5px; }
.atlas-conversation-empty { color: #8590a6; font-size: 11px; padding: 8px; }

.atlas-contact-picker {
  background: #121827;
  border: 1px solid rgba(96, 239, 255, .28);
  border-radius: 16px;
  inset: 10px;
  overflow-y: auto;
  padding: 12px;
  position: absolute;
  z-index: 4;
}

.atlas-contact-picker > header { align-items: center; display: flex; justify-content: space-between; }
.atlas-contact-picker > header button { background: transparent; border: 0; color: #fff; font-size: 24px; }
.atlas-contact-note { color: #8f9bb4; font-size: 10px; }
.atlas-contact-item { grid-template-columns: 42px minmax(0, 1fr); }
.atlas-contact-item span strong,
.atlas-contact-item span small { display: block; }
.atlas-contact-item span small { color: #8f9bb4; font-size: 9px; margin-top: 4px; }

.atlas-direct-view {
  background: linear-gradient(165deg, #181b26, #0f111a);
  border: 1px solid rgba(96, 239, 255, .18);
  border-radius: 19px;
  color: #f5f7ff;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  bottom: 28px;
  height: auto;
  left: 596px;
  min-height: 520px;
  overflow: hidden;
  position: fixed;
  right: 28px;
  top: 28px;
  z-index: 121;
}

.atlas-group-back,
.atlas-thread-atlas-exit { display: none; }

.atlas-direct-header {
  align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(26, 34, 55, .86);
  border-bottom: 1px solid rgba(96, 239, 255, .14);
  display: flex;
  gap: 10px;
  min-height: 70px;
  padding: 10px 15px;
}

.atlas-direct-header strong,
.atlas-direct-header small { display: block; }
.atlas-direct-header strong { font-size: 13px; }
.atlas-direct-header small { color: #93a0b9; font-size: 9px; margin-top: 3px; }

.atlas-messenger-back { background: transparent; border: 0; color: #dffbff; display: none; font-size: 22px; min-height: 44px; width: 44px; }

.atlas-direct-messages {
  align-content: end;
  background: radial-gradient(circle at 70% 0%, rgba(65, 88, 208, .22), transparent 40%), #10131d;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding: 18px;
}

.atlas-direct-message {
  align-self: flex-start;
  background: #20283a;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 6px 16px 16px 16px;
  max-width: min(72%, 560px);
  padding: 8px 10px 6px;
  position: relative;
}

.atlas-direct-message.own {
  align-self: flex-end;
  background: linear-gradient(135deg, #254fa4, #14799b);
  border-radius: 16px 6px 16px 16px;
  padding-right: 54px;
}

.atlas-direct-author { color: #7defff; display: block; font-size: 9px; margin-bottom: 4px; }
.atlas-direct-message p { font-size: 13px; line-height: 1.42; margin: 0; white-space: pre-wrap; }
.atlas-direct-message-meta { color: rgba(255, 255, 255, .55); display: block; font-size: 8px; margin-top: 5px; text-align: right; }
.atlas-direct-message-actions { position: absolute; right: 4px; top: 4px; z-index: 4; }
.atlas-direct-message-actions summary {
  align-items: center;
  background: rgba(15, 17, 26, .24);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 20px;
  height: 44px;
  justify-content: center;
  list-style: none;
  min-width: 44px;
  user-select: none;
}
.atlas-direct-message-actions summary::-webkit-details-marker { display: none; }
.atlas-direct-message-actions summary:focus-visible { outline: 3px solid #60efff; outline-offset: 2px; }
.atlas-direct-message-actions[open] summary { background: rgba(15, 17, 26, .62); }
.atlas-direct-message-action-menu {
  background: #171d2b;
  border: 1px solid rgba(96, 239, 255, .28);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .4);
  min-width: 132px;
  padding: 4px;
  position: absolute;
  right: 48px;
  top: 0;
}
.atlas-direct-message-action-menu button {
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: #ff9fb2;
  font-size: 12px;
  min-height: 44px;
  padding: 10px 14px;
  text-align: left;
  width: 100%;
}
.atlas-direct-message-action-menu button:hover,
.atlas-direct-message-action-menu button:focus-visible { background: rgba(255, 91, 124, .14); }
.atlas-direct-image img,
.atlas-direct-video { border-radius: 11px; display: block; margin-top: 6px; max-height: 320px; max-width: 100%; object-fit: contain; }
.atlas-direct-audio { margin-top: 6px; max-width: 100%; width: 300px; }
.atlas-direct-file { color: #baf7ff; display: block; font-size: 11px; margin-top: 7px; }

.atlas-direct-compose {
  align-items: end;
  background: #151a28;
  border-top: 1px solid rgba(96, 239, 255, .14);
  display: grid;
  gap: 8px;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  padding: 10px;
}

.atlas-direct-compose textarea { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; max-height: 120px; min-height: 44px; resize: none; }
.atlas-direct-attach,
.atlas-direct-send { background: rgba(96, 239, 255, .12); border: 1px solid rgba(96, 239, 255, .26); border-radius: 50%; color: #dffbff; height: 44px; padding: 0; width: 44px; }
.atlas-direct-send { background: linear-gradient(135deg, #4158d0, #00b4db); color: #fff; }
.atlas-direct-status { color: #ffb5b5; font-size: 9px; grid-column: 2 / 4; margin: 0; }

@media (width <= 980px) {
  body.atlas-messenger-active .content { padding-left: 292px; padding-right: 22px; }
  .atlas-messenger-nav { left: 272px; width: 250px; }
  .atlas-direct-view { left: 536px; right: 14px; }
}

@media (width <= 760px) {
  body.atlas-messenger-active .content { padding-left: 18px; padding-right: 18px; }
  .atlas-messenger-nav { border-radius: 0; height: 100dvh; inset: 0; min-height: 480px; padding-top: calc(14px + env(safe-area-inset-top)); width: auto; z-index: 2000; }
  .atlas-messenger-header { gap: 8px; }
  .atlas-messenger-header-actions { flex: 0 0 auto; }
  .atlas-events-shortcut,
  .atlas-atlas-shortcut { min-height: 44px; padding: 9px 10px; }
  body.atlas-messenger-thread-open > .atlas-messenger-nav { display: none; }
  .atlas-direct-view { border-radius: 0; bottom: 0; height: 100dvh; left: 0; min-height: 480px; right: 0; top: 0; z-index: 2001; }
  .atlas-group-back { background: #17243a; border: 1px solid rgba(96, 239, 255, .3); border-radius: 999px; color: #fff; display: none; left: 12px; min-height: 42px; padding: 8px 14px; position: fixed; top: calc(10px + env(safe-area-inset-top)); z-index: 1999; }
  body.atlas-messenger-thread-open:not(.atlas-messenger-direct) > .atlas-group-back { display: block; }
  body.atlas-messenger-thread-open > .atlas-thread-atlas-exit {
    align-items: center;
    background: rgba(23, 36, 58, .96);
    border: 1px solid rgba(96, 239, 255, .38);
    border-radius: 999px;
    color: #effdff;
    display: inline-flex;
    font-size: 10px;
    font-weight: 800;
    justify-content: center;
    min-height: 44px;
    min-width: 76px;
    padding: 8px 12px;
    position: fixed;
    right: calc(58px + env(safe-area-inset-right));
    top: calc(7px + env(safe-area-inset-top));
    z-index: 2006;
  }
  .atlas-messenger-back { display: block; }
  .atlas-direct-message { max-width: 88%; }
  .atlas-direct-messages { padding: 12px; }
  .atlas-direct-compose { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-edit-target { animation: none; }
}
