/* Final mobile and branding corrections. Loaded after legacy styles. */
.wordmark::before,
.empty-state::before {
  content: none !important;
  display: none !important;
  background: none !important;
}

.wordmark img {
  display: inline-block !important;
  width: 26px !important;
  height: 26px !important;
  object-fit: contain !important;
  margin-right: 7px !important;
}

.empty-state > img {
  display: block !important;
  width: 62px !important;
  height: 62px !important;
  object-fit: contain !important;
  margin: 0 auto 18px !important;
}

.empty-state {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.profile-button .avatar-fallback,
.profile-button .avatar {
  color: #ffffff !important;
  background: #6674df !important;
}

.flight-dot {
  display: none !important;
}

@media (max-width: 720px) {
  html,
  body,
  #app-view {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
  }

  .auth-shell {
    min-height: 100dvh !important;
  }

  .auth-panel {
    padding-bottom: calc(32px + env(safe-area-inset-bottom)) !important;
  }

  #app-view.chat-open .app-grid,
  #app-view.chat-open .conversation,
  #conversation-content {
    height: auto !important;
    min-height: calc(100dvh - 68px) !important;
    overflow: visible !important;
  }

  header {
    height: 68px !important;
    padding: 0 12px !important;
  }

  .wordmark {
    display: flex !important;
    align-items: center !important;
    font-size: 20px !important;
    white-space: nowrap !important;
  }

  .identity {
    gap: 7px !important;
    background: transparent !important;
    padding: 0 !important;
  }

  .install-app,
  .profile-button,
  .icon-button {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    border: 1px solid #d7d1f7 !important;
    background: #ffffff !important;
    color: #5d4fb2 !important;
  }

  .profile-button {
    padding: 2px !important;
    position: relative !important;
  }

  .profile-button .avatar {
    display: none !important;
  }

  .profile-button::after {
    content: attr(data-initials) !important;
    display: grid !important;
    place-items: center !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: #6674df !important;
    color: #ffffff !important;
    font: 800 10px/1 Nunito, sans-serif !important;
  }

  .conversation-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 14px 16px !important;
    min-height: auto !important;
  }

  .conversation-header .chat-title {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .conversation-header h2 {
    font-size: 18px !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }

  .conversation-header .route-button {
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    font-size: 11px !important;
    min-height: 36px !important;
    border-radius: 10px !important;
    white-space: nowrap !important;
    box-shadow: none !important;
  }

  .back-to-contacts {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: #f0f2fa !important;
    color: #5d4fb2 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    border: 0 !important;
  }

  .app-grid #friends-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    overflow-x: hidden !important;
    padding-bottom: 8px !important;
  }

  .app-grid #friends-list button {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
    padding: 10px 14px !important;
    border-radius: 14px !important;
    background: #ffffff !important;
    border: 1px solid #eef0f8 !important;
    box-shadow: 0 2px 8px rgba(53, 65, 105, 0.04) !important;
    text-align: left !important;
  }

  .app-grid #friends-list button.active {
    background: var(--lavender) !important;
    border-color: #d7d1f7 !important;
  }

  .app-grid #friends-list button .avatar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    width: 40px !important;
    height: 40px !important;
    font-size: 13px !important;
  }

  .app-grid #friends-list button .friend-copy {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .app-grid #friends-list button strong {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: var(--ink) !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
  }

  .app-grid #friends-list button small {
    font-size: 12px !important;
    color: var(--muted) !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
  }

  #message-form {
    padding-bottom: calc(26px + env(safe-area-inset-bottom)) !important;
  }

  .demo-login ul {
    grid-template-columns: 1fr !important;
  }
}

.remember-login {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.remember-login input {
  width: 18px;
  height: 18px;
  padding: 0 !important;
}

.demo-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #ffffff;
  font-weight: 800;
  padding: 6px 0;
  text-align: center;
  cursor: pointer;
}
