/* V112: stable first-load workspace, equal-height desktop panels, profile personalization. */
body.social-authenticated .social-contact {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 40px minmax(0, 1fr) 30px !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
  min-height: 62px !important;
  padding: 9px 9px !important;
  border: 1px solid rgba(112, 164, 224, .14) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, .025) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .045) !important;
  cursor: pointer !important;
  transform: none !important;
}

body.social-authenticated .social-contact:hover,
body.social-authenticated .social-contact:focus-visible,
body.social-authenticated .social-contact.is-active {
  outline: 0 !important;
  border-color: rgba(96, 179, 245, .34) !important;
  background: linear-gradient(145deg, rgba(115, 101, 247, .19), rgba(57, 150, 226, .09)) !important;
  box-shadow: inset 3px 0 #42c7e6, inset 0 1px rgba(255, 255, 255, .08) !important;
}

body.social-authenticated .social-contact-avatar {
  width: 40px !important;
  height: 40px !important;
  border-radius: 13px !important;
  font-size: 11px !important;
}

body.social-authenticated .social-contact-identity {
  display: grid !important;
  min-width: 0 !important;
  align-content: center !important;
  gap: 2px !important;
}

body.social-authenticated .social-contact-identity strong {
  color: var(--hf-ink, #eef6ff) !important;
  font-size: 11px !important;
  font-weight: 850 !important;
}

body.social-authenticated .social-contact-identity .social-contact-last-seen {
  display: block !important;
  min-height: 11px !important;
  margin: 0 !important;
  color: #77d5eb !important;
  font-size: 8px !important;
  line-height: 1.25 !important;
  opacity: 1 !important;
}

body.social-authenticated .social-contact-identity p {
  display: none !important;
}

body.social-authenticated .social-contact-actions,
body.social-authenticated .social-dashboard-grid.direct-chat-open .social-contact-actions {
  display: flex !important;
  grid-column: auto !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0 !important;
}

body.social-authenticated .social-contact-message,
body.social-authenticated .social-contact-call,
body.social-authenticated .social-dashboard-grid.direct-chat-open .social-contact-message,
body.social-authenticated .social-dashboard-grid.direct-chat-open .social-contact-call {
  display: none !important;
}

body.social-authenticated .social-contact-menu {
  display: grid !important;
  width: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  place-items: center !important;
  padding: 0 !important;
  border-radius: 10px !important;
  opacity: .72 !important;
}

body.social-authenticated .social-contact:hover .social-contact-menu,
body.social-authenticated .social-contact:focus-within .social-contact-menu {
  opacity: 1 !important;
}

/* Personalization is a normal card inside Profile. */
body.social-authenticated [data-social-panel="profile"] .halo-profile-personalization-card {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 22px !important;
}

body.social-authenticated [data-social-panel="profile"] .social-profile-grid > .social-side-stack {
  height: auto !important;
  min-height: 0 !important;
  grid-template-rows: none !important;
  align-content: start !important;
}

body.social-authenticated [data-social-panel="profile"] .social-profile-grid > .social-side-stack > * {
  height: auto !important;
  min-height: 0 !important;
}

body.social-authenticated [data-social-panel="profile"] .halo-profile-personalization-card .personalization-grid {
  width: 100% !important;
}

body.social-authenticated [data-social-panel="profile"] {
  overflow-y: auto !important;
}

@media (min-width: 681px) {
  body.social-authenticated {
    --halo-workspace-height: calc(100dvh - 106px);
  }

  body.social-authenticated #social-shell.social-shell .social-rail,
  body.social-authenticated[data-halo-social-view="chats"] #social-shell.social-shell > .social-main,
  body.social-authenticated[data-halo-social-view="chats"] .social-view[data-social-panel="chats"],
  body.social-authenticated[data-halo-social-view="chats"] .social-dashboard-grid,
  body.social-authenticated[data-halo-social-view="chats"] .social-contacts-card,
  body.social-authenticated[data-halo-social-view="chats"] #direct-chat-card:not([hidden]) {
    box-sizing: border-box !important;
    height: var(--halo-workspace-height) !important;
    min-height: 0 !important;
    max-height: var(--halo-workspace-height) !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] #social-shell.social-shell > .social-main {
    border: 0 !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-main-header {
    display: none !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-view[data-social-panel="chats"] {
    position: relative !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-dashboard-grid,
  body.social-authenticated[data-halo-social-view="chats"] .social-dashboard-grid.direct-chat-open {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: clamp(230px, 18vw, 272px) minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 14px !important;
    overflow: hidden !important;
    border: 0 !important;
    background: transparent !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-contacts-card {
    display: flex !important;
    width: auto !important;
    min-width: 0 !important;
    flex-direction: column !important;
    padding: 14px !important;
    overflow: hidden !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-card-head > div:first-child > p {
    display: none !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-card-head h2 {
    margin: 2px 0 0 !important;
    font-size: 17px !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-search {
    flex: 0 0 auto !important;
    margin: 14px 0 10px !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-contact-list {
    min-height: 0 !important;
    padding: 2px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-dashboard-grid.direct-chat-open > .social-side-stack {
    display: none !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] #direct-chat-card:not([hidden]) {
    display: grid !important;
    width: auto !important;
    min-width: 0 !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    overflow: hidden !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .direct-chat-messages {
    position: relative !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .direct-chat-empty {
    position: absolute !important;
    inset-block: 0 !important;
    left: 50% !important;
    width: min(760px, calc(100% - 24px)) !important;
    max-width: 760px !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    align-self: center !important;
    justify-self: center !important;
    place-content: center !important;
    place-items: center !important;
    margin: 0 !important;
    transform: translateX(calc(-50% + var(--cc-chat-dock-shift, 0px))) !important;
    text-align: center !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] #direct-chat-form > div {
    width: min(760px, 100%) !important;
    max-width: 760px !important;
    margin-inline: auto !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .direct-chat-empty h3,
  body.social-authenticated[data-halo-social-view="chats"] .direct-chat-empty p {
    width: 100% !important;
    margin-inline: auto !important;
    text-align: center !important;
  }
}

/* Device-local personalization: these rules never add server or database work. */
html[data-halo-chat-density="compact"] body.social-authenticated .direct-chat-card .direct-chat-messages {
  gap: 6px !important;
  padding-block: 14px !important;
}

html[data-halo-chat-density="comfortable"] body.social-authenticated .direct-chat-card .direct-chat-messages {
  gap: 10px !important;
  padding-block: 22px !important;
}

html[data-halo-chat-density="spacious"] body.social-authenticated .direct-chat-card .direct-chat-messages {
  gap: 16px !important;
  padding-block: 30px !important;
}

@media (min-width: 681px) {
  body.social-authenticated[data-halo-social-view="chats"] .direct-chat-message {
    box-sizing: border-box !important;
    max-width: min(78%, 520px) !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .halo-chat-system-note.is-on-hold {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 760px !important;
    align-self: stretch !important;
    margin: 0 auto 8px !important;
    text-align: center !important;
  }
}

html[data-halo-chat-shape="rounded"] body.social-authenticated .direct-chat-card .direct-chat-message {
  border-radius: 22px !important;
}

html[data-halo-chat-shape="rounded"] body.social-authenticated .direct-chat-card .direct-chat-message.outgoing {
  border-radius: 22px 22px 8px 22px !important;
}

html[data-halo-chat-shape="soft"] body.social-authenticated .direct-chat-card .direct-chat-message {
  border-radius: 12px !important;
}

html[data-halo-chat-shape="square"] body.social-authenticated .direct-chat-card .direct-chat-message {
  border-radius: 5px !important;
}

html[data-halo-chat-background="clean"] body.social-authenticated .direct-chat-card .direct-chat-messages {
  background-image: none !important;
}

html[data-halo-chat-background="aurora"] body.social-authenticated .direct-chat-card .direct-chat-messages {
  background:
    radial-gradient(circle at 14% 88%, color-mix(in srgb, var(--halo-chat-accent) 15%, transparent), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(95, 86, 255, .14), transparent 32%),
    rgba(7, 15, 29, .08) !important;
}

html[data-halo-chat-background="grid"] body.social-authenticated .direct-chat-card .direct-chat-messages {
  background-color: rgba(7, 15, 29, .08) !important;
  background-image:
    linear-gradient(rgba(126, 164, 219, .065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 164, 219, .065) 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
}

@media (max-width: 680px) {
  body.social-authenticated #social-shell.social-shell .social-nav,
  body.social-authenticated .social-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    justify-content: center !important;
    justify-items: center !important;
    align-items: center !important;
  }

  body.social-authenticated #social-shell.social-shell .social-nav-button,
  body.social-authenticated .social-nav-button {
    place-items: center !important;
    align-content: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  body.social-authenticated .social-nav-button .nav-icon,
  body.social-authenticated .social-nav-button b {
    margin-inline: auto !important;
    text-align: center !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-main-header {
    display: none !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-view[data-social-panel="chats"] {
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .social-dashboard-grid.direct-chat-open {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] #direct-chat-card:not([hidden]) {
    position: absolute !important;
    z-index: 120 !important;
    inset: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
  }

  body.social-authenticated[data-halo-social-view="chats"] .direct-chat-notice {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.social-authenticated .social-contact {
    grid-template-columns: 42px minmax(0, 1fr) 30px !important;
    min-height: 64px !important;
    padding: 10px !important;
  }

  body.social-authenticated .social-contact-avatar {
    width: 42px !important;
    height: 42px !important;
  }
}
